2D text + deth testing

Hello, I’m writing a game, and I found some ( not so big ) problem.

I have a players on the scene and I’m trying to print theyrs nick. So I just use gluUnproject and I’m recieving a 2D window position of 3D point.

My question: how to use a depth buffer ( using pipe line , dunno maybe some matrix tricks ), to when I’m printing a text. Becaouse now I’m using a Orthogonal mode, when the far and near planes are the same ( and different than 3D planes ), so theres no chance to simply turn on depth testing.

Here you can see that the tree is behind ‘Sagaceil’. I’d like to test depth buffer correctly so if something covers text it shouldn’t be visible.

Thank you for any ideas…


Can you outline your solution, so that others with same problem will find it too ?

Nice screenshots btw.

Sorry to resurrect an old topic but I have the exact same issue - as the author did not post his solution does anyone else have any ideas?

I would like to know that, too. :wink:
But till then just print the name at the end. I mean, draw your scene and THEN draw the text which should be in forground.