Hello,
I’ve hit a problem during my attempt to write a deferred light shader using stencil light volumes. The combined depth/dtencilbuffer setup looks like this:
glGenTextures(1, &ids[depthbuffer]);
glBindTexture(GL_TEXTURE_2D, ids[depthbuffer]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, dim[0], dim[1], 0,
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
GL_TEXTURE_2D, ids[depthbuffer], 0);
During the lighting pass when the stencil buffer is being set it seems that I cannot access the attached depth buffer and write the final color to the screen at the same time. The problem is being discussed in some tutorials and the solution would be to write the lighting pass into a separate color buffer and then blit the color buffer to the FBOs final color buffer (screen). Is there a smarter solution without the need of creating another buffer and copy the color data around?
Thanks & Regards
Saski