PDA

View Full Version : Displaying Text



BrSchnitz
09-20-2000, 10:59 AM
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. I tried using a second string, but am not exactly sure how to implement it. 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();
}

Olive
09-20-2000, 10:03 PM
What do you exactly mean by "appending" text to a window ? Are you thinking of some sort of automatic scrolling of the text ?