… Er …
I’m trying to do some real-time CSG and I need to check out my depth buffer (visually) to be sure I’m on the right track; so here’s what I did:
First I declare an array to hold the anticipated depth buffer information:
GLfloat *Depth_Data = (GLfloat *) malloc(sizeof(GLfloat) * width * height);
Then I disable writes to the color buffer,
glColorMask(GL_FALSE, …);
Next I draw a sphere (to the depth buffer)
glutSolidSphere();
I Subsequently read data from the depth buffer to the array Depth_Data and enable writes to the color buffer:
glReadPixels(0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, Depth_Data);
glColorMask(GL_TRUE, …);
Lastly I (attempt to) Draw the depth information to the color buffer as follows:
glDrawPixels(width, height, GL_LUMINANCE, GL_FLOAT, Depth_Data);
… but I get nothing?!
So then what am I doing wrong?
P.S:
I made the check:
printf("OpenGL version: %s
", glGetString(GL_VERSION));
… and got “1.3.0” which is kidda cool except that the call
GLint TexUnit_Count;
…
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &TexUnit_Count);
generates an error … (something like) undeclared identifier/variable …
Methinks perhaps my header file is “pointing” to the wrong object files or something. I only recently had my graphics card upgraded to a GeForce 3 Ti200 from a RIVA or something …
H E L P !!!