opengl-4

what's the internal format of default framebuffer's depth component in opengl


glblitframebuffer requires matched internal format, so what's the internal format of default framebuffer's depth component?Is there a standard?I couldn't find a document for it.

My laptop's nvidia card requires GL_DEPTH_COMPONENT24. But theres 16 and 32 for options. I wonder if that's different for other vendor.


Solution

  • There is rarely a good reason to blit an FBO's depth to the default depth buffer. If you're rendering to one FBO, and you need to do rendering after the blit, it's best to do that rendering into another FBO, then blit it to the default framebuffer.

    That being said, when you create an OpenGL context, you can ask that the default depth buffer store some number of bits. How to do this depends on how you created the context.

    However, the implementation doesn't have to comply with your request. So you need to ask what you received. You need to employ glGetFramebufferAttachmentParameter. With that, you can query GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE​ from the GL_DEPTH attachment.