i’m reading in the depth buffer after rendering a simple quad to the screen and I’m getting HUGE values, 3452816845 for instance. here’s the exact code
glClearColor (0.0f, 0.0f, 0.0f, 0.5f);
glDepthFunc (GL_LEQUAL);
glEnable (GL_DEPTH_TEST);
glShadeModel (GL_SMOOTH); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(0, 2, 2, 0, 0, 0, 0, 1, 0);
glBegin(GL_QUADS);
glVertex3f(-1, 0, -1);
glVertex3f(1, 0, -1);
glVertex3f(1,0,1);
glVertex3f(-1,0,1);
glEnd();
glFlush();
unsigned float *buff = new unsigned float[256*256];
glBindTexture(GL_TEXTURE_2D, depthtexture);
glTexImage2D(GL_TEXTURE_2D,0, GL_DEPTH_COMPONENT,256,256,0,GL_DEPTH_COMPONENT,GL_FLOAT,buff);
gl(0,0,256,256,GL_DEPTH_COMPONENT,GL_UNSIGNED_float,buff);
It doesn’t seem to return between 0 and 1. I want to draw the depth buffer to the screen, but all i see is white since the values are so big. Any ideas? By the way, the window dimensions are 256x256.