Bind some fixed texture arrays only once

This commit is contained in:
2023-03-23 14:46:51 +00:00
parent ecd7a0fae0
commit 05d1d3d1eb
7 changed files with 15 additions and 16 deletions
+2 -2
View File
@@ -54,8 +54,8 @@ data RenderData = RenderData
, _vboShapes :: VBO
, _floorVBO :: VBO
, _floorShader :: Shader
, _toNormalMaps :: TO
, _toDiffuse :: TO
, _texaNormalMaps :: TO
, _texaDiffuse :: TO
, _wallVBO :: VBO
, _wallShader :: Shader
, _cloudVBO :: VBO
+1 -4
View File
@@ -179,9 +179,6 @@ doDrawing' win pdata u = do
--draw floor onto base buffer
glUseProgram (pdata ^. floorShader . shaderUINT)
glBindVertexArray $ pdata ^. floorShader . shaderVAO . vaoName
glBindTextureUnit 1 (pdata ^. toNormalMaps . unTO)
--glTextureParameteri (pdata ^. toNormalMaps . unTO) GL_TEXTURE_BASE_LEVEL 3
glBindTextureUnit 2 (pdata ^. toDiffuse . unTO)
glDrawArrays
(_unPrimitiveMode $ pdata ^. floorShader . shaderPrimitive )
0
@@ -227,7 +224,7 @@ doDrawing' win pdata u = do
setViewportSize (round winx `div` (2 * resFact)) (round winy `div` (2 * resFact))
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboHalf1 pdata)))
glDepthFunc GL_ALWAYS
glBindTexture GL_TEXTURE_2D (pdata ^. fboBloom . _2 . unTO)
glBindTextureUnit 0 (pdata ^. fboBloom . _2 . unTO)
glDisable GL_BLEND
drawShader (_bloomBlurShader pdata) 4
replicateM_ 9 $ pingPongBetween (_fboHalf1 pdata) (_fboHalf2 pdata) (_bloomBlurShader pdata)
+5 -3
View File
@@ -161,8 +161,10 @@ preloadRender = do
let floorverxstrd = 8
floorvbo <- setupVBOStatic floorverxstrd
floorshader <- makeShader4 "floor/arrayPos" [vert, frag] [4,4] floorverxstrd pmTriangles floorvbo
tonormalmap <- initTexture2DArray 3 GL_LINEAR_MIPMAP_LINEAR GL_LINEAR "data/normalMaps/normalArray.png"
todiffusemap <- initTexture2DArray 3 GL_LINEAR_MIPMAP_LINEAR GL_LINEAR "data/normalMaps/diffuseArray.png"
tonormalmap <- initTexture2DArray 3 GL_LINEAR_MIPMAP_LINEAR GL_LINEAR "data/normalMaps/normalArray.png"
glBindTextureUnit 40 (todiffusemap ^. unTO)
glBindTextureUnit 41 (tonormalmap ^. unTO)
let cloudverxsizes = [4,4,4,4]
cloudvbo <- setupVBO (sum cloudverxsizes)
@@ -250,8 +252,8 @@ preloadRender = do
, _vboShapes = shVBO
, _floorVBO = floorvbo
, _floorShader = floorshader
, _toNormalMaps = tonormalmap
, _toDiffuse = todiffusemap
, _texaNormalMaps = tonormalmap
, _texaDiffuse = todiffusemap
, _wallVBO = wallvbo
, _wallShader = wallshader
, _cloudVBO = cloudvbo