View Full Version : want to draw text in simple 2D with openGL
07-20-2002, 07:35 PM
I am making a simple 2D graphical presentation, which literally includes rectangles and squares as I only have to show stacks and queues. The problem is that I also have to display text and labels and information in the form of strings but dont know how to do it. Either help me or direct towards a webpage from where I can get help. Secondly I want to make simple buttons in openGL, what should I do?
07-21-2002, 04:41 AM
Use wglFontBitmaps (its in MSDN) to generate display lists from a given font. There are examples on the web all over the place. Just do a google for it, or head over to NEHE or another coders site.
Hope this helps.
07-21-2002, 12:13 PM
Have a look at...
07-21-2002, 12:22 PM
The problem is that I am using the glut library. So I cannot use windows dependant code. The link provided here used another library and is for mac, I am using a vc6 as compiler on windows.
07-21-2002, 12:35 PM
I was under the impression that GLUT provided font handling by default? please correct me if I'm wrong GLUT users http://www.opengl.org/discussion_boards/ubb/wink.gif
void glutBitmapCharacter (void *font, int character)
int glutBitmapWidth (GLUTbitmapFont font, int character)
void glutStrokeCharacter (void *font, int character)
int glutStrokeWidth (GLUTstrokeFont font, int character)
Try googling for `glut+font' - there are quite a few pages there but unfortunately, a lot of them are pretty crap.
[This message has been edited by Robbo (edited 07-21-2002).]
07-22-2002, 12:28 AM
I am able to use glutBitmapCharacter function but unable to position the characters on the screen. Secondly I have checked in the glut specs, but these functions only display a character at a time; I on the other hand want to display whole lines of text would I have to do it one character at a time?
07-22-2002, 12:56 AM
Right on the front page of this site there is a link to a Surevey of OpenGL font Technology (http://www.opengl.org/developers/code/features/fontsurvey/index.html) . Read that and try some of the free texture based font libraries. They'll probably work nicely.
07-22-2002, 06:24 AM
Here is how you display text in Glut using the glutBitmapCharacter
char *name="displaying text";
glRasterPos3f(x, y,z); //position your text
for (c=name; *c != '\0'; c++)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.