Commit AFTER playing around with poking/vector sizing a little
This commit is contained in:
@@ -92,11 +92,12 @@ makeShaderUsingVBO s shaderlist sizes pm vbo = do
|
||||
setupVBO :: Int -> IO VBO
|
||||
setupVBO vertexsize = do
|
||||
vboname <- mglCreate glCreateBuffers
|
||||
thePtr <- mallocBytes (vertexsize * numDrawableElements)
|
||||
thePtr <- mallocBytes (vertexsize * numDrawableVertices)
|
||||
-- Allocate space
|
||||
glNamedBufferData
|
||||
vboname
|
||||
(fromIntegral $ numDrawableElements * vertexsize)
|
||||
(fromIntegral $ floatSize * numDrawableVertices * vertexsize)
|
||||
-- (fromIntegral $ numDrawableVertices * vertexsize)
|
||||
nullPtr
|
||||
GL_STREAM_DRAW
|
||||
return VBO{_vboName = vboname, _vboPtr = thePtr, _vboVertexBytes = vertexsize}
|
||||
@@ -125,11 +126,11 @@ setupStaticVBOVAO vas vdata = withArrayLen vdata $ \i ptr -> do
|
||||
setupVBOStatic :: Int -> IO VBO
|
||||
setupVBOStatic vertexsize = do
|
||||
vboname <- mglCreate glCreateBuffers
|
||||
thePtr <- mallocArray (vertexsize * numDrawableElements)
|
||||
thePtr <- mallocArray (vertexsize * numDrawableVertices)
|
||||
-- Allocate space
|
||||
glNamedBufferData
|
||||
vboname
|
||||
(fromIntegral $ floatSize * numDrawableElements * vertexsize)
|
||||
(fromIntegral $ floatSize * numDrawableVertices * vertexsize)
|
||||
nullPtr
|
||||
GL_STATIC_DRAW
|
||||
return VBO{_vboName = vboname, _vboPtr = thePtr, _vboVertexBytes = floatSize * vertexsize}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
module Shader.Parameters
|
||||
( floatSize
|
||||
, ubyteSize
|
||||
, numDrawableElements
|
||||
, numDrawableVertices
|
||||
, numSubElements
|
||||
, glushortSize
|
||||
, numGLushort
|
||||
) where
|
||||
import Picture.Data
|
||||
import Graphics.GL.Core45
|
||||
import Foreign
|
||||
|
||||
@@ -29,9 +30,9 @@ numGLushort :: Int
|
||||
numGLushort = fromIntegral (maxBound :: GLushort) + 1
|
||||
{-# INLINE numGLushort #-}
|
||||
|
||||
numDrawableElements :: Int
|
||||
{-# INLINE numDrawableElements #-}
|
||||
numDrawableElements = 6 * numSubElements
|
||||
numDrawableVertices :: Int
|
||||
{-# INLINE numDrawableVertices #-}
|
||||
numDrawableVertices = 6 * numSubElements
|
||||
|
||||
numSubElements :: Int
|
||||
{-# INLINE numSubElements #-}
|
||||
|
||||
Reference in New Issue
Block a user