PDA

View Full Version : Forcing the depth value



07-20-2005, 03:23 AM
Hi,

Can anyone tell me how I can force an object to be displayed in front of all other objects on the screen, regardless of what it's Z value is?

I'm hoping there's just a simple switch command in OpenGL that will allow me to do this.

Many thanks in advance.

Relic
07-20-2005, 04:45 AM
If it's a 2D object, the most common way is to draw it last with depth test disabled.
If it's a 3D object in need of depth testing, draw it last and clear the depth buffer before rendering it.
Other tricks are glDepthRange settings where zFar ends up in front of your other scene's depth values.

07-20-2005, 05:11 AM
OK, thanks very much! I'll give that a go and see if it works. :D

Cheers,

Dave.