Refactor EBO to use DSA

This commit is contained in:
2023-03-09 12:49:34 +00:00
parent 2fc08a4d96
commit 01268e4c8a
4 changed files with 55 additions and 30 deletions
+19 -9
View File
@@ -19,7 +19,7 @@ import Dodge.Render.ShapePicture
import Dodge.Render.Walls
import Foreign
import Geometry
import Graphics.GL.Core43
import Graphics.GL.Core45
import Graphics.Rendering.OpenGL hiding (color, rotate, scale, translate)
import MatrixHelper
import Render
@@ -84,17 +84,27 @@ doDrawing win pdata u = do
, (_windowShader pdata, nWins)
, (_textureArrayShader pdata, nFls)
]
bindBuffer ElementArrayBuffer $= pdata ^? shapeEBO . ebo --Just (_ebo $ _shapeEBO pdata)
bufferSubData
ElementArrayBuffer
WriteToBuffer
--bindBuffer ElementArrayBuffer $= pdata ^? shapeEBO . eboName --Just (_ebo $ _shapeEBO pdata)
--bufferSubData
-- ElementArrayBuffer
-- WriteToBuffer
-- 0
-- (fromIntegral $ glushortSize * nIndices)
-- (_eboPtr $ _shapeEBO pdata)
glNamedBufferSubData
(_eboName $ _shapeEBO pdata)
0
(fromIntegral $ glushortSize * nIndices)
(_eboPtr $ _shapeEBO pdata)
bindBuffer ElementArrayBuffer $= pdata ^? silhouetteEBO . ebo --Just (_ebo $ _silhouetteEBO pdata)
bufferSubData
ElementArrayBuffer
WriteToBuffer
--bindBuffer ElementArrayBuffer $= pdata ^? silhouetteEBO . eboName --Just (_ebo $ _silhouetteEBO pdata)
--bufferSubData
-- ElementArrayBuffer
-- WriteToBuffer
-- 0
-- (fromIntegral $ glushortSize * nSilIndices)
-- (_eboPtr $ _silhouetteEBO pdata)
glNamedBufferSubData
(_eboName $ _silhouetteEBO pdata)
0
(fromIntegral $ glushortSize * nSilIndices)
(_eboPtr $ _silhouetteEBO pdata)
+1 -1
View File
@@ -33,7 +33,7 @@ drawCPUShadows pdata s pos rad = do
--currentProgram $= theshad ^? shadProg
glUseProgram (theshad ^. shadProg')
--bindVertexArrayObject $= Just (_vaoName $ _shadVAO' theshad)
glBindVertexArray $ (_vaoName $ _shadVAO' theshad)
glBindVertexArray . _vaoName $ _shadVAO' theshad
glDrawArrays
(marshalEPrimitiveMode $ _shadPrim' theshad)
0