Print Text on screen?

Started by
4 comments, last by cmv 15 years, 5 months ago
i was just wondering how to draw text on the screen? the simplest way..
Rakion Hacks, Downloads, videos and more!http://gplaces.net/spec/rakion.php
Advertisement
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
leason 17.. didnt got that far yet XD
and i was asking for a simple 2D text on the screen without any bitmap or anything else..

any ideas any1?
Rakion Hacks, Downloads, videos and more!http://gplaces.net/spec/rakion.php
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
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.
Rakion Hacks, Downloads, videos and more!http://gplaces.net/spec/rakion.php
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 pixelsglMatrixMode(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();

This topic is closed to new replies.

Advertisement