views:

53

answers:

1

I have text that I am successfully rendering in OpenGL:

    GLUT glut = new GLUT();
    gl.glRasterPos2d(10, 10);
    glut.glutBitmapString(GLUT.BITMAP_HELVETICA_18, "We're going to the moon!");

I would like this text to appear in the same location on the user's screen (occupying the same pixels) regardless of camera orientation. How should I go about doing this?

(I'm using JOGL.)

A: 

Try this (I don't know Java, warning):

glPushMatrix() //save the camera state
glLoadIdentity()
//draw your text here
glPopMatrix() //restore the camera state

This resets the camera location to the origin for any rendering commands following the glLoadIdentity() call.

l33tnerd