Depth Buffering - HELP !!

I have a viewport with glOrtho set up and there are some objects that I am drawing that I want behind others. The problem is that I had to turn depth buffering off so that I could get the text working in the viewport.

Is there a way that I can have one object drawn ontop of another without using depth buffering?

or

Is there a way that I can text on the viewport without turing the depth buffering off?

Thanks

Simon

Yes to both questions. But instead of compromising, use the best from both techniques.

That is: Render the objects with depth buffer on, and text with depth buffer off.

glEnable(GL_DEPTH_TEST);
drawObjectsHere();
glDisable(GL_DEPTH_TEST);
drawTextHere();

You can draw your objects that requires depth using the depth buffer turned on, and then (when everything else is drawn) draw the text with the depth buffer turned off:

glEnable( GL_DEPTH_TEST );
DrawMyObjects();
glDisable( GL_DEPTH_TEST );
DrawText();

…hrm! Bob, you beat me to the ‘Submit Reply’ button

Thanks Guys

Seams to have sorted it out.

I have a problem with some text that goes cyan after a while, it starts off white and then after a while turns cyan for no reason.

Umm

simon

stockton,

try setting the color state right before you draw the text. it sounds like a state set during other rendering is still set when you render the text…

I was under the impression Furrage meant the windows message timer created with SetTimer.

The QueryPerformanceCounter sounds a lot better, but what’s with this: (from MSDN) ‘The QueryPerformanceCounter function retrieves the current value of the high-resolution performance counter, if one exists.’, if one exists? How often can this happen?

John.

sorry, I miss posted. that was meant for another thread…

John.