Set up vertex attributes using DSA

This commit is contained in:
2023-03-09 14:12:07 +00:00
parent 3e2b51b5e9
commit eab27776cf
+10 -3
View File
@@ -185,10 +185,17 @@ setupVertexAttribPointer ::
Int ->
IO ()
setupVertexAttribPointer vao vbo loc siz strd off = do
vertexAttribPointer (AttribLocation (fi loc))
$= (ToFloat, VertexArrayDescriptor (fi' siz) Float (fi'' $ floatSize * strd) (bufferOffset off))
vertexAttribArray (AttribLocation (fi loc)) $= Enabled
-- vertexAttribPointer (AttribLocation (fi loc))
-- $= (ToFloat, VertexArrayDescriptor (fi' siz) Float (fi'' $ floatSize * strd) (bufferOffset off))
-- vertexAttribArray (AttribLocation (fi loc)) $= Enabled
glVertexArrayVertexBuffer vao 0 vbo 0 (fromIntegral $ floatSize * strd)
glEnableVertexArrayAttrib vao loc'
glVertexArrayAttribFormat vao loc' siz' GL_FLOAT GL_FALSE (fromIntegral $ floatSize * off)
glVertexArrayAttribBinding vao loc' 0
where
loc' = fi loc
siz' = fi' siz
off' = fi'' off
fi = fromIntegral
fi' = fromIntegral
fi'' = fromIntegral