PDA

View Full Version : HUD Always draw on top?



darkrappey
10-03-2006, 04:33 PM
I am working on a heads up display interface using/rendering quads.

How could I ensure that the interface will always be drawn over the world geomatry of the game?

Do I need to somhow modify the ZBuffer?

Rodrix
10-03-2006, 06:05 PM
I am pretty sure you just need to render your display interface last. Swith to Ortho view and render last. You can also turn gldepthmask(false) before drawing your GUI, and then turn it on again (set to true). That way you ensure is drawn ontop. That would be enough (if not others will correct me :) )

The point is: don't use the zbuffer, use ortho view and forget about the third dimension!

Cheers,
Rod

k_szczech
10-03-2006, 10:29 PM
if not others will correct me:)
Actually you need to disable the depth test: glDisable(GL_DEPTH_TEST). Depth mask is irrelevant if you draw your interface at the end.

Komat
10-03-2006, 10:31 PM
Originally posted by Rodrix:
You can also turn gldepthmask(false) before drawing your GUI, and then turn it on again (set to true). That way you ensure is drawn ontop. No. The depth mask controls write to the depth buffer not testing aginst it. The testing can be disabled by disabling the depth buffer using glDisable(GL_DEPTH_TEST) or by changing depth function to GL_ALWAYS.