Hi,

I can use a packed depth stencil with my FBO just fine using the following code (color buffer construction code omitted):

Code :
glBindTexture(target = GL_TEXTURE_2D, texture = 17)
glTexImage2D(target = GL_TEXTURE_2D, level = 0, internalformat = GL_DEPTH24_STENCIL8, width = 1486, height = 1400, border = 0, format = GL_DEPTH_STENCIL, type = GL_UNSIGNED_INT_24_8, pixels = NULL)
 
glFramebufferTexture2D(target = GL_FRAMEBUFFER, attachment = GL_DEPTH_ATTACHMENT, textarget = GL_TEXTURE_2D, texture = 17, level = 0)
glFramebufferTexture2D(target = GL_FRAMEBUFFER, attachment = GL_STENCIL_ATTACHMENT, textarget = GL_TEXTURE_2D, texture = 17, level = 0)
glFramebufferTexture2D(target = GL_FRAMEBUFFER, attachment = GL_COLOR_ATTACHMENT0, textarget = GL_TEXTURE_2D, texture = 18, level = 0)

glCheckFramebufferStatus(target = GL_FRAMEBUFFER) returns GL_FRAMEBUFFER_COMPLETE

However, attaching a separate stencil buffer doesn't work (code below) and returns a GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT error.

Code :
glBindTexture(target = GL_TEXTURE_2D, texture = 16)
glTexImage2D(target = GL_TEXTURE_2D, level = 0, internalformat = GL_DEPTH_COMPONENT, width = 1486, height = 1400, border = 0, format = GL_DEPTH_COMPONENT, type = GL_UNSIGNED_BYTE, pixels = NULL)
 
glBindTexture(target = GL_TEXTURE_2D, texture = 17)
glTexImage2D(target = GL_TEXTURE_2D, level = 0, internalformat = GL_STENCIL_INDEX8, width = 1486, height = 1400, border = 0, format = GL_STENCIL_INDEX, type = GL_UNSIGNED_BYTE, pixels = NULL)
 
glFramebufferTexture2D(target = GL_FRAMEBUFFER, attachment = GL_DEPTH_ATTACHMENT, textarget = GL_TEXTURE_2D, texture = 16, level = 0)
glFramebufferTexture2D(target = GL_FRAMEBUFFER, attachment = GL_STENCIL_ATTACHMENT, textarget = GL_TEXTURE_2D, texture = 17, level = 0)
glFramebufferTexture2D(target = GL_FRAMEBUFFER, attachment = GL_COLOR_ATTACHMENT0, textarget = GL_TEXTURE_2D, texture = 18, level = 0)

glCheckFramebufferStatus(target = GL_FRAMEBUFFER) returns GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT​, here.

Any idea why?

Thanks,
Fred

nb: using a GeForce GTS 450 and latest drivers.