diff options
-rw-r--r-- | progs/trivial/tri-z-eq.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/progs/trivial/tri-z-eq.c b/progs/trivial/tri-z-eq.c index b81c992f7d..195e8a26f6 100644 --- a/progs/trivial/tri-z-eq.c +++ b/progs/trivial/tri-z-eq.c @@ -69,6 +69,8 @@ static void Key(unsigned char key, int x, int y) static void Draw(void) { + float z = 1.0; + glClearColor(0.0, 0.0, 1.0, 0.0); glClearDepth(1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -77,15 +79,21 @@ static void Draw(void) glBegin(GL_TRIANGLES); glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 1.0); + glVertex3f( 0.9, -0.9, z); glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 1.0); + glVertex3f( 0.9, 0.9, z); glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, 1.0); + glVertex3f(-0.9, 0.0, z); glEnd(); glFlush(); + { + GLfloat z; + glReadPixels(125, 125, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z); + printf("Z at (125, 125) = %f\n", z); + } + if (doubleBuffer) { glutSwapBuffers(); } |