Continue shader refactor

This commit is contained in:
2023-04-13 00:10:43 +01:00
parent 36734c7af5
commit 500b2bb2be
2 changed files with 8 additions and 16 deletions
+5 -13
View File
@@ -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
+3 -3
View File
@@ -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