Jump to content
  • Advertisement
Sign in to follow this  
Joshua Klint

FBO works with texture2D but not with cubemap

This topic is 4012 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

This code works perfectly:
		'Create the texture
		Local rendertexture:TTexture=CreateTexture()
		rendertexture.setfilter TEXTUREFILTER_SMOOTH
		glbindtexture GL_TEXTURE_2D,rendertexture.index()
		glTexImage2D GL_TEXTURE_2D,0,GL_RGB8,width,height,0,GL_RGB,GL_UNSIGNED_BYTE,Null
	
		'Create the frame buffer
		glGenFramebuffersEXT 1,Varptr RenderTexture.framebuffer[0]
		glBindFramebufferEXT GL_FRAMEBUFFER_EXT,RenderTexture.framebuffer[0]
		glFramebufferTexture2DEXT GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_2D,RenderTexture.index(),0
		
		'Depth buffer
		glGenRenderbuffersEXT 1,Varptr Rendertexture.renderbuffer[0]
		glBindRenderbufferEXT GL_RENDERBUFFER_EXT,Rendertexture.renderbuffer[0]
		glRenderbufferStorageEXT GL_RENDERBUFFER_EXT,GL_DEPTH_COMPONENT,width,height
		glFramebufferRenderbufferEXT GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT,Rendertexture.renderbuffer[0]
This code results in a GL_FRAMEBUFFER_UNSUPPORTED_EXT error:
		'Create the texture
		cubemap=CreateTexture(GL_TEXTURE_CUBE_MAP)
		cubemap.setfilter TEXTUREFILTER_SMOOTH
		glBindTexture GL_TEXTURE_CUBE_MAP,cubemap.index()
		glTexImage2D GL_TEXTURE_CUBE_MAP_NEGATIVE_X,0,GL_RGB,width,height,0,GL_RGB,GL_UNSIGNED_BYTE,Null
		
		'Create the frame buffer
		glGenFrameBuffersEXT 1,Varptr cubemap.framebuffer[0]		
		glBindFramebufferEXT GL_FRAMEBUFFER_EXT,cubemap.framebuffer[0]
		glFramebufferTexture2DEXT GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_CUBE_MAP_NEGATIVE_X,cubemap.index(),0
		
		'Depth buffer
		glGenRenderBuffersEXT 1,Varptr cubemap.framebuffer[0]
		glBindRenderbufferEXT GL_RENDERBUFFER_EXT,cubemap.renderbuffer[0]
		glRenderbufferStorageEXT GL_RENDERBUFFER_EXT,GL_DEPTH_COMPONENT,width,height
		glFramebufferRenderbufferEXT GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT,cubemap.renderbuffer[0]
Running on a GE Force 8800 with drivers from around September 2007. --EDIT-- I solved this right after I posted, but this might be of help to someone else. You have to call glTexImage2D on all cube faces before you do any FBO stuff. [Edited by - Joshua Klint on October 26, 2007 12:24:59 AM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!