PDA

View Full Version : Aligning a frustum view with an ortho view



Siwko
05-19-2001, 05:42 AM
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.

Help? http://www.opengl.org/discussion_boards/ubb/smile.gif

Siwko

ET3D
05-19-2001, 07:22 AM
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.

Siwko
05-19-2001, 07:55 AM
Yes, this is almost exactly what I want to do. The only catch is, my frustum and ortho views are two different coordinate systems.

The frustum ranges -/+ width, -/+ height of some arbitrary dimensions, while the ortho view ranges from 0/clientX width, 0/clientY height.

What other calculations do I need to map that point out of the frustum into that ortho-space?

Siwko

ET3D
05-19-2001, 11:39 AM
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?

davepermen
05-20-2001, 11:12 AM
for writing the text out then, simply set up a orthoview where you can give screencoords out and they will drawn there then.. something like

glOrtho( 0, 0, width, height ); or whatever.. i dont look at my code.. but i think it give you the idea..

Siwko
05-21-2001, 04:32 AM
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!

That should do what I want it to then.

Siwko

Siwko
05-22-2001, 03:52 AM
Works great ET3D, thanks.

Siwko