Move shader compilation over to raw opengl, errors display incorrect
This commit is contained in:
+11
-8
@@ -70,7 +70,7 @@ doDrawing win pdata u = do
|
||||
(w ^. cWorld . floorTiles)
|
||||
)
|
||||
( pokeShape
|
||||
(_vboPtr $ _vaoVBO $ _shadVAO $ _shapeShader pdata)
|
||||
(_vboPtr $ _vaoVBO $ _shadVAO' $ _shapeShader pdata)
|
||||
(_eboPtr $ _shapeEBO pdata)
|
||||
(_eboPtr $ _silhouetteEBO pdata)
|
||||
(0, 0, 0)
|
||||
@@ -107,12 +107,14 @@ doDrawing win pdata u = do
|
||||
clear [ColorBuffer, DepthBuffer]
|
||||
depthFunc $= Just Less
|
||||
-- draw wall occlusions from the camera's point of view
|
||||
currentProgram $= lwShad ^? shadProg -- Just (_shadProg lwShad)
|
||||
uniform (_shadUnis lwShad V.! 0) $= viewFrom3d
|
||||
bindVertexArrayObject $= lwShad ^? shadVAO . vao -- Just (_vao $ _shadVAO lwShad)
|
||||
-- currentProgram $= lwShad ^? shadProg -- Just (_shadProg lwShad)
|
||||
-- uniform (_shadUnis lwShad V.! 0) $= viewFrom3d
|
||||
glUseProgram (lwShad ^. shadProg')
|
||||
glUniform3f (_shadUnis' lwShad V.! 0) vfx vfy 20
|
||||
bindVertexArrayObject $= lwShad ^? shadVAO' . vao -- Just (_vao $ _shadVAO lwShad)
|
||||
unless (debugOn Remove_LOS cfig) $
|
||||
glDrawArrays
|
||||
(marshalEPrimitiveMode $ _shadPrim lwShad)
|
||||
(marshalEPrimitiveMode $ _shadPrim' lwShad)
|
||||
0
|
||||
(fromIntegral nWalls)
|
||||
--draw walls onto base buffer
|
||||
@@ -123,10 +125,11 @@ doDrawing win pdata u = do
|
||||
renderLayer BottomLayer shadV layerCounts
|
||||
--draw object shapes onto base buffer
|
||||
let fs = _shapeShader pdata
|
||||
currentProgram $= Just (_shadProg fs)
|
||||
bindVertexArrayObject $= fs ^? shadVAO . vao -- Just (_vao $ _shadVAO fs)
|
||||
--currentProgram $= Just (_shadProg fs)
|
||||
glUseProgram (_shadProg' fs)
|
||||
bindVertexArrayObject $= fs ^? shadVAO' . vao -- Just (_vao $ _shadVAO fs)
|
||||
glDrawElements
|
||||
(marshalEPrimitiveMode $ _shadPrim fs)
|
||||
(marshalEPrimitiveMode $ _shadPrim' fs)
|
||||
(fromIntegral nIndices)
|
||||
GL_UNSIGNED_SHORT
|
||||
nullPtr
|
||||
|
||||
@@ -21,19 +21,20 @@ import qualified Data.Vector.Fusion.Stream.Monadic as VFSM
|
||||
drawCPUShadows :: RenderData -> Shape -> Point3 -> Float -> IO ()
|
||||
drawCPUShadows pdata s pos rad = do
|
||||
let theshad = pdata ^. positionalBlankShader
|
||||
theptr = _vboPtr $ _vaoVBO $ _shadVAO theshad
|
||||
theptr = _vboPtr $ _vaoVBO $ _shadVAO' theshad
|
||||
i <- VFSM.foldlM' (pokeShapeShad pos rad theptr) 0 $ VFSM.fromList s
|
||||
bindBuffer ArrayBuffer $= (theshad ^? shadVAO . vaoVBO . vbo)
|
||||
bindBuffer ArrayBuffer $= (theshad ^? shadVAO' . vaoVBO . vbo)
|
||||
bufferSubData
|
||||
ArrayBuffer
|
||||
WriteToBuffer
|
||||
0
|
||||
(fromIntegral $ floatSize * i)
|
||||
(theshad ^. shadVAO . vaoVBO . vboPtr)
|
||||
currentProgram $= theshad ^? shadProg
|
||||
bindVertexArrayObject $= Just (_vao $ _shadVAO theshad)
|
||||
(theshad ^. shadVAO' . vaoVBO . vboPtr)
|
||||
--currentProgram $= theshad ^? shadProg
|
||||
glUseProgram (theshad ^. shadProg')
|
||||
bindVertexArrayObject $= Just (_vao $ _shadVAO' theshad)
|
||||
glDrawArrays
|
||||
(marshalEPrimitiveMode $ _shadPrim theshad)
|
||||
(marshalEPrimitiveMode $ _shadPrim' theshad)
|
||||
0
|
||||
(fromIntegral i)
|
||||
return ()
|
||||
|
||||
Reference in New Issue
Block a user