I’ve been trying to do stuff with the depth buffer.
I had used glCopyTexSubImage2D, and it works for non-depth buffer things. The man page says no depth or stencil buffer. If this is wrong, someone PLEASE correct me, and give me the syntax.
Anyway, I was able to get a version working with this, where I took a revolving 3D color scene, make a luminance snapshot of it with glCopyTexSubImage2D, and pasted it to a full screen quad.
This resulted in a B&W rotating scene image.
Everything was cool.
I tried the glCopyTexImage2D, and it flat out didn’t work. The options should have been even easier, but I get the same results as if I don’t even bother to make the call. Is this a problem with NVIDIA Linux Drivers?
Anyway, since it wouldn’t work with the depth buffer, I went to the old standby of glReadPixels.
I read the whole buffer, in Luminance, Intensity, GL_UNSIGNED_BYTE form.
I attempted to paste this to a quad, with the exact same code that worked for glCopyTexSubImage2D.
I get a smeared mess.
I am assuming that there is something missing with a glPixelStore command, but I can’t figure out what.
Is there something I need to do to the image data received by glReadPixels before it can be used by glTexImage2D in the same exact format?
Here are the exact commands I am using.
glReadPixels(0,0,width,height,GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels);
then I bind. then:
glTexImage2D(GL_TEXTURE_2D, 0,GL_LUMINANCE8, width, height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels);
The pasting with texcoords works fine.
I am using Linux, NVIDIA, Little Endian platform.
Thanks,
TM