Continue migration to openglraw
This commit is contained in:
+5
-19
@@ -84,25 +84,11 @@ doDrawing win pdata u = do
|
|||||||
, (_windowShader pdata, nWins)
|
, (_windowShader pdata, nWins)
|
||||||
, (_textureArrayShader pdata, nFls)
|
, (_textureArrayShader pdata, nFls)
|
||||||
]
|
]
|
||||||
--bindBuffer ElementArrayBuffer $= pdata ^? shapeEBO . eboName --Just (_ebo $ _shapeEBO pdata)
|
|
||||||
--bufferSubData
|
|
||||||
-- ElementArrayBuffer
|
|
||||||
-- WriteToBuffer
|
|
||||||
-- 0
|
|
||||||
-- (fromIntegral $ glushortSize * nIndices)
|
|
||||||
-- (_eboPtr $ _shapeEBO pdata)
|
|
||||||
glNamedBufferSubData
|
glNamedBufferSubData
|
||||||
(_eboName $ _shapeEBO pdata)
|
(_eboName $ _shapeEBO pdata)
|
||||||
0
|
0
|
||||||
(fromIntegral $ glushortSize * nIndices)
|
(fromIntegral $ glushortSize * nIndices)
|
||||||
(_eboPtr $ _shapeEBO pdata)
|
(_eboPtr $ _shapeEBO pdata)
|
||||||
--bindBuffer ElementArrayBuffer $= pdata ^? silhouetteEBO . eboName --Just (_ebo $ _silhouetteEBO pdata)
|
|
||||||
--bufferSubData
|
|
||||||
-- ElementArrayBuffer
|
|
||||||
-- WriteToBuffer
|
|
||||||
-- 0
|
|
||||||
-- (fromIntegral $ glushortSize * nSilIndices)
|
|
||||||
-- (_eboPtr $ _silhouetteEBO pdata)
|
|
||||||
glNamedBufferSubData
|
glNamedBufferSubData
|
||||||
(_eboName $ _silhouetteEBO pdata)
|
(_eboName $ _silhouetteEBO pdata)
|
||||||
0
|
0
|
||||||
@@ -113,7 +99,7 @@ doDrawing win pdata u = do
|
|||||||
setViewportSize (round winx `div` resFact) (round winy `div` resFact)
|
setViewportSize (round winx `div` resFact) (round winy `div` resFact)
|
||||||
--bindFramebuffer Framebuffer $= fst (_fboBase pdata)
|
--bindFramebuffer Framebuffer $= fst (_fboBase pdata)
|
||||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboBase pdata)))
|
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboBase pdata)))
|
||||||
clearColor $= Color4 0 0 0 0
|
glClearColor 0 0 0 0
|
||||||
clear [ColorBuffer, DepthBuffer]
|
clear [ColorBuffer, DepthBuffer]
|
||||||
depthFunc $= Just Less
|
depthFunc $= Just Less
|
||||||
-- draw wall occlusions from the camera's point of view
|
-- draw wall occlusions from the camera's point of view
|
||||||
@@ -162,7 +148,7 @@ doDrawing win pdata u = do
|
|||||||
(snd $ snd $ pdata ^. fboBase)
|
(snd $ snd $ pdata ^. fboBase)
|
||||||
(drawCPUShadows pdata ws)
|
(drawCPUShadows pdata ws)
|
||||||
colorMask $= Color4 Enabled Enabled Enabled Enabled
|
colorMask $= Color4 Enabled Enabled Enabled Enabled
|
||||||
clearColor $= Color4 0 0 0 0
|
glClearColor 0 0 0 0
|
||||||
--apply lightmap to base buffer
|
--apply lightmap to base buffer
|
||||||
--bindFramebuffer Framebuffer $= pdata ^. fboBase . _1 --fst (_fboBase pdata)
|
--bindFramebuffer Framebuffer $= pdata ^. fboBase . _1 --fst (_fboBase pdata)
|
||||||
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboBase . _1 . unFBO)
|
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboBase . _1 . unFBO)
|
||||||
@@ -200,7 +186,7 @@ doDrawing win pdata u = do
|
|||||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
|
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
|
||||||
depthFunc $= Just Lequal
|
depthFunc $= Just Lequal
|
||||||
depthMask $= Disabled
|
depthMask $= Disabled
|
||||||
clearColor $= Color4 0.5 0.5 0.5 0
|
glClearColor 0.5 0.5 0.5 0
|
||||||
--blendFunc $= (SrcAlphaSaturate,One)
|
--blendFunc $= (SrcAlphaSaturate,One)
|
||||||
--blendColor $= Color4 0.5 0.5 0.5 0.5
|
--blendColor $= Color4 0.5 0.5 0.5 0.5
|
||||||
--blendFuncSeparate $= ((SrcAlphaSaturate,One) , (One,OneMinusSrcAlpha))
|
--blendFuncSeparate $= ((SrcAlphaSaturate,One) , (One,OneMinusSrcAlpha))
|
||||||
@@ -232,9 +218,9 @@ doDrawing win pdata u = do
|
|||||||
(snd $ snd $ _fboCloud pdata)
|
(snd $ snd $ _fboCloud pdata)
|
||||||
(drawCPUShadows pdata ws)
|
(drawCPUShadows pdata ws)
|
||||||
colorMask $= Color4 Enabled Enabled Enabled Enabled
|
colorMask $= Color4 Enabled Enabled Enabled Enabled
|
||||||
clearColor $= Color4 0 0 0 0
|
glClearColor 0 0 0 0
|
||||||
--apply lightmap to cloud buffer
|
--apply lightmap to cloud buffer
|
||||||
clearColor $= Color4 0 0 0 0
|
glClearColor 0 0 0 0
|
||||||
--bindFramebuffer Framebuffer $= fst (_fboCloud pdata)
|
--bindFramebuffer Framebuffer $= fst (_fboCloud pdata)
|
||||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
|
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
|
||||||
depthMask $= Disabled
|
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,
|
sizeFBOs,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Framebuffer.Check
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Preload.Render
|
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)
|
glTextureParameteri to1 GL_TEXTURE_MAG_FILTER (unsafeCoerce magfilt)
|
||||||
glNamedFramebufferTexture (_unFBO fbo) attachpoint to1 0
|
glNamedFramebufferTexture (_unFBO fbo) attachpoint to1 0
|
||||||
return to1
|
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