I have some code like this:
-- RenderObjects existentially quantify their uniform/shader values
renderObject :: RenderObject os -> GLFWContext os ()
renderObject r = case r of
RenderObject shader chunks -> render $ renderAction shader chunks
RenderObjectUniforms uniform uValue shader chunks -> do
writeBuffer uniform 0 [uValue]
render $ renderAction shader chunks
RenderObjectUniformReference uniform uValueRef shader chunks -> do
uValue <- liftIO uValueRef
writeBuffer uniform 0 [uValue]
render $ renderAction shader chunks
-- inside the render loop:
do
writeBuffer viewmatrixBuffer 0 . pure $ matrix
render $ do
clearWindowColor win (V4 0.05 0.10 0.15 1.0 :: Fractional b => V4 b)
clearWindowDepth win 1
renderObject `mapM_` renderObjs
swapWindowBuffers win
When using a uniform to position the rendered objects, they flicker around wildly and overlap, presumably due to the buffer writes within the renderObject calls not necessarily being run before their respective render calls execute. I've only tried this code on one computer, so it might be related to the specific graphics drivers I'm using; I really have no clue.
I have some code like this:
When using a uniform to position the rendered objects, they flicker around wildly and overlap, presumably due to the buffer writes within the
renderObjectcalls not necessarily being run before their respective render calls execute. I've only tried this code on one computer, so it might be related to the specific graphics drivers I'm using; I really have no clue.