-
Displaying Multiple Lines of Text
I'm trying to modify a program so that it will display multiple lines of text. Is there any way to append to an active OpenGL window, or can you only overwrite?
Also, is it possible to merge two windows (so that the text in one window is then displayed along with text in another window)?
This is what I have so far. Thanks in advance.
static char *stringb = "I punch OpenGL in the face.";
void init1(void) {
texfntinit("Times-Italic.bw");
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.,1.,.1,10.);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(-1.45,1.35,-1.5);
}
void display1(void) {
float width = texstrwidth(string);
glClear(GL_COLOR_BUFFER_BIT);
/* glPushMatrix();*/
glScalef(scale,scale,0.);
texfntstroke(string, 0.f, 0.f);
glutSwapBuffers();
}
int main(int argc, char** argv) {
if (argc > 1) string = argv[1];
glutInit(&argc, argv);
glutInitWindowSize(1280, 1024);
glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE);
(void)glutCreateWindow("textext");
init1();
glutDisplayFunc(display1);
glutMainLoop();
}
-
Advanced Member
Frequent Contributor
Re: Displaying Multiple Lines of Text
Not quite sure what you're doing (i read too fast...)
When I'm drawing raster fonts on the screen, I tend to do this.
Set up a perspective projection
Draw my 3d world
set up an orthographic projection
draw fonts.
If you need multiple lines, draw multiple lines?! Sometimes I limit the size of the opengl viewport for my 3d stuff, and whack the text in a bit that doesnt have any stuff drawn to it.
In terms of getting a new window, use glut to create and initialise a new window and put fonts in it.?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules