Continue migration to openglraw
This commit is contained in:
+5
-19
@@ -84,25 +84,11 @@ doDrawing win pdata u = do
|
||||
, (_windowShader pdata, nWins)
|
||||
, (_textureArrayShader pdata, nFls)
|
||||
]
|
||||
--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 . eboName --Just (_ebo $ _silhouetteEBO pdata)
|
||||
--bufferSubData
|
||||
-- ElementArrayBuffer
|
||||
-- WriteToBuffer
|
||||
-- 0
|
||||
-- (fromIntegral $ glushortSize * nSilIndices)
|
||||
-- (_eboPtr $ _silhouetteEBO pdata)
|
||||
glNamedBufferSubData
|
||||
(_eboName $ _silhouetteEBO pdata)
|
||||
0
|
||||
@@ -113,7 +99,7 @@ doDrawing win pdata u = do
|
||||
setViewportSize (round winx `div` resFact) (round winy `div` resFact)
|
||||
--bindFramebuffer Framebuffer $= fst (_fboBase pdata)
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboBase pdata)))
|
||||
clearColor $= Color4 0 0 0 0
|
||||
glClearColor 0 0 0 0
|
||||
clear [ColorBuffer, DepthBuffer]
|
||||
depthFunc $= Just Less
|
||||
-- draw wall occlusions from the camera's point of view
|
||||
@@ -162,7 +148,7 @@ doDrawing win pdata u = do
|
||||
(snd $ snd $ pdata ^. fboBase)
|
||||
(drawCPUShadows pdata ws)
|
||||
colorMask $= Color4 Enabled Enabled Enabled Enabled
|
||||
clearColor $= Color4 0 0 0 0
|
||||
glClearColor 0 0 0 0
|
||||
--apply lightmap to base buffer
|
||||
--bindFramebuffer Framebuffer $= pdata ^. fboBase . _1 --fst (_fboBase pdata)
|
||||
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboBase . _1 . unFBO)
|
||||
@@ -200,7 +186,7 @@ doDrawing win pdata u = do
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
|
||||
depthFunc $= Just Lequal
|
||||
depthMask $= Disabled
|
||||
clearColor $= Color4 0.5 0.5 0.5 0
|
||||
glClearColor 0.5 0.5 0.5 0
|
||||
--blendFunc $= (SrcAlphaSaturate,One)
|
||||
--blendColor $= Color4 0.5 0.5 0.5 0.5
|
||||
--blendFuncSeparate $= ((SrcAlphaSaturate,One) , (One,OneMinusSrcAlpha))
|
||||
@@ -232,9 +218,9 @@ doDrawing win pdata u = do
|
||||
(snd $ snd $ _fboCloud pdata)
|
||||
(drawCPUShadows pdata ws)
|
||||
colorMask $= Color4 Enabled Enabled Enabled Enabled
|
||||
clearColor $= Color4 0 0 0 0
|
||||
glClearColor 0 0 0 0
|
||||
--apply lightmap to cloud buffer
|
||||
clearColor $= Color4 0 0 0 0
|
||||
glClearColor 0 0 0 0
|
||||
--bindFramebuffer Framebuffer $= fst (_fboCloud pdata)
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
|
||||
depthMask $= Disabled
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
module Framebuffer.Check where
|
||||
|
||||
import Data.Preload.Render
|
||||
import Graphics.GL.Core45
|
||||
|
||||
checkFBO :: FBO -> IO ()
|
||||
checkFBO fbo = do
|
||||
fboStatus <- glCheckNamedFramebufferStatus (_unFBO fbo) GL_FRAMEBUFFER
|
||||
case fboStatus of
|
||||
36053 -> return () -- this should correspond to GL_COMPLETE or something
|
||||
_ -> error $ "FBO id "++ show (_unFBO fbo) ++ ":" ++ show fboStatus
|
||||
@@ -7,6 +7,7 @@ module Framebuffer.Update (
|
||||
sizeFBOs,
|
||||
) where
|
||||
|
||||
import Framebuffer.Check
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
import Data.Preload.Render
|
||||
@@ -179,10 +180,3 @@ initializeTexture2DArray fbo attachpoint x y z minfilt magfilt informat = do
|
||||
glTextureParameteri to1 GL_TEXTURE_MAG_FILTER (unsafeCoerce magfilt)
|
||||
glNamedFramebufferTexture (_unFBO fbo) attachpoint to1 0
|
||||
return to1
|
||||
|
||||
checkFBO :: FBO -> IO ()
|
||||
checkFBO fbo = do
|
||||
fboStatus <- glCheckNamedFramebufferStatus (_unFBO fbo) GL_FRAMEBUFFER
|
||||
case fboStatus of
|
||||
36053 -> return () -- this should correspond to GL_COMPLETE or something
|
||||
_ -> error $ "after resize, resizeFBOTO framebuffer status:" ++ show fboStatus
|
||||
|
||||
Reference in New Issue
Block a user