Start migration to openGLraw, add target parameter to texture params

This commit is contained in:
2023-03-03 11:20:31 +00:00
parent 8456f9e02e
commit f2e406b05c
7 changed files with 74 additions and 12 deletions
+33 -3
View File
@@ -30,8 +30,11 @@ sizeFBOs xsize ysize xfull yfull rdata = do
[fboBloom, fboPos]
rdata''' <- foldM (updateFBOTO xfull yfull minMagFilter GL_RGBA8) rdata''
[fbo2, fbo3]
foldM (updateFBOTO (xsize `div` 2) (ysize `div` 2) linMinMagFilter GL_RGBA16F) rdata'''
rdata4 <- foldM (updateFBOTO (xsize `div` 2) (ysize `div` 2) linMinMagFilter GL_RGBA16F) rdata'''
[fboHalf1,fboHalf2,fboHalf3]
newShadowFBO <- resizeShadowFBO (rdata ^. fboShadow) xsize ysize
return $ rdata4 & fboShadow .~ newShadowFBO
-- return rdata4
resizeRBO
:: RenderbufferObject
@@ -68,6 +71,33 @@ updateFBOTO2 xsize ysize mmfilt inFormat1 inFormat2 pdata target = do
newfbo2 <- resizeFBOTO2 (pdata ^# target) xsize ysize mmfilt inFormat1 inFormat2
return $ storing target newfbo2 pdata
resizeShadowFBO :: (FramebufferObject, (TextureObject,TextureObject))
-> Int -> Int -> IO (FramebufferObject, (TextureObject,TextureObject))
resizeShadowFBO (fboname,(oldto1,oldto2)) xsize ysize = do
let xsize' = fromIntegral xsize
ysize' = fromIntegral ysize
bindFramebuffer Framebuffer $= fboname
deleteObjectName oldto1
deleteObjectName oldto2
to1 <- genObjectName
to2 <- genObjectName
-- textureBinding Texture2DArray $= Just to1
-- glTexStorage3D GL_TEXTURE_2D_ARRAY 1 GL_RGBA8 xsize' ysize' 10
-- textureFilter Texture2DArray $= minMagFilter
-- glFramebufferTexture GL_FRAMEBUFFER GL_COLOR_ATTACHMENT0 (unTexture to1) 0
-- textureBinding Texture2DArray $= Just to2
-- glTexStorage3D GL_TEXTURE_2D_ARRAY 1 GL_DEPTH24_STENCIL8 xsize' ysize' 10
-- textureFilter Texture2DArray $= minMagFilter
-- glFramebufferTexture GL_FRAMEBUFFER GL_DEPTH_STENCIL_ATTACHMENT (unTexture to2) 0
-- fboStatus <- framebufferStatus Framebuffer
-- case fboStatus of
-- Complete -> return ()
-- _ -> error $ "after resize, resizeFBOTO2 framebuffer status:" ++ show fboStatus
return (fboname,(to1,to2))
unTexture :: TextureObject -> GLuint
unTexture (TextureObject t) = t
resizeFBOTO2
:: (FramebufferObject , (TextureObject,TextureObject))
-> Int
@@ -96,7 +126,7 @@ resizeFBOTO2 (fboName,(toOld1,toOld2)) xsize ysize mmfilt inFormat1 inFormat2 =
fboStatus <- framebufferStatus Framebuffer
case fboStatus of
Complete -> return ()
_ -> putStrLn $ "after resize, resizeFBOTO2 framebuffer status:" ++ show fboStatus
_ -> error $ "after resize, resizeFBOTO2 framebuffer status:" ++ show fboStatus
return (fboName, (toName1,toName2))
resizeFBOTO
@@ -119,7 +149,7 @@ resizeFBOTO (fboName,toOld) xsize ysize mmfilt inFormat = do
fboStatus <- framebufferStatus Framebuffer
case fboStatus of
Complete -> return ()
_ -> putStrLn $ "after resize, resizeFBOTO framebuffer status:" ++ show fboStatus
_ -> error $ "after resize, resizeFBOTO framebuffer status:" ++ show fboStatus
return (fboName, toName)
minMagFilter :: ((TextureFilter, Maybe TextureFilter),TextureFilter)