Remove renderbuffer from ping-pong framebuffers

This commit is contained in:
jgk
2021-07-11 17:56:43 +02:00
parent 26c6c3e426
commit 75254cd3e4
5 changed files with 17 additions and 87 deletions
+3 -30
View File
@@ -54,7 +54,6 @@ doDrawing pdata w = do
--viewFroms@(viewFromx,viewFromy) = _cameraViewFrom w
viewFroms = _cameraViewFrom w
pic = worldPictures w
-- bind wall points and colors to vbo
nWalls <- F.foldM (pokeShader $ _wallTextureShader pdata) (map Render22x4 wallPointsCol)
bindShaderBuffers [_wallTextureShader pdata] [nWalls]
@@ -143,7 +142,7 @@ doDrawing pdata w = do
depthFunc $= Just Always
blendFunc $= (One,Zero)
-- perform any radial distortion
case _radDistortion w of
[] -> do
bindTO $ snd $ _fboBase pdata
@@ -156,32 +155,13 @@ doDrawing pdata w = do
_ <- F.foldM (pokeShader $ _barrelShader pdata) [Render2221 distParam]
bindShaderBuffers [_barrelShader pdata] [1]
drawShader (_barrelShader pdata) 1
fboList = take (length rds - 1) (concat (repeat [fst3 $ _fbo2 pdata,fst3 $ _fbo3 pdata]))
fboList = take (length rds - 1) (concat (repeat [fst $ _fbo2 pdata,fst $ _fbo3 pdata]))
++ [defaultFramebufferObject]
toList = snd (_fboBase pdata) : concat (repeat [snd3 $ _fbo2 pdata,snd3 $ _fbo3 pdata])
toList = snd (_fboBase pdata) : concat (repeat [snd $ _fbo2 pdata,snd $ _fbo3 pdata])
bindings = zipWith (>>) (map bindFBO fboList) (map bindTO toList)
activeTexture $= TextureUnit 1
sequence_ $ zipWith (>>) bindings $ map bindDrawDist rds
activeTexture $= TextureUnit 0
--activeTexture $= TextureUnit 1
--bindTO $ snd $ _fboBase pdata
--let fbolist =
--let bindDrawDist :: (Point2,Point2,Point2,Float) -> IO ()
-- bindDrawDist distParam = do
-- _ <- F.foldM (pokeShader $ _barrelShader pdata) [Render2221 distParam]
-- bindShaderBuffers [_barrelShader pdata] [1]
-- drawShader (_barrelShader pdata) 1
--sequence_ $ zipWith (>>)
-- (map bindFBO $ concat $ repeat [fst3 $ _fbo2 pdata, fst3 $ _fbo3 pdata])
-- $ zipWith (>>)
-- (map bindDrawDist (_radDistortion w) ++ [activeTexture $= TextureUnit 0])
-- (map bindTO $ concat $ repeat [snd3 $ _fbo2 pdata, snd3 $ _fbo3 pdata])
--bindFramebuffer Framebuffer $= defaultFramebufferObject
----bufferUBO $ perspectiveMatrixb rot camzoom trans wins viewFroms
--drawShader (_fullscreenShader pdata) 4
-- draw overlay
bufferUBO $ isoMatrix 0 1 (0,0) (2,2)
--depthFunc $= Just Always
@@ -199,11 +179,6 @@ bindTO t = textureBinding Texture2D $= Just t
bindFBO :: FramebufferObject -> IO ()
bindFBO fb = bindFramebuffer Framebuffer $= fb
fst3 :: (a,b,c) -> a
fst3 (x,_,_) = x
snd3 :: (a,b,c) -> b
snd3 (_,x,_) = x
--------------------------------------------------------------------------------
-- note: currently assume there is only one UBO, we only bind it once at setup
bufferUBO :: [Float] -> IO ()
@@ -213,7 +188,6 @@ bufferUBO mat = withArray mat $ \ptr ->
renderBlankWalls
:: RenderData
-> Int -- ^ number of walls
-- -> GLmatrix GLfloat
-> IO ()
renderBlankWalls pdata nWalls = do
cullFace $= Just Back
@@ -223,7 +197,6 @@ renderBlankWalls pdata nWalls = do
renderWindows
:: RenderData
-> [((Point2,Point2),Point4)] -- ^ List: wall positions and color
-- -> GLmatrix GLfloat
-> IO ()
renderWindows pdata wps = do
n <- F.foldM (pokeShader $ _wallBlankShader pdata) (map Render22x4 wps)