time = Uniform "Time" :: Float 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" (Attribute "position" :: ((Vec 4 Float))) transform s f = Transform (\v -> VertexOut (f v) 1 () (Smooth v)) s mapFragments s fs = accumulate colorFragmentCtx PassAll (FragmentShader $ \((a)) -> ((fs a))) s clear render f = quadVertexStream -- id vertices `transform` id & rasterizeWith triangles -- rasterize `mapFragments` f & ScreenOut -- draw into screen fun x = if x < 0 then 0 else x +! fun (x -! 0.3) main' = render $ \c -> if fun time < 0.5 then c else blue