GPipe-Core
GPipe-Core copied to clipboard
Multiple actions in one `Render` monad
Forgive me if this is covered by your tutorials, but it seems as though calling the same shader twice inside the same render call results in weird behaviour.
I'm trying to render a textured quad on top of another quad (that covers the entire viewport), but doing so in a single pass doesn't work. The following code results in the smaller quad being invisible and the fullsize quad texture 'wraps' around near the right edge, such that pixels by the edge are rendered in the centre of the image and pixels in that same area region are invisible.
I'm using separate uniform buffers for the two calls.
I'll post the implementation of renderHUD
and Surface.render
if necessary.
-- |
-- TODO | - This needs to be more flexible
-- - No hard-coded values
render :: App os -> AppT os ()
render app = GPipe.render $ do
clearWindowColor (app^.window) $ V4 1 1 1 1
clearWindowDepth (app^.window) $ 1.0
-- Render the canvas
Surface.render (app^.easel.canvas.surface) app
-- Render the UI
renderHUD app
Doing two passes works as expected.
render :: App os -> AppT os ()
render app = do
GPipe.render $ do
clearWindowColor (app^.window) $ V4 1 1 1 1
clearWindowDepth (app^.window) $ 1.0
-- Render the canvas
Surface.render (app^.easel.canvas.surface) app
GPipe.render $ do
-- Render the UI
renderHUD app
Apologies again if this has already been covered and thanks for a terrific library.
Pinging @tobbebex
Hi, something is clearly wrong, but I think I would need the entire source code to be able to debug this. Could you provide that?
For any issues like this, it would be great if you run your app through RenderDoc (https://renderdoc.org/) and send me the trace.
I’m a bit late to the party, but I’m facing the same kind of problem with the following code:
render $ do
clearWindowColor win 0.5
clearWindowDepth win 1 -- Far plane
-- A
primArray <- makePrimArray
shader $ ShaderEnvironment primArray (Back, ViewPort 0 size, DepthRange 0 1)
-- B + A works without this separate render, but A + B requires it.
render $ do
-- B
gridPrimArray <- makeGridPrimArray
gridShader $ GridShaderEnvironment gridPrimArray (FrontAndBack, ViewPort 0 size, DepthRange 0 1)
Full code: Test3.hs.txt