• Advertisement

Archived

This topic is now archived and is closed to further replies.

lesson13 and Screen Positioning

This topic is 5511 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve been building a small physics sim using nehe''s tutes as my base code, yesterday I added the glPrint code from lesson13, at the moment just to display a FPS counter. Anyway, the problem is, how do you get the text to occupy a fixed position on the screen? I''m using gluLookAt for my camera movements, and while I''ve managed to get the position fixed for linear camera movement (Target and Eye, moving at the same rate) when you move the camera eye, leaving the target in place, the text sort of slides around the screen. *Any* suggestions would be hugely appreciated as this one has me beat. I was thinking later on of using textured quads, for GUI objects, so being able to specify an absolute screen position, is fairly important....

Share this post


Link to post
Share on other sites
Advertisement
You can position the text in Orthographic view mode. Use either of the commands:

glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far);

or

gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);

And then display the text on the screen.
And change back to perspective mode
For more on orthographic projection, look at Tutorial 21 on NeHe's site

Hope this helps, James

[edited by - James Trotter on January 24, 2003 6:59:11 AM]

Share this post


Link to post
Share on other sites
Hey thanks! I would never have thought of that, I always just assumed that you chose perspective OR ortho, at startup and that was it, I had no idea you could mix the modes...

Share this post


Link to post
Share on other sites

  • Advertisement