[CSC 315] Project 3 Hello World Text

Andrew J. Pounds pounds_aj at mercer.edu
Tue Dec 13 07:35:52 EST 2016


On 12/12/2016 11:18 PM, wrote:
>
> Dr. Pounds,
>
>
> I was wondering what you wanted us to use to write the text on roof 
> our houses. I have been trying to use glutBitmapCharacter, but have 
> been using problems placing the text.
>
>
>

For doing the lettering on the house to you have to use Stroke Fonts 
that you can manipulate with transformations inside your scene.   I 
thought I included examples of how to do this in the code I gave you 
that drew and labelled the axes. Here is some of my ancient code that 
used stroke fonts.  Feel free to use whatever you want from it.


Note how I push a matrix, position the text, draw the text, and then pop 
the matrix.


void drawParticleAnnotation()
{

     int i, len;
     char message1[] = "Fermion";
     char message2[] = "Interaction";

     void *font = GLUT_STROKE_ROMAN;

     glPushMatrix();
     glColor3f(1.0,0.0,0.0);
     glTranslatef(.5, 0.5, 1.6);
     glRotatef(135.0, 1.0, 0.0, 0.0);
     glRotatef(180.0, 0.0, 1.0, 0.0);
     glScalef(0.003,0.003,0.003);
     len = (int) strlen(message1);
     for (i = 0; i < len; i++) {
         glutStrokeCharacter(font, message1[i]);
     }
     glPopMatrix();


     glPushMatrix();
     glColor3f(1.0,0.0,0.0);
     glTranslatef(.5, 0.8, 1.25);
     glRotatef(135.0, 1.0, 0.0, 0.0);
     glRotatef(180.0, 0.0, 1.0, 0.0);
     glScalef(0.003,0.003,0.003);
     len = (int) strlen(message2);
     for (i = 0; i < len; i++) {
         glutStrokeCharacter(font, message2[i]);
     }
     glPopMatrix();
}


-- 
Andrew J. Pounds, Ph.D.  (pounds_aj at mercer.edu)
Professor of Chemistry and Computer Science
Mercer University,  Macon, GA 31207   (478) 301-5627
http://faculty.mercer.edu/pounds_aj

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://theochem.mercer.edu/pipermail/csc315/attachments/20161213/91f89c50/attachment.html>


More information about the csc315 mailing list