clear' = FrameBuffer $ (DepthImage @1 1000, ColorImage @1 navy) -- ... clear = FrameBuffer $ (DepthImage @1 1000, ColorImage @1 maroon) -- ... triangleRasterCtx = TriangleCtx CullNone PolygonFill NoOffset LastVertex colorFragmentCtx = accumulationContext (DepthOp Less True, ColorOp NoBlending (V4 True True True True)) rasterizeWith = rasterizePrimitives triangles = triangleRasterCtx cubeVertexStream = fetch "stream4" (Attribute "position4" :: Vec 4 Float, Attribute "vertexUV" :: Vec 2 Float) mapFragments2 s fs = accumulate colorFragmentCtx ( \((a)) -> ((fs a))) s clear mapFragments22 s fs = accumulate colorFragmentCtx ( \((a)) -> ((fs a))) s clear' transform s f = mapPrimitives (\(v,u) -> (f v, u)) s rotate' v = (Uniform "MVP" :: Mat 4 4 Float) `PrimMulMatVec` v cube fb = cubeVertexStream -- cube vertices `transform` (scale 0.5 . rotate') -- scale them & rasterizeWith triangles ((Smooth)) -- rasterize `mapFragments23` (\a -> a%xyxy) where mapFragments23 s fs = accumulate colorFragmentCtx ( \((a)) -> ((fs a))) s fb cube' fb = cubeVertexStream -- cube vertices `transform` (scale 1.0 . rotate') -- scale them & rasterizeWith triangles ((Smooth)) -- rasterize `mapFragments2` (\a -> texture2D sampler a * V4 0.7 0.7 0.7 1) where sampler = Sampler LinearFilter MirroredRepeat $ Texture2D (V2 1024 768) (PrjImageColor fb) main = ScreenOut $ cube' $ cube' $ cube' $ cube' $ cube' $ cube clear