PDA

View Full Version : 2D text + deth testing



Sagaceil
01-17-2010, 01:27 PM
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.

http://img696.imageshack.us/img696/5140/screen3jp.png

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..

Sagaceil
01-17-2010, 03:12 PM
Done:

http://img194.imageshack.us/img194/179/screen4ui.png

ZbuffeR
01-18-2010, 01:30 AM
Can you outline your solution, so that others with same problem will find it too ?

Nice screenshots btw.

ExJam
02-11-2010, 10:04 AM
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?

DarkShadow44
02-12-2010, 09:17 AM
I would like to know that, too. ;)
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.