diff --git a/src/Preload/Render.hs b/src/Preload/Render.hs index 82bcdc22f..6ab953792 100644 --- a/src/Preload/Render.hs +++ b/src/Preload/Render.hs @@ -5,6 +5,7 @@ module Preload.Render ( cleanUpRenderPreload, ) where +import Shader.Parameters import Control.Concurrent import Control.Lens import Control.Monad @@ -18,7 +19,6 @@ import Shader import Shader.AuxAddition import Shader.Compile import Shader.Data -import Shader.Parameters import Shape.Data {- BINDING LIST: @@ -68,7 +68,7 @@ preloadRender = do -- setup shape geometry/cap VBO and two VAOs putStrLn "Setup shape VBO, VAO, EBO" - shVBO <- setupVBO nShapeVerxComp + shVBO <- setupVBO (nShapeVerxComp) shPosVAO <- setupVAOUsingVBO [VertexAttribute 4 GL_FLOAT GL_FALSE 0] shVBO shEBO <- setupEBO shPosVAO -- note the shape shader vao is distinct from the position vao, but they @@ -83,8 +83,8 @@ preloadRender = do putStrLn "Setup wall/windows VBO, VAO, EBO, shader" let wallverxstrd = 8 - wallvbo <- setupVBO wallverxstrd - winvbo <- setupVBO 8 + wallvbo <- setupVBO (wallverxstrd) + winvbo <- setupVBO (8) windowshader <- makeShaderUsingVBO "wall/blank" [vert, geom, frag] (toFloatVAs [4, 4]) pmPoints winvbo wallshader <- makeShaderUsingVBO "wall/basic" [vert, geom, frag] (toFloatVAs [4, 4]) pmPoints wallvbo putStrLn "Setup lighting shaders" @@ -124,15 +124,7 @@ preloadRender = do --initTexture2DArray 50 "data/texture/charMapVertBig.png" 2 32 64 95 GL_LINEAR_MIPMAP_NEAREST GL_LINEAR putStrLn "Setup full screen shaders" --- screentexturevbo <- mglCreate glCreateBuffers --- withArray (concat cornerList) $ \ptr -> --- glNamedBufferStorage --- screentexturevbo --- (fromIntegral $ floatSize * length (concat cornerList)) --- ptr --- 0 --- screentexturevao <- setupVAOvbo (toFloatVAs [2, 2]) 4 screentexturevbo - (_,screentexturevao) <- setupStaticVBO (toFloatVAs [2,2]) (concat cornerList) + (_,screentexturevao) <- setupStaticVBOVAO (toFloatVAs [2,2]) (concat cornerList) alphadivideshader <- makeShaderUsingVAO "texture2D/alphaDivide" [vert, frag] pmTriangleStrip screentexturevao fsShad <- makeShaderUsingVAO "texture/simple" [vert, frag] pmTriangleStrip screentexturevao bloomBlurShad <- makeShaderUsingVAO "texture/bloomBlur" [vert, frag] pmTriangleStrip screentexturevao diff --git a/src/Shader/Compile.hs b/src/Shader/Compile.hs index 237921d72..09b93a4b7 100644 --- a/src/Shader/Compile.hs +++ b/src/Shader/Compile.hs @@ -13,7 +13,7 @@ module Shader.Compile ( setupVertexAttribPointer, makeSourcedShader, toFloatVAs, - setupStaticVBO + setupStaticVBOVAO ) where import Foreign.C.Types @@ -104,8 +104,8 @@ setupVBO vertexsize = do -- the input ptr is assumed to contain the correct amount of data according to -- the specified number and type of vertices -- note the VBO here does not have a sensible ptr value -setupStaticVBO :: Storable a => [VertexAttribute] -> [a] -> IO (VBO,VAO) -setupStaticVBO vas vdata = withArrayLen vdata $ \i ptr -> do +setupStaticVBOVAO :: Storable a => [VertexAttribute] -> [a] -> IO (VBO,VAO) +setupStaticVBOVAO vas vdata = withArrayLen vdata $ \i ptr -> do vboname <- mglCreate glCreateBuffers glNamedBufferStorage vboname