To openglraw

This commit is contained in:
2023-03-09 22:07:39 +00:00
parent 52d0286433
commit aa2746e800
2 changed files with 7 additions and 10 deletions
-1
View File
@@ -15,7 +15,6 @@ import Data.List.Extra
import Codec.Picture
import qualified Data.Vector.Storable as VS
import Control.Lens
--import Graphics.Rendering.OpenGL hiding (Point,translate,scale,imageHeight)
import Graphics.GL.Core45
import GLHelp
+7 -9
View File
@@ -7,7 +7,6 @@ module Shader.Bind
import Shader.Data
import Shader.Parameters
import Graphics.Rendering.OpenGL hiding (Line,translate,scale,imageHeight,Polygon,Color,T)
import Foreign hiding (rotate)
import qualified Data.Vector.Unboxed.Mutable as UMV
import qualified Data.Vector.Mutable as MV
@@ -18,11 +17,8 @@ import Graphics.GL.Core45
bindArrayBuffers :: Int -> VBO -> IO ()
{-# INLINABLE bindArrayBuffers #-}
bindArrayBuffers numVs theVBO = do
glBindBuffer GL_ARRAY_BUFFER (_vboName theVBO)
bufferSubData
ArrayBuffer
WriteToBuffer
bindArrayBuffers numVs theVBO = glNamedBufferSubData
(_vboName theVBO)
0
(fromIntegral $ floatSize * numVs * sum (_vboAttribSizes theVBO))
(_vboPtr theVBO)
@@ -40,13 +36,15 @@ bindShaderLayers shads counts = MV.imapM_ f shads
where
g stride theVBO lay = do
numVs <- UMV.unsafeRead counts $ lay * 6 + i
bufferSubData
ArrayBuffer
WriteToBuffer
glNamedBufferSubDataH
(_vboName theVBO)
(fromIntegral $ floatSize * stride * numSubElements * lay)
(fromIntegral $ floatSize * numVs * stride)
(_vboPtr theVBO `plusPtr` (floatSize * stride * numSubElements * lay))
glNamedBufferSubDataH :: GLuint -> GLintptr -> GLsizeiptr -> Ptr a -> IO ()
glNamedBufferSubDataH = glNamedBufferSubData
bindShader :: MV.MVector (PrimState IO) FullShader -> UMV.MVector (PrimState IO) Int -> IO ()
bindShader shads counts = MV.imapM_ f shads
where