PDA

View Full Version : TEXT?



RedZen
07-17-2001, 01:35 AM
I am pretty emarrased to say, that I can't get text to be displayed properly in my app. I have a little first person walkaround. Everything works fine thus far, but the damn text. It gets displayed, but it's static and does not remain on screen. I rendered it whilst I was in gluPerspective, which killed the frames per second like nothing. OK I know I'm supposed to do it in glOrtho, but how do I switch to Ortho and then back to Perspective again? I tried a lot of things, and my text ends up correctly, but my whole 3D world is skewed and squished. It's really anoying, and I can't seem to get it right. Can someone help me pleeze.

07-17-2001, 03:22 AM
The GLUT source distribution has a lot of examples.

chennes
07-17-2001, 04:01 AM
Couple things:

To switch from perspective to ortho:
glPushMatrix();
glLoadIdentity();
glOrtho(yadda, yadda);
//Draw text here
glPopMatrix();

Secondly - adding text is probably still going to kill your fps - there really isn't a really good, fast way of doing it: bitmaps are OK, but still not exactly blazing on most middle-of-the-road consumer cards. Not to mention the fact that last I checked, doing it in perspective in no slower than doing it in ortho - I think your problem is that your translations/rotations affect your text, and you don't want them to. The above code will fix that.

Chris

Michael Steinberg
07-17-2001, 10:20 AM
I can put the whole screen full with characters and it doesn't kill the performance too much? Are you using the pixel stuff from opengl or actually using textured quads?

RedZen
07-17-2001, 10:44 PM
I'm using a font library with windows fonts.
I sat last night for 5 hours trying to get it to work and I got it to, but it still kills the fps, damnit. So how does the professional people add text to the scene then? O yeah, I'm running a GeForce 2 btw, so I don't think it's the card.

[This message has been edited by RedZen (edited 07-18-2001).]

harsman
07-18-2001, 03:53 AM
Use screen aligned textured quad, that should be fast. There's some stuff on this in the FAQ.

RedZen
07-18-2001, 03:56 AM
Thanks dude.