PDA

View Full Version : pbo depth problem



fedex
06-19-2009, 03:03 PM
i've drawn a dice on a floor (both normal rendered with opengl)
then i've rendered another dice (which i'm using as a boundary box of a volume) in a pixel buffer object. after that i've rendered the pbo onto a texture which is as big as the screen and blended it onto the other scene with an orthographic projection to ensure, that the texture is always facing the camera.

but how can i now do the depth testing? the pbo-texture is always visible. even when i'm rotating the camera to show the scene from under the floor the volume is shinen through the floor according to the blendfunc.
(because its ortographic and so it has no depth value) or?

scratt
06-19-2009, 08:47 PM
Don't draw it Orthographic. :)

If I am understanding what you are doing properly... A very quick and dirty way to make sure it's always facing you is to make the current model view matrix into the identity, and then translate your screen aligned QUAD to the depth you want it in Z. You can push and pop the current matrix either side of that bit of drawing to preserve it. Job done... carry on with your normal 3D.

Alternatively crib some billboard code for camera facing QUADS and draw it in the current scene.

dletozeun
06-22-2009, 03:13 AM
fedex, when you say pbo you mean fbo? Am I right?

See this tutorial (http://www.gamedev.net/reference/articles/article2331.asp) for performing depth test when rendering to texture.