Advertisement

lesson13 and Screen Positioning

Started by January 23, 2003 11:37 PM
4 comments, last by HashMaster 22 years, 1 month ago
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....
"...we can't stop here! This is bat country!" - Hunter S Thompson
Is that lesson on outline fonts or bitmap fonts?
Advertisement
Bitmap fonts
"...we can't stop here! This is bat country!" - Hunter S Thompson
use ortho matrix for text rendering.
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]
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...
"...we can't stop here! This is bat country!" - Hunter S Thompson

This topic is closed to new replies.

Advertisement