Translate VAOs to DSA

This commit is contained in:
2023-03-09 10:10:57 +00:00
parent 18fa216dff
commit 7b797dfdb4
9 changed files with 61 additions and 32 deletions
+11 -6
View File
@@ -8,6 +8,7 @@ module Shader.Compile (
setupVertexAttribPointer,
) where
import GLHelp
import Control.Monad
import qualified Data.ByteString as BS
import qualified Data.ByteString.Unsafe as BU
@@ -129,23 +130,27 @@ shaderTypeExt' _ = undefined
-- I think that this requires that the correct shader program is bound?
setupVAO :: [Int] -> IO VAO
setupVAO sizes = do
theVAO <- genObjectName
bindVertexArrayObject $= Just theVAO
--theVAO <- genObjectName
--bindVertexArrayObject $= Just theVAO
vaoname <- mglCreateSingle glGenVertexArrays
glBindVertexArray vaoname
theVBO <- setupVBO sizes
return $
VAO
{ _vaoName = theVAO
{ _vaoName = vaoname
, _vaoVBO = theVBO
}
setupVAOSized :: [Int] -> Int -> IO VAO
setupVAOSized sizes ndraw = do
theVAO <- genObjectName
bindVertexArrayObject $= Just theVAO
vaoname <- mglCreateSingle glGenVertexArrays
glBindVertexArray vaoname
-- theVAO <- genObjectName
--bindVertexArrayObject $= Just theVAO
theVBO <- setupVBOSized sizes ndraw
return $
VAO
{ _vaoName = theVAO
{ _vaoName = vaoname
, _vaoVBO = theVBO
}