Is there anyway to delete default depth backbuffer in OpenGL platform


In OpenGL platform,We have a render pipeline, where the forward Render pass and most postprocessing passes(except the last one) are rendered into off-screen framebuffers,until the last postprocessing pass rendered into color backbuffer by using glBindFramebuffer(GL_FRAMEBUFFER, 0).My question is that, as the depth backbuffer,which is created by openGL initialize, is not necessary,is there any way to delete this? I found the param zero of glBindFramebuffer will be silently ignores by glDeleteRenderbuffers.However, the GLuint of depth backbuffer is not aware of us,as it is created by openGL initialize.Maybe you have any idea to delete default depth backbuffer in OpenGL backbuffer ?
I also tried with context creation. However,the context is created by eglCreateContext with EGLConfig, which is queryed from eglGetConfigAttrib. The problem is that I can’t get EGL_DEPTH_SIZE with number 0 in mobile.How can I avoid this?
I am sure it is not relative with hardware,as the vulkan platform don’t exist this issue.

Thank you for your help!

Why do you want to?

In any case, this isn’t an OpenGL issue but a window system integration layer issue (glX, wgl, egl, etc.). When you create the default framebuffer (window, pbuffer, or pixmap), you can request no depth bits. But if it doesn’t support that, there’s not much you can do about it.


thank you for your help!

I want to know how to implement a default framebuffer without depth buffer and another framebuffer with depth.And through vulkan platform,I think the hardware or window system integration layer should support this.I can create framebuffer using glGenFramebuffers and use glBindRenderbuffer(GL_RENDERBUFFER, 0) to return to backbuffer.But I didn’t know when the backbuffer is created and how to avoid depth being created by backbuffer.

I think the key may be the creation of Context, which I have poor knowledge. I am learning this now. But I am afraid that if I create a context without depth, will the other famebuffer with depth will go wrong?

No. The number of depth bits isn’t a property of a context, but of a framebuffer configuration.

The framebuffer configuration is selected using eglChooseConfig. Including EGL_DEPTH_SIZE, 0 in the attribute list indicates that you don’t need a depth buffer, but some or all of the returned configurations may provide one. EGL_DEPTH_SIZE specifies a lower bound on the number of depth bits (configurations with fewer than the requested number of bits won’t be included in the list), it isn’t possible to specify an upper bound.


Thank you for your help!Your reply helped me to understand more details!I will check this in my project!

Thanks a lot~