Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Scaling text using this code?

  1. #1
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    2

    Scaling text using this code?

    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.

  2. #2
    Member Regular Contributor
    Join Date
    Dec 2007
    Posts
    258

    Re: Scaling text using this code?


  3. #3
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    2

    Re: Scaling text using this code?

    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.

  4. #4
    Member Regular Contributor
    Join Date
    Dec 2007
    Posts
    258

    Re: Scaling text using this code?

    if glutbitmap uses glBitmap to draw you might be out of luck .. Maybe you can just choose a larger font

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •