Fix resize bug, resize RenderbufferObject of ping pong framebuffers

This commit is contained in:
2021-05-14 22:31:07 +02:00
parent c5657fe855
commit e658fdcd0b
8 changed files with 24 additions and 23 deletions
+6 -5
View File
@@ -21,6 +21,7 @@ import qualified Control.Foldl as F
import Foreign hiding (rotate)
import Graphics.Rendering.OpenGL hiding (Line,translate,scale,imageHeight,imageWidth,Polygon,Color,T)
import Data.Foldable
import Data.Tuple.Extra
import Data.Maybe (fromJust)
import qualified Data.IntMap.Strict as IM
import qualified SDL
@@ -145,7 +146,7 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat =
-- disable depth testing for blurring
depthFunc $= Just Always
-- draw the lightmap on a full size fbo
bindFramebuffer Framebuffer $= fst (_fbo2 pdata)
bindFramebuffer Framebuffer $= fst3 (_fbo2 pdata)
colorMask $= Color4 Disabled Disabled Disabled Enabled
bindShaderBuffers [_boxBlurShader pdata] [4]
textureBinding Texture2D $= Just (_fboTexture pdata)
@@ -169,14 +170,14 @@ Assumes no depth testing is done (depthFunc %= Just Always).
-}
pingPongBlur :: RenderData -> IO ()
pingPongBlur pdata = do
bindFramebuffer Framebuffer $= fst (_fbo3 pdata)
textureBinding Texture2D $= Just (snd $ _fbo2 pdata)
bindFramebuffer Framebuffer $= fst3 (_fbo3 pdata)
textureBinding Texture2D $= Just (snd3 $ _fbo2 pdata)
textureFilter Texture2D $= ((Linear',Just Linear') , Linear')
generateMipmap' Texture2D
drawShader (_boxBlurShader pdata) 4
bindFramebuffer Framebuffer $= fst (_fbo2 pdata)
textureBinding Texture2D $= Just (snd $ _fbo3 pdata)
bindFramebuffer Framebuffer $= fst3 (_fbo2 pdata)
textureBinding Texture2D $= Just (snd3 $ _fbo3 pdata)
textureFilter Texture2D $= ((Linear',Just Linear') , Linear')
generateMipmap' Texture2D
drawShader (_boxBlurShader pdata) 4