Sign in to follow this  

Print Text on screen?

This topic is 3315 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

Well, the simplest way to draw text on the screen would be to open a web browser and search Google, or search these very forums, for "OpenGL text rendering." Do this and you will certainly come up with many, many relevant results.

Also, try NeHe:
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=17

Share this post


Link to post
Share on other sites
NeHe lesson 13 is the easiest way to print text on windows + ogl.
Also, bitmap fonts doesn't have to mean "using an external font texture", in the case of lesson 13, the bitmap is generating using the windows function CreateFont, which is the easiest way to do this without using glut or other external libraries.

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=13

Share this post


Link to post
Share on other sites
thanks. but its kind of 3d-text. objects could be over it. is it possible to make a text over everything or maybe using another methods like Labels or whatever.. idk.

Share this post


Link to post
Share on other sites
If you switch to orthographic projection before drawing the text, it will always render on top of 3d-objects.

For more information about what orthographic projection is, check this out: http://en.wikipedia.org/wiki/Orthographic_projection

Switching to ortho mode is very easy in opengl:


glDepthMask(GL_FALSE);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, Width, Height, 0, 0, 1); //Width/Height - the surface size in pixels
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();





Switching back again is just a matter of restoring the previous projection state:

glDepthMask(GL_TRUE);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();



Share this post


Link to post
Share on other sites

This topic is 3315 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this