Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
96 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

  Contents

 Introduction
 The Code

 Printable version

 


The Code

void DrawRobot(void)
{
  /*-------------BUST AND HEAD--------------*/
  glPushMatrix();
    glRotatef(bust_angle_y,0,1,0);
    glRotatef(bust_angle_x,1,0,0);
    glPushMatrix();
      glCallList(bust);
      glCallList(head);
    glPopMatrix();

    /*--------RIGHT ARM AND FOREARM---------*/
    glPushMatrix();
      glTranslatef(0,0.25,0);
      glRotatef(right_arm_angle,1,0,0);
      glTranslatef(0,-0.25,0);
      glPushMatrix();
        glCallList(right_arm);
      glPopMatrix();
      
      glPushMatrix();
        glTranslatef(1.25,-0.7,0);
        glRotatef(right_forearm_angle,1,0,0);
        glTranslatef(-1.25,0.7,0);
        glCallList(right_forearm);
      glPopMatrix();
    glPopMatrix();
    
    /*---------LEFT ARM AND FOREARM---------*/
    glPushMatrix();
      glTranslatef(0,0.25,0);
      glRotatef(left_arm_angle,1,0,0);
      glTranslatef(0,-0.25,0);
      glPushMatrix();
        glCallList(left_arm);
      glPopMatrix();

      glPushMatrix();
        glTranslatef(1.25,-0.7,0);
        glRotatef(left_forearm_angle,1,0,0);
        glTranslatef(-1.25,0.7,0);
        glCallList(left_forearm);
      glPopMatrix();
    glPopMatrix();

and so on...

In the main function I added some keys to control the robot. They are:

'1' & 'Q'
'2' & 'W'
'3' & 'E'
'4' & 'R'
'5' & 'T'
'6' & 'Y'
'7' & 'U'
'8' & 'I'
KEY ARROWS
PGUP & PGDOWN    
'V' 'B' 'N' 'M'
right arm control
right forearm control
left arm control
left forearm control
left thigh control
left leg control
right thigh control
right thigh control
rotate model
light control
camera control

And finally here the bin & source.

Happy coding...

Arturo "IRIX" Montieri : montieri@hotmail.com