Add framebuffers with shared renderbufferobject

This commit is contained in:
2021-07-04 14:41:46 +02:00
parent e3bd99868f
commit c627961aac
3 changed files with 63 additions and 11 deletions
+32
View File
@@ -38,6 +38,9 @@ resizeSpareFBO xsize ysize xfull yfull pdata = do
resizeTextureFBO (_fbo2 rdata) xfull yfull
resizeTextureFBO (_fbo3 rdata) xfull yfull
resizeRBO (snd $ _fbos rdata) xfull yfull
mapM_ (\p -> resizeFBOTO p xfull yfull) (fst $ _fbos rdata)
return pdata
@@ -62,3 +65,32 @@ resizeTextureFBO (fboName,fboTO,fboRBO) xsize ysize = do
fboStatus <- framebufferStatus Framebuffer
putStrLn $ "after resize, framebuffer status:" ++ show fboStatus
resizeRBO
:: RenderbufferObject
-> Int
-> Int
-> IO ()
resizeRBO rboName xsize ysize = do
let xsize' = fromIntegral xsize
ysize' = fromIntegral ysize
bindRenderbuffer Renderbuffer $= rboName
renderbufferStorage Renderbuffer Depth24Stencil8 (RenderbufferSize xsize' ysize')
resizeFBOTO
:: (FramebufferObject , TextureObject)
-> Int
-> Int
-> IO ()
resizeFBOTO (fboName,fboTO) xsize ysize = do
let xsize' = fromIntegral xsize
ysize' = fromIntegral ysize
bindFramebuffer Framebuffer $= fboName
textureBinding Texture2D $= Just fboTO
texImage2D Texture2D NoProxy 0 RGBA8 (TextureSize2D xsize' ysize') 0 (PixelData RGBA UnsignedByte nullPtr)
textureFilter Texture2D $= ((Linear',Just Linear') , Nearest)
generateMipmap' Texture2D
framebufferTexture2D Framebuffer (ColorAttachment 0) Texture2D fboTO 0
fboStatus <- framebufferStatus Framebuffer
putStrLn $ "after resize, framebuffer status:" ++ show fboStatus