I have a custom framebuffer which has a depth and stencil attachment:
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, texId, 0);
Does the following operation blit depth and stencil or only depth ?
glBindFramebuffer(GL_READ_FRAMEBUFFER, fboId);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBlitFramebuffer(0, 0, w, h, 0, 0, w, h, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
What will happen when in the above operation I replace GL_DEPTH_BUFFER_BIT with GL_STENCIL_BUFFER_BIT ?
If you call
glBlitFramebufferwithGL_DEPTH_BUFFER_BIT, only the depth buffer is copied and if you call it withGL_STENCIL_BUFFER_BITonly the stencil buffer is copied. If you want to copy both buffers at once you have to set both bits: