GLUT and text
Are there any GLUT functions to print text on screen? Just simple bitmap fonts etc?
Thanx
--Ched--
chris@ched45.com
--Ched--chris@ched45.com
Try this:
GLvoid *fontStyle = GLUT_BITMAP_TIMES_ROMAN_10;
void DrawGLUTString(GLuint x, GLuint y, char *text)
{
char *s;
// Move to the required raster position that you want text to appear
glRasterPos2i(x, y);
// Display each character from string - you can only do one at a time
for (s = text; *s; s++)
glutBitmapCharacter(fontStyle, *s);
}
Obviously, you''ll have to set fontStyle to whatever you need (take a look at the glut header file ''glut.h'')
Also, this would be better improved by passing stdarg params instead of a straight ''char *text''. This would then allow you to pass parameters as you would to printf() - do a lookup on the va_start/vsprintf/va_end functions.
--Andy
http://opengl.koolhost.com
Example program 9 on my site does this if you''re too lazy to cut and paste out of IE
Paul Groves
pauls opengl page
paul's opengl message board
Paul Groves
pauls opengl page
paul's opengl message board
Paul Grovespauls opengl page
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement