This commit is contained in:
nek0 2020-05-22 02:38:32 +02:00
parent 750f55fda6
commit 1714facb11

View file

@ -167,28 +167,16 @@ main = do
-- <*> pure 1
-- GL.clearColor $= clearcol
-- clear buffers before drawing
-- GL.clear [GL.ColorBuffer]
-- -- rebind everything neccessary for draw call
-- bind vao
-- -- (note the missing bindings to the vertex buffer and the attrib pointer)
-- bind ibo
-- bind sp
-- throw away previous errors
-- void $ get GL.errors
incrementValue <- takeMVar increment
redValue <- takeMVar red
let newRed = redValue + incrementValue
-- write data to the uniform
bind sp
setUniform sp "u_color" (GL.Color4 newRed 0.5 0 1 :: GL.Color4 GL.GLfloat)
-- the actual drawing happens here
draw vao ibo sp
-- GL.drawElements GL.Triangles 6 GL.UnsignedInt nullPtr
err <- get GL.errors
when (not $ null err) (print $ "loop errors: " <> show err)
@ -201,8 +189,6 @@ main = do
else
putMVar increment incrementValue
-- make GL finish things up
-- GL.flush
-- draw context on screen
SDL.glSwapWindow window