Advertisement

Changing text size during program...

Started by November 16, 2001 12:15 PM
5 comments, last by HardSniper 23 years, 3 months ago
Could anyone explain to me how I would change the text size of a font (like the one in NeHe''s 15th tutorial, "Texture Mapped Fonts")? I have tried calling the CreateFont() function later in the program, but it appears that OpenGL doesn''t recognize the call. HardSniper
HardSniper
I have decided to ditch the idea of changing the size of the text, and just move it along the z-axis to make it appear smaller. I have a another question though... When I run the program like that, it won't draw anything but text to the screen... Anyone know why?

HardSniper

Edited by - HardSniper on November 16, 2001 4:21:29 PM
HardSniper
Advertisement
glScalef() {or something similar} will scale any 3d primitive along the x,y & z axis respectively.
Just a stupid question from an absolute newbie: I have the same problem that i can''t resize my fonts using the values in the CreateFont function call. Using glScale does the trick just fine, but i was just curious why changing the x and y value in CreateFont won''t do the trick. Using code based on the code in Nehe tutorial 15.

thnx!
When you put text on the screen do this:
int DrawScene()
{
.....
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(...);
glPrint(....);
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
....
}
lapko
You may also add this lines into glPrint function:

glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(...);
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
lapko
Advertisement
thanks a lot Mishka!

This topic is closed to new replies.

Advertisement