Advertisement Jump to content
Sign in to follow this  
Joshua Klint

Cubemap FBO color + depth not working

This topic is 4101 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I render to a cubemap, depth testing does not appear to work. I am using the code below to set up the texture and FBO. Any ideas?
'Create the texture
		cubemap=CreateTexture(GL_TEXTURE_CUBE_MAP)
		cubemap.setfilter TEXTUREFILTER_SMOOTH
		glBindTexture GL_TEXTURE_CUBE_MAP,cubemap.index()
		For n=0 To 5
			glTexImage2D GL_TEXTURE_CUBE_MAP_POSITIVE_X+n,0,GL_RGB8,size,size,0,GL_RGB,GL_UNSIGNED_BYTE,Null
		Next
		glGenFrameBuffersEXT 6,Varptr cubemap.framebuffer[0]
		glGenRenderBuffersEXT 6,Varptr cubemap.framebuffer[0]
		For n=0 To 5
			glBindFramebufferEXT GL_FRAMEBUFFER_EXT,cubemap.framebuffer[n]
			glFramebufferTexture2DEXT GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_CUBE_MAP_POSITIVE_X+n,cubemap.index(),0
			glBindRenderbufferEXT GL_RENDERBUFFER_EXT,cubemap.renderbuffer[n]
			glRenderbufferStorageEXT GL_RENDERBUFFER_EXT,GL_DEPTH_COMPONENT,size,size
			glFramebufferRenderbufferEXT GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT,cubemap.renderbuffer[n]
			Select glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)
				Case GL_FRAMEBUFFER_COMPLETE_EXT
				Case GL_FRAMEBUFFER_UNSUPPORTED_EXT
					RuntimeError "Unsupported FBO configuration."
				Default
					RuntimeError "Unknown FBO error."
			EndSelect
		Next
--EDIT-- Fixed it. Here was the problem: glGenFrameBuffersEXT 6,Varptr cubemap.framebuffer[0] glGenRenderBuffersEXT 6,Varptr cubemap.renderbuffer[0] [Edited by - Joshua Klint on October 26, 2007 1:12:30 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!