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