FrameBuffer using Texture3D

Hi people,

I’m doing a research where I need to do depth peeling. So, instead of using an array of 2D textures I’m using a Texture3D and rendering in it multiple times in different Z values.

I’m doing the following to setup and render one pass:

 
GLuint depthImg;
glGenTextures(1, &depthImg);
glBindTexture(GL_TEXTURE_3D, depthImg);	

glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage3D(GL_TEXTURE_3D, 0, GL_DEPTH_COMPONENT24, width, height, 4, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);


glFramebufferTexture3DEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_3D, depthImg, 0, 0);


At this point, when I get the completness of the frame buffer, I receive the following value:

GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6

Does someone knows why this is happening? Is there something wrong with this code?

Thanks a lot.

Jose Ricardo

This is because there is an attachment that is not attachment complete. More than likely, ‘depthImg’ is greater than 3 (depth of 4 means a range of [0, 3]).

Sorry; I didn’t realize that depthImg was the texture name. I have no idea why it thinks it is not attachment complete, though. What other attachments do you have on the FBO, and are they complete?

DEPTH_COMPONENT is not a valid format for TEXTURE_3D.
You should receive an error after the call to glTexImage3D.

You’ll need to use 2D_ARRAY, or a bunch of regular textures instead.