To openglraw

This commit is contained in:
2023-03-09 21:24:03 +00:00
parent cc049db29f
commit 653de7226e
3 changed files with 47 additions and 59 deletions
+4 -13
View File
@@ -6,11 +6,11 @@ module Framebuffer.Setup (
setupShadowFramebuffer,
) where
import Framebuffer.Check
import Unsafe.Coerce
import Data.Preload.Render
import GLHelp
import Graphics.GL.Core45
import Graphics.Rendering.OpenGL hiding (Point, imageHeight, scale, translate)
setupTextureFramebuffer ::
GLsizei ->
@@ -31,10 +31,7 @@ setupTextureFramebuffer x y = do
--textureFilter Texture2D $= minMagFilter
--framebufferTexture2D Framebuffer (ColorAttachment 0) Texture2D fboTO 0
glNamedFramebufferTexture fboName GL_COLOR_ATTACHMENT0 to 0
fboStatus <- framebufferStatus Framebuffer
case fboStatus of
Complete -> return ()
_ -> putStrLn $ "Texture framebuffer status: " ++ show fboStatus
checkFBO $ FBO fboName
return (FBO fboName, TO to)
setupShadowFramebuffer :: IO (FBO, (TO, TO))
@@ -60,10 +57,7 @@ setupFramebufferGivenStencil rboName = do
to1 <- mglCreate (glCreateTextures GL_TEXTURE_2D)
--framebufferRenderbuffer Framebuffer DepthStencilAttachment Renderbuffer rboName
glNamedFramebufferRenderbuffer fboName GL_DEPTH_STENCIL_ATTACHMENT GL_RENDERBUFFER rboName
fboStatus <- framebufferStatus Framebuffer
case fboStatus of
Complete -> return ()
_ -> putStrLn $ "Framebuffer with given stencil status: " ++ show fboStatus
checkFBO $ FBO fboName
return (FBO fboName, TO to1)
setupFramebuffer2GivenStencil ::
@@ -79,8 +73,5 @@ setupFramebuffer2GivenStencil rboName = do
to2 <- mglCreate (glCreateTextures GL_TEXTURE_2D)
--framebufferRenderbuffer Framebuffer DepthStencilAttachment Renderbuffer rboName
glNamedFramebufferRenderbuffer fboName GL_DEPTH_STENCIL_ATTACHMENT GL_RENDERBUFFER rboName
fboStatus <- framebufferStatus Framebuffer
case fboStatus of
Complete -> return ()
_ -> putStrLn $ "Framebuffer with given stencil and two texture objects status: " ++ show fboStatus
checkFBO $ FBO fboName
return (FBO fboName, (TO to1, TO to2))