diff options
author | Csaba Hruska <csaba.hruska@gmail.com> | 2018-09-22 11:26:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-22 11:26:50 +0200 |
commit | 9f6e1725b52ea6f48101a37181f0aa9f7d1494d3 (patch) | |
tree | 7c10ffae525116bbdcf5a681f755e658078aa5fb /examples/pickInt.lc | |
parent | 42bc23db138991343708d14e2b5032d2dabd3d0d (diff) | |
parent | a5880684868824b34689df4589106730ad1c7fc0 (diff) |
Merge pull request #13 from deepfire/master
Keep track of GLRenderer outputs and fix integer render textures
Diffstat (limited to 'examples/pickInt.lc')
-rw-r--r-- | examples/pickInt.lc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/pickInt.lc b/examples/pickInt.lc new file mode 100644 index 0000000..a75bc19 --- /dev/null +++ b/examples/pickInt.lc | |||
@@ -0,0 +1,21 @@ | |||
1 | type FB = FrameBuffer 1 '[ 'Color (Vec 4 Int)] | ||
2 | |||
3 | scene :: String -> FB -> FB | ||
4 | scene name prevFB = | ||
5 | Accumulate ((ColorOp NoBlending (one :: Vec 4 Bool))) | ||
6 | (mapFragments (\(uv, rgba) -> ((rgba))) | ||
7 | $ rasterizePrimitives (TriangleCtx CullFront PolygonFill NoOffset LastVertex) (Flat, Flat) | ||
8 | $ mapPrimitives | ||
9 | (\(pos, color, id)-> | ||
10 | ( (Uniform "viewProj" :: Mat 4 4 Float) *. (V4 pos%x pos%y 0 1) | ||
11 | , V2 0.0 0.0 | ||
12 | , V4 0 0 0 id)) | ||
13 | $ fetch name ( Attribute "position" :: Vec 3 Float | ||
14 | , Attribute "color" :: Vec 4 Float | ||
15 | , Attribute "id" :: Int)) | ||
16 | prevFB | ||
17 | |||
18 | main :: Output | ||
19 | main = TextureOut (V2 800 600) $ | ||
20 | scene "objects" $ | ||
21 | FrameBuffer ((colorImage1 (V4 0 0 0 0))) | ||