Draw shadows in a framebuffer object
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@ setupLoop wName xSize ySize
|
|||||||
(\_ -> bracket customInit initCleanup $ \setup -> do -- setup <- customInit
|
(\_ -> bracket customInit initCleanup $ \setup -> do -- setup <- customInit
|
||||||
-- swapInterval $= ImmediateUpdates
|
-- swapInterval $= ImmediateUpdates
|
||||||
GL.blend $= GL.Enabled
|
GL.blend $= GL.Enabled
|
||||||
GL.depthMask $= GL.Enabled
|
-- GL.depthMask $= GL.Enabled
|
||||||
GL.blendEquation $= GL.FuncAdd
|
GL.blendEquation $= GL.FuncAdd
|
||||||
GL.blendFunc $= (GL.SrcAlpha,GL.OneMinusSrcAlpha)
|
GL.blendFunc $= (GL.SrcAlpha,GL.OneMinusSrcAlpha)
|
||||||
GL.clearColor $= GL.Color4 0 0.5 0 1
|
GL.clearColor $= GL.Color4 0 0.5 0 1
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ setupFramebuffer = do
|
|||||||
bindRenderbuffer Renderbuffer $= fboRBO
|
bindRenderbuffer Renderbuffer $= fboRBO
|
||||||
renderbufferStorage Renderbuffer Depth24Stencil8 (RenderbufferSize 800 600)
|
renderbufferStorage Renderbuffer Depth24Stencil8 (RenderbufferSize 800 600)
|
||||||
-- not sure if the stencil is needed
|
-- not sure if the stencil is needed
|
||||||
|
framebufferRenderbuffer Framebuffer DepthStencilAttachment Renderbuffer fboRBO
|
||||||
|
|
||||||
fboStatus <- framebufferStatus Framebuffer
|
fboStatus <- framebufferStatus Framebuffer
|
||||||
putStrLn $ show fboStatus
|
putStrLn $ show fboStatus
|
||||||
|
|||||||
@@ -51,9 +51,11 @@ renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints p
|
|||||||
-- draw lightmap
|
-- draw lightmap
|
||||||
|
|
||||||
bindFramebuffer Framebuffer $= (_spareFBO pdata)
|
bindFramebuffer Framebuffer $= (_spareFBO pdata)
|
||||||
|
depthFunc $= Just Less
|
||||||
clearColor $= Color4 0 0.5 0 1
|
clearColor $= Color4 0 0.5 0 1
|
||||||
clearDepth $= (200)
|
clearDepth $= (200)
|
||||||
clear [ColorBuffer]
|
clear [ColorBuffer]
|
||||||
|
-- depthMask $= Enabled
|
||||||
|
|
||||||
nWalls <- F.foldM (pokeShader (_wallShadowShader pdata)) wallPoints
|
nWalls <- F.foldM (pokeShader (_wallShadowShader pdata)) wallPoints
|
||||||
bindShaderBuffers [_wallShadowShader pdata] [nWalls]
|
bindShaderBuffers [_wallShadowShader pdata] [nWalls]
|
||||||
|
|||||||
Reference in New Issue
Block a user