Skip to main content
gamedev.net
🔒 Locked

FBO's, Render Buffers, Shadow Problem

Started by Lopez 3 replies 400+ views
Original Post
Lopez
Lopez
Hi there, I am currently trying to implement shadowmapping using FBO's. I have been setting up the FBO and renderbuffer as shown in another thread - without getting any problems. I can currently render the color to the scene as a projection, but when i try and render the depth map on the scene, i just get black, with a thin lighter border around the edge of the projection, as if all the depth values are 0. Any ideas please? If code is needed, I will post later.
Lopez
Lopez
Here the init code:

	shadowMapTexture	=	_textureman->CreateDepth(D_shadowmap_size_x, D_shadowmap_size_y);	color_tex			=	_textureman->Create(D_shadowmap_size_x, D_shadowmap_size_y);	//	Framebuffer	glGenFramebuffersEXT(1, &fb);	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);	glGenRenderbuffersEXT(1, &depth_rb);	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depth_rb);	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, D_shadowmap_size_x, D_shadowmap_size_y);	//	Attach everything	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, color_tex, 0);	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depth_rb);	//	Unbind	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);


and during the update()

	//	pixel buffer stuff	glGetIntegerv(GL_DRAW_BUFFER, &_currentDrawbuf); // Save the current Draw buffer// draw to the texture	glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, _lightman->getLight(0)->fb);	glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);			 // Draw into the first texture	glDrawBuffer(GL_DEPTH_ATTACHMENT_EXT);			 // Draw into the first texture//          draw the stuff	glDrawBuffer(_currentDrawbuf);





MARS_999
MARS_999
what gfx card are you using? If ATI change your depth components to 16 not 24 for you FBO's
Lopez
Lopez
i'm using a crappy creative fx5600 128m.
MARS_999
MARS_999
what is your near far planes set to? try 3.0 and 100.0 or so don't use less than one on the near plane if you can

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.