- Firstly it appears that there is now access to a 24bit depth buffer paired with an 8bit stencil buffer;
// Now setup the first texture to render to glGenTextures(1, &depthTexture); glBindTexture(GL_TEXTURE_2D, depthTexture); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8_EXT, width, height, 0, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, NULL); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); // And attach it to the FBO so we can render to it glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, depthTexture, 0); glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_TEXTURE_2D, depthTexture, 0); // Now set the render state correctly glDrawBuffer(GL_FALSE); glReadBuffer(GL_FALSE); GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if(status != GL_FRAMEBUFFER_COMPLETE_EXT) exit(1);
on my X1900 that doesn't exit [smile] however as I'm not sure of the sanity of the rest of the code (it was doing strange things before but I've lost my good FBO based shadow mapping code) I can't comment on the quality.
- When it comes to the gl_FragCood.z value, well it doesn't return 0.5 all the time but I'm not sure what I'm seeing [grin]
I've some shader code which basically says if gl_FragCood.z > 0.95 frag color is green, else make it red; this results in a small section of the rendered polys being green close to the near plane and the rest being red.
I'd fiddle more but well, dissertation to complete so don't have the time [grin]
As noted, this is on Cat7.4 on Vista with an X1900XT card.