I am drawing a cube and rotating it via gluLookAt (based on user’s input). On this cube, I am also showing the coordinates of each vertex with a displacement of 1.0 in each of the XYZ-directions.
Now, since DepthTesting is enabled, I only see some of the vertices (according to my “view-point”) which is of course exactly what I want.
BUT, there are cases that a vertex is “hidden” while it’s “associated coordinates” is still visible (since the latter is drawn with a displacement plus, being a text of the form “x, y, z”, it has it’s own “width” and “length”)
In order to “hide” the “associated coordinates” of a “hidden vertex”, I need to check the “visibility” of each vertex (based on my “View-Point” or any other criteria that is available in my “drawing & viewing system”) and avoid displaying it appropriately.
Is this possible and how?
My highest appreciation for your help is attached.
Are you using glRaster? If so, you should be able to use the 3f version to give a depth so it will be hidden by depth testing. Even if the cube is in perspective and the text is done in ortho, it should work.
[This message has been edited by shinpaughp (edited 03-24-2003).]
With thanks for your help,
no I’m not using glRaster (as I don’t know what it does?!?!)
For your added information, I have:
glClearColor 1#, 1#, 1#, 1#
glOrtho -1#, 1#, -1#, 1#, -2#, 2#
at the start and then, having the 8 XYZ-coordinates of the cube, I use glBegin QUADS for faces and glBegin LineLoops for the edges. Then, in a code-piece like:
for i=0 to 7
glTransfer X(i)+1.0, Y(i)+1.0, Z(i)+1.0
textDraw X(i) & “,” & Y(i) & “,” & Z(i)
I display each coordinate next to its corresponding vertex.
What I was looking for was a means of testing to see if “vertex(i)” is visible and do the “textDraw” only if it is so.
Now, how is this possible by means of glRaster and testing the depth?
I reread your post and along with the clarification of your second post see that I was mistaken in what you sought.
You might try using the glFeedbackBuffer function which if the vertex is culled shouldn’t return any data for that vertex (I think). Unfortunately, I have never used this and I do not truly know how effective it is, or if there may be a better method.
Anyway, sorry for the confusuion. Hope this is more helpful.