Wednesday, July 6, 2011

Create Text using Function

Just replace the ASCII code character codes with below function =) Simple and more effective!

void placetext(float x, float y, float z, void *font, char *string)
{
    char *c;
    glRasterPos3f(x,y,z);
    for(c=string; *c!='\0'; c++)
    {
        glutBitmapCharacter(font,*c);
    }
}

and replace your codes at display( ) function with;

placetext(0,0,0,GLUT_BITMAP_HELVETICA_18,"Hai Fiza!!");

No comments:

Post a Comment

Question 1: Introduction to Variable

Based on code below, create a dynamic program that solve problem below: Source Code: #include <iostream> using na...