开发者

OpenGL: How to make text appear at the same pixels regardless of camera orientation?

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开发者_StackOverflow社区 on the user's screen (occupying the same pixels) regardless of camera orientation. How should I go about doing this?

(I'm using JOGL.)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜