FBO dirty shadow map problem

Started by
3 comments, last by MARS_999 17 years, 8 months ago
I'm trying to add shadow mapping to my game. To get a higher resolution shadow map, I started using a frame buffer object. But since I did that, I get strange results; the shadows projected to the floor, stays there even when the car goes away and clears only every 1 or 2 seconds. This doesn't happen if the car is on top of a ramp, for example. Its very weird... any ideas why this happens? Here a sceenshot (without textures)

  //---------blablabla
  glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, shadow_map_fb);
		
  glViewport(0, 0, shadowMapSize, shadowMapSize);
		
  glClear (GL_DEPTH_BUFFER_BIT);
	
  draw_cocheworld();  //draw the shadow map
		
  glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
  //---------blablabla


Advertisement
try sticking a glDepthMask(1) before the clear
Try

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


and if not you may need to include more code...
the only thing that helps is drawing a big quad facing down under the scene.
dont understand why.
are you using GL_LEQUAL for your depth buffer parameters? You may need to post more code...

This topic is closed to new replies.

Advertisement