PDA

View Full Version : Depth Buffering - HELP !!



stockton
01-21-2002, 01:56 AM
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

Bob
01-21-2002, 03:59 AM
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();

marcus256
01-21-2002, 04:01 AM
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();

marcus256
01-21-2002, 04:02 AM
...hrm! Bob, you beat me to the 'Submit Reply' button http://www.opengl.org/discussion_boards/ubb/wink.gif

stockton
01-21-2002, 04:06 AM
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

ToolChest
01-21-2002, 01:03 PM
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...

ToolChest
01-22-2002, 06:02 AM
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.

ToolChest
01-22-2002, 06:05 AM
sorry, I miss posted. that was meant for another thread...

John.