glow occlusion


I have been tryng to get glow working in a faster way than the one i have implemented.
Currently, i’m doing this :

  1. render scene normally
  2. change context to pbuffer\resize viewport
  3. render scene again but all in black
  4. render glow materials
  5. blur texture
  6. change context
  7. render 2d quad all over the screen with the blurred texture

This works fine, but it has the drawback of having to render the scene twice
I was told that instead of rendering the scene all in black, i should use the zbuffer of the scene, and so rendering the glow materials they would be occluded because the depth information would already be in the frame buffer, but , it’s not working.
When i change to a pbuffer, does the pbuffer share the depth information from the rendering context ?
If not, is there some other way to do this ?


No the pbuffer has its own depth buffer (not shared). Also glow texture has different resolution to main frame buffer so the depth buffers are not directly compatible.

You could copy the depth buffer into the pbuffer but that would require a lot of memory movement and the main depth bufer as texture. Maybe new generalized frame buffer obejct (FBO) extension could help on that somehow.