|
From: Ben S. <bs...@vr...> - 2002-03-28 09:23:27
|
it's 3:10 AM and I'm up too ;) hopefully you're using glut because then
the solution is pretty trivial.
when you initialize the display mode, you need to add an extra flag,
namely GLUT_DEPTH to make sure your window has the Z-buffer necessary for
doing depth testing.
then before you do any drawing, you need to enable depth testing with
glEnable( GL_DEPTH_TEST ). the default testing method is usually what you
want to do.
finally, when you clear the buffers with glClear you also want to clear
the depth buffer by adding the flag GL_DEPTH_BUFFER_BIT.
code ...
main() {
glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH );
// more glut init stuff
}
void onRedisplay()
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable( GL_DEPTH_TEST );
// fun drawing stuff here ^_^
}
good luck on that addiction. ^_^
cheers,
-----
Ben Scott
President ISU Game Developers Club
Treasurer ISU Ballroom Dance Company
bs...@ia...
On Thu, 28 Mar 2002, Lou Herard wrote:
> Yes, it's 2:56 AM, and I am addicted...How do you make depth testing work???????
>
> - Lou
>
|