Solved

glutStrokeCharacter ->Scaling (OpenGL)

Posted on 2004-04-28
1
2,682 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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