Hi all -
I am trying to use the Depth Buffer feature of OpenGL to determine when one pixel should or should not be drawn on top of another. I enable the Depth Buffer and have confirmed that it is active and working.
The documentation I read indicates that the z-axis value determines whether or not a pixel will overwrite the value of a previous pixel. If the z-axis value is numerically higher, the new pixel will overwrite the old one, else it will not. I have actually confirmed that this is working by changing the z-axis value in the drawing functions used, which is simply glVertex3f. If I change the last parameter, which is the z-axis value, it affects which points overwrite others, as stated by the documentation.
My problem is that when I change the z-axis value, the value of the point shifts on the graph. It’s as if the z-axis value was being interpreted as an actual z value in a 3D coordinate system. It was my understanding that if you have the Depth Buffer enabled, the z-axis value is used for the Depth test only, and not as part of the point coordinate. My understanding is very limited, I just started working with OpenGL a few days ago.
Since our plot is really a 2D plot, I don’t need to specify a z-axis value, and want to use this value solely to control the Depth Buffer and not have it interpreted as the z-axis value of a 3D coordinate. Is this possible?
Thanks in advance for any help you can give me.
Bud