I think glDrawPixels is causing and odd behavior. But since this is the first time I have used it I cant’t be sure.
What ever I draw after using glDrawPixels doesn’t appear on the screen. For instance, if I draw some polygons, then read the frame buffer, then write the read data back to the frame buffer (so that it is exactly the same as before), and then I draw some more polygons. All the polygons drawn after the glDrawPixels don’t show up.
Is this what is supposed to happen?
Check depth testing, stencil testing, etc.
Oh … depth testing … didn’t think of that. Could the Z-depth value for the pixel have been changed to 0 so that following draw commands ended up with pixels behind the raster just loaded and thus were not drawn? I bet it’s something like that.
hmmm… how do I load the Z values with the color and how do I replace them… stuff to check on
OK I figured out how to read the depth component. So here is my code: (in JOGL)
System.out.println("before DrawPixels "+zScreen);
System.out.println("after DrawPixels "+zScreen);
before DrawPixels 0.98789835
after DrawPixels 0.0
Clearly writing to the frame buffer sets the z-depth to zero. Is that what is supposed to happen? I only wanted to change the color and leave the depth buffer alone.
DrawPixels uses the current raster position depth value when you draw color.
DrawPixels uses the current raster postion color value when you draw depth.
Ah Zengar, you are brilliant. Using gl.glDepthMask(false); right before the glDrawPixels did the trick. My reading of the glDrawPixels command was that it would use the current depth position and combine that with the loaded color as arekkusu stated. But that does not appear to be the case on my card. (ATI Radeon 9800 Pro)