View Full Version : Writing text to an opengl window
07-06-2001, 08:19 AM
I have a msvc++ dialog appl. running opengl.
What I want to do is simply write text to the display area, using varying font sizes, etc. using x, y coordinates. Or in other words given a x, y value place a character(s)beginning at that value...
07-06-2001, 01:03 PM
If you use glut, you have the function glutBitmapCharacter(FONT_TYPE, c) which will draw the character "c". There are different kind of font types implemented in glut, you could easily find them.
If you want to put your text at a specific position, you should use glRasterPos2f(x,y).
Here is an example:
glRasterPos2f(20,450); //position of text
for (int i = 0; i < strlen (s); i++)
glutBitmapCharacter (GLUT_BITMAP_HELVETICA_18, s[i]);
07-08-2001, 08:37 AM
I found bitmap character text to be very slow - check out the NeHe tutorial on using texture quads to display text quickly (nehe.gamedev.net)
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.