Accessing FBO during deferred light pass with combined stencil/depth buffer
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:
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, dim, dim, 0,
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL);
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