Implement different shadow resolutions

This commit is contained in:
jgk
2021-04-28 23:16:42 +02:00
parent 8cb177a21c
commit 750a67ea6e
8 changed files with 63 additions and 42 deletions
+7 -3
View File
@@ -7,15 +7,19 @@ import Graphics.Rendering.OpenGL
import Foreign
import Picture.Preload
resizeSpareFBO :: Int -> Int -> PreloadData a -> IO (PreloadData a)
resizeSpareFBO
:: Int -- ^ Width
-> Int -- ^ Height
-> PreloadData a
-> IO (PreloadData a)
resizeSpareFBO xsize ysize pdata = do
-- I am unsure how much of this needs to be bound...
let rdata = _renderData pdata
fboName = _spareFBO rdata
fboTO = _fboTexture rdata
fboRBO = _fboRenderbufferObject rdata
xsize' = fromIntegral $ xsize `div` 2
ysize' = fromIntegral $ ysize `div` 2
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)