clear = FrameBuffer ((ColorImage @1 red)) -- ... triangleRasterCtx = TriangleCtx CullNone PolygonFill NoOffset LastVertex colorFragmentCtx = accumulationContext ((ColorOp NoBlending (V4 True True True True))) rasterizeWith = rasterizePrimitives triangles = triangleRasterCtx cubeVertexStream = fetch "stream4" ((Attribute "position4" :: Vec 4 Float)) mapFragments2 s fs = accumulate colorFragmentCtx (\() -> ((fs))) s clear transform s f = mapPrimitives (\((v)) -> ((f v))) s rotate :: Float -> Vec 4 Float -> Vec 4 Float rotate a v = M44F (V4 c (-s) 0 0) (V4 s c 0 0) (V4 0 0 1 0) (V4 0 0 0 1) `PrimMulMatVec` v where c = PrimCos a s = PrimSin a main = cubeVertexStream -- cube vertices `transform` (scale 0.1 . rotate 3) -- scale them & rasterizeWith triangles () -- rasterize `mapFragments2` blue -- set every pixel blue & ScreenOut -- draw into screen