Fix resize crash
This commit is contained in:
+20
-8
@@ -103,10 +103,26 @@ doDrawing' win pdata u = do
|
||||
, (_shapeEBO pdata, nIndices)
|
||||
, (_silhouetteEBO pdata, nSilIndices)
|
||||
]
|
||||
-- draw the overlay
|
||||
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboOverlay ._1 . unFBO)
|
||||
withArray [0, 0, 0, 0] $ \ptr ->
|
||||
glClearNamedFramebufferfv
|
||||
(pdata ^. fboOverlay . _1 . unFBO)
|
||||
GL_COLOR
|
||||
0
|
||||
ptr
|
||||
glDepthFunc GL_ALWAYS
|
||||
glDepthMask GL_FALSE
|
||||
glEnable GL_BLEND
|
||||
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||
setViewport _graphics_overlay_resolution cfig
|
||||
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. orthonormalMatUBO)
|
||||
renderLayer FixedCoordLayer shadV layerCounts
|
||||
-- set the coordinate uniform ready for drawing elements using world coordinates
|
||||
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. matUBO)
|
||||
withArray (perspectiveMatrixb rot camzoom trans wins viewFroms) $ \ptr ->
|
||||
glNamedBufferSubData (pdata ^. matUBO) 0 64 ptr
|
||||
renderLayer DebugLayer shadV layerCounts
|
||||
setViewport _graphics_world_resolution cfig
|
||||
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboBase ._1 . unFBO)
|
||||
glDepthMask GL_TRUE
|
||||
@@ -335,7 +351,7 @@ doDrawing' win pdata u = do
|
||||
drawShader (_fullscreenShader pdata) 4
|
||||
--set viewport for radial distortion
|
||||
--setViewportSize (round winx) (round winy)
|
||||
setViewport _graphics_overlay_resolution cfig
|
||||
setViewport (const FullRes) cfig
|
||||
glDepthFunc GL_ALWAYS
|
||||
glBlendFunc GL_ONE GL_ZERO
|
||||
-- perform any radial distortion
|
||||
@@ -357,14 +373,10 @@ doDrawing' win pdata u = do
|
||||
toList = (pdata ^. fboBase . _2 . _1) : concat (repeat [snd $ _fbo2 pdata, snd $ _fbo3 pdata])
|
||||
bindings = zipWith (>>) (map bindFBO fboList) (map (glBindTextureUnit 1 . _unTO) toList)
|
||||
zipWithM_ (>>) bindings $ map bindDrawDist rds
|
||||
glDepthFunc GL_ALWAYS
|
||||
glDepthMask GL_FALSE
|
||||
glEnable GL_BLEND
|
||||
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||
renderLayer DebugLayer shadV layerCounts
|
||||
-- draw overlay
|
||||
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. orthonormalMatUBO)
|
||||
renderLayer FixedCoordLayer shadV layerCounts
|
||||
--draw overlay onto base buffer
|
||||
glBindTextureUnit 0 (pdata ^. fboOverlay . _2 . unTO)
|
||||
drawShader (_fullscreenShader pdata) 4
|
||||
SDL.glSwapWindow win
|
||||
|
||||
getDistortions :: Configuration -> World -> [Distortion]
|
||||
|
||||
Reference in New Issue
Block a user