FBO incomplete if try to use GL_DEPTH_COMPONENT24

Started by ct1000ad, March 16, 2012, 02:59:57

Previous topic - Next topic

ct1000ad

I'm making an FBO and binding a depth texture to it. It works great if I specify the texture format as:
  glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, width, height, 0, GL_DEPTH_COMPONENT,
      GL_FLOAT, null)

However it fails if I switch to GL_DEPTH_COMPONENT24:
  glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, width, height, 0, GL_DEPTH_COMPONENT,
      GL_FLOAT, null)

glCheckFramebufferStatus returns GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT (36054).

I am on Linux 32-bit, Nvidia drivers.

spasi

I don't remember why, but for depth textures I use GL_UNSIGNED_INT instead of GL_FLOAT in my code. Try and see if that makes any difference.

ct1000ad


spasi


Estraven

Hello,

I use GL_DEPTH_COMPONENT24 on most of my FBO. It works fine.
Like Spasi, i use " GL_UNSIGNED_INT " instead of " GL_FLOAT "

Stupid question : Did you call the following line BEFORE checking the completeness ?

glFramebufferTexture2D( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT , GL_TEXTURE_2D, this.DEPTH_ID, 0 );



If you did, here is the OpenGL spec about completeness of FBO (if it can help) :

QuoteThe rules of FBO completeness are:

The width and height of framebuffer-attachable image must be not zero.
If an image is attached to a color attachment point, then the image must have a color-renderable internal format. (GL_RGBA, GL_DEPTH_COMPONENT, GL_LUMINANCE, etc)
If an image is attached to GL_DEPTH_ATTACHMENT_EXT, then the image must have a depth-renderable internal format. (GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT24_EXT, etc)
If an image is attached to GL_STENCIL_ATTACHMENT_EXT, then the image must have a stencil-renderable internal format. (GL_STENCIL_INDEX, GL_STENCIL_INDEX8_EXT, etc)
FBO must have at least one image attached.
All images attached a FBO must have the same width and height
All images attached the color attachment points must have the same internal format.

Estraven