Text positioning

I want to create a HUD for a simple game i am developing and at the moment i have text on the screen but i am using glRasterPos2f, with an extended glPrint method.

Unfortunately raster positioning makes the text appear further appart when the camera is zoomed in and really close together when zoomed out.

Is there anyway to lock the text to the top right of the screen??

ps. I am using a third person camera that rotates and zomms in and out around a point.

Have you switched to an orthographic projection matrix before rendering your HUD?

Here is how you can set up your hud display.

I have used bit of code from one of my programs for an example:

// draw world
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
gluPerspective(60, 1, 1, 30);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

draw3d_stuff();

//Hud view
// Switch to ortho mode
glMatrixMode (GL_PROJECTION); // Tell opengl that we are doing project matrix work
glLoadIdentity(); // Clear the matrix
glOrtho(-9.0, 9.0, -9.0, 9.0, 0.0, 30.0); // Setup an Ortho view
glMatrixMode(GL_MODELVIEW); // Tell opengl that we are doing model matrix work. (drawing)
glLoadIdentity(); // Clear the model matrix

Draw_hud()

So if i was to draw my own hud i would do something like this:

//Hud view
// Switch to ortho mode
glMatrixMode (GL_PROJECTION); // Tell opengl that we are doing project matrix work
glLoadIdentity(); // Clear the matrix
glOrtho(-9.0, 9.0, -9.0, 9.0, 0.0, 30.0); // Setup an Ortho view
glMatrixMode(GL_MODELVIEW); // Tell opengl that we are doing model matrix work. (drawing)
glLoadIdentity(); // Clear the model matrix

glPrint(“Heading %7.2f”, boat->heading );

how do i position the text?
Is this even correct?

I assume you are using the Nehe bitmap font example.

I think you need to first do
glRasterPos2f(Some_X, Some_Y);
to position the text.

then do the glPrint

[This message has been edited by Pops (edited 03-20-2003).]