use OpenGL's internal datatypes

This commit is contained in:
nek0 2020-05-17 13:04:13 +02:00
parent 4715d3f8e0
commit 38a7c098dd

View file

@ -73,10 +73,10 @@ main = do
, 0.5 , (-0.5) -- 1 , 0.5 , (-0.5) -- 1
, 0.5 , 0.5 -- 2 , 0.5 , 0.5 -- 2
, (-0.5), 0.5 -- 3 , (-0.5), 0.5 -- 3
] :: [Float] ] :: [GL.GLfloat]
-- create draw order indices -- create draw order indices
indices = [0, 1, 2, 2, 3, 0] :: [Word] indices = [0, 1, 2, 2, 3, 0] :: [GL.GLuint]
-- create and bind buffer for vertices -- create and bind buffer for vertices
buf <- GL.genObjectName buf <- GL.genObjectName
@ -88,7 +88,7 @@ main = do
-- Feed the data to the buffer -- Feed the data to the buffer
GL.bufferData GL.ArrayBuffer $= GL.bufferData GL.ArrayBuffer $=
-- how much bytes of memory we are going to write (as an Int32) -- how much bytes of memory we are going to write (as an Int32)
( fromIntegral $ length vertexPositions * sizeOf (undefined :: Float) ( fromIntegral $ length vertexPositions * sizeOf (undefined :: GL.GLfloat)
-- The pointer to the data -- The pointer to the data
, ptr , ptr
-- The data's usage -- The data's usage
@ -120,7 +120,7 @@ main = do
-- Feed the data to the buffer -- Feed the data to the buffer
GL.bufferData GL.ElementArrayBuffer $= GL.bufferData GL.ElementArrayBuffer $=
-- how much bytes of memory we are going to write (as an Int32) -- how much bytes of memory we are going to write (as an Int32)
( fromIntegral $ length indices * sizeOf (undefined :: Word) ( fromIntegral $ length indices * sizeOf (undefined :: GL.GLuint)
-- The pointer to the data -- The pointer to the data
, ptr , ptr
-- The data's usage -- The data's usage