I see cats
This commit is contained in:
parent
e3be56ab6c
commit
c55cb22ee2
2 changed files with 17 additions and 3 deletions
|
@ -7,6 +7,6 @@ out vec2 v_texCoord;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = position;
|
gl_Position = vec4(position, 1);
|
||||||
v_texCoord = texCoord;
|
v_texCoord = vec2(texCoord.x, 1.0 - texCoord.y);
|
||||||
}
|
}
|
||||||
|
|
16
src/Main.hs
16
src/Main.hs
|
@ -170,16 +170,28 @@ main = do
|
||||||
-- <*> pure 1
|
-- <*> pure 1
|
||||||
-- GL.clearColor $= clearcol
|
-- 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
|
incrementValue <- takeMVar increment
|
||||||
redValue <- takeMVar red
|
redValue <- takeMVar red
|
||||||
let newRed = redValue + incrementValue
|
let newRed = redValue + incrementValue
|
||||||
|
|
||||||
-- write data to the uniform
|
-- write data to the uniform
|
||||||
bind sp
|
|
||||||
setUniform sp "u_color" (GL.Color4 newRed 0.5 0 1 :: GL.Color4 GL.GLfloat)
|
setUniform sp "u_color" (GL.Color4 newRed 0.5 0 1 :: GL.Color4 GL.GLfloat)
|
||||||
|
|
||||||
-- the actual drawing happens here
|
-- the actual drawing happens here
|
||||||
draw vao ibo sp
|
draw vao ibo sp
|
||||||
|
-- GL.drawElements GL.Triangles 6 GL.UnsignedInt nullPtr
|
||||||
err <- get GL.errors
|
err <- get GL.errors
|
||||||
when (not $ null err) (print $ "loop errors: " <> show err)
|
when (not $ null err) (print $ "loop errors: " <> show err)
|
||||||
|
|
||||||
|
@ -192,6 +204,8 @@ main = do
|
||||||
else
|
else
|
||||||
putMVar increment incrementValue
|
putMVar increment incrementValue
|
||||||
|
|
||||||
|
-- make GL finish things up
|
||||||
|
-- GL.flush
|
||||||
-- draw context on screen
|
-- draw context on screen
|
||||||
SDL.glSwapWindow window
|
SDL.glSwapWindow window
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue