Solved

glutStrokeCharacter ->Scaling (OpenGL)

Posted on 2004-04-28
1
2,710 Views
Last Modified: 2013-12-26
How do I scale a glutStrokeCharacter? I'm at a depth of about -20F....and if possible, how can I rotate the text 45 degrees?
0
Comment
Question by:rossryan
1 Comment
 
LVL 2

Accepted Solution

by:
enkimute earned 500 total points
ID: 10970660
you can use glTranslatef, glScalef and glRotatef to move, size or rotate the text.
You can even simply turn on antialiasing by using smooth lines and blending.

Haven't tested it, but all together should look something like :

x and y are offsets to the current raster position.
scale should be 1 for normal scale, higher for bigger letters, lower for smaller letters.
orientation is the nr of degrees rotated around the z axis. (0 aligns the text with the x axis)
Antialias is the strength of the letters. use 0.0 for no antialiasing.
*text points to a zero terminated string.

void output(GLfloat x, GLfloat y, GLfloat scale, GLfloat orientation, GLfloat antialias, char *text)
{
    char *p;
   
    glPushMatrix();
    glTranslatef(x, y, 0);
    glRotatef(orientation,0,0,1);
    glScalef(scale,scale,scale);

    if (antialias != 0)
    {
       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
       glEnable(GL_BLEND);
       glEnable(GL_LINE_SMOOTH);
       glLineWidth(antialias);   // 2.0 gives good results.
    }

    for (p = text; *p; p++)
        glutStrokeCharacter(GLUT_STROKE_ROMAN, *p);

    if (antialias != 0)
    {
       glDisable(GL_BLEND);
       glDisable(GL_LINE_SMOOTH);
    }

    glPopMatrix();
}
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now