I’m currently writing a percision part viewer and I’m trying to figure out how to do this. I’m using texture-fonts (mapped quads) to display text on my viewport. What I want to do is be able to rotate the part while affixing the text to a particular point location on that part, but I always want the text to face forward obviously.
Currently, I draw the part in a viewing frustum, and then I remap the viewport to an ortho-view and map the text per client-pixel location. In this case, I want the text to always maintain the same facing and zdepth, so I think I want to keep the text in an ortho-view. But is this the correct thing to do?
What are the suggestions?
The only other idea I can come up with is map the text within the viewing frustum, except always calculate the point’s z-depth to place the text at the near clipping plane. But if I were to do this, I would lose my font’s pixelmapped property.
If I understand correctly what you’re trying to do, then you could use gluProject to convert the 3D point where you want your text to appear into screen space, and then use the ortho view to draw the text.
gluProject takes a point in 3D space, and returns a point in window coordinates (as defined by the viewport vector you supplied to the function). This seems exactly what you’re after. What am I missing?
Hmm, I must have not real gluProject very carefully then. I was under the impression that it it return coordinates at the near clipping plane of the frustum, not the window coordinates. Oh well… DUH!