Forcing the depth value

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.

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.

OK, thanks very much! I’ll give that a go and see if it works. :smiley:

Cheers,

Dave.