blob: 33a89b5dd7a60dedc68cc4dab3c848a9cc47b1b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
clear = FrameBuffer $ ColorImage @1 $ V4 1 0 0 0.5
triangleRasterCtx = TriangleCtx CullNone PolygonFill NoOffset LastVertex
colorFragmentCtx = accumulationContext (ColorOp NoBlending (V4 True True True True))
rasterizeWith = Rasterize
triangles = triangleRasterCtx
quadVertexStream = fetch "quad" Triangle (Attribute "position" :: Vec 4 Float)
transform s f = Transform (\v -> VertexOut v 1 () (f v)) s
mapFragments s fs = accumulate colorFragmentCtx PassAll (FragmentShader $ \a -> fs a) s clear
render f = quadVertexStream -- id vertices
`transform` (\a -> (Smooth a,Smooth a))
& rasterizeWith triangles -- rasterize
`mapFragments` f
& ScreenOut -- draw into screen
main = render $ \(a,b) -> a `PrimAdd` b
|