diff options
author | Brian Paul <brianp@vmware.com> | 2009-12-03 11:43:19 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-12-03 11:43:19 -0700 |
commit | 52081f0a2c5d1d54d9e0f323c681b30d7186d8e4 (patch) | |
tree | dfdf8151a65670255a85d612298a5195bed85445 /progs | |
parent | 51663f0506ed2534e57b798cdfaf8a0d376eb7a2 (diff) |
progs/trivial: readback and print Z value in tri-z-eq.c
Diffstat (limited to 'progs')
-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(); } |