PDA

View Full Version : Scaling text using this code?



Squirrelman
05-03-2011, 08:59 AM
Hello, I know there's probably a ton of topics on using text already but I was hoping to find out how to scale text using the method I was taught in class. The only drawback that I've read is that our method might not scale very well. Here is my code, although the scaling does nothing atm.


void Write(float X, float Y, char *String)
{
int Length;

void *font = GLUT_BITMAP_9_BY_15;
void *fonts[] =
{
GLUT_BITMAP_9_BY_15,
GLUT_BITMAP_8_BY_13,
GLUT_BITMAP_TIMES_ROMAN_10,
GLUT_BITMAP_TIMES_ROMAN_24
};

glRasterPos2f(X, Y);
Length = (int) strlen(String);
for (int i = 0; i < Length; i++)
{
glutBitmapCharacter(font, String[i]);
}
}

//This is from a draw function, I removed the irrelevant stuff
glPushMatrix();
glTranslatef(220, 150, 0.0);
glScalef(10, 10, 1);
glColor3f(0.392, 0.694, 1.0);
Write(0, 0, "Super Pacman V1.0");
glPopMatrix();

glFlush();

glutSwapBuffers();


Thanks in advance for any help.

dukey
05-03-2011, 09:03 AM
http://www.opengl.org/sdk/docs/man/xhtml/glPixelZoom.xml

Squirrelman
05-03-2011, 09:44 PM
I tried glPixelZoom and did some research on it but all I'm coming up with are things that says it doesn't work with bitmap text, it looks like I'll have to figure out how to do stroke text since the coding looks very similar to bitmap text and it can be scaled. thanks again.

dukey
05-04-2011, 04:23 AM
if glutbitmap uses glBitmap to draw you might be out of luck .. Maybe you can just choose a larger font