L'exécutable

Le source: BrasRobot.cpp

#include <windows.h>

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glaux.h>

#include <stdio.h>
#include <stdlib.h>

static int shoulder = 0, elbow = 0; 
  
void CALLBACK elbowAdd(void) { 
  elbow = (elbow + 5) % 360; 
} 
  
void CALLBACK elbowSubtract(void) { 
  elbow = (elbow - 5) % 360; 
} 
  
void CALLBACK shoulderAdd(void) { 
  shoulder = (shoulder + 5) % 360; 
} 
  
void CALLBACK shoulderSubtract(void) { 
  shoulder = (shoulder - 5) % 360; 
} 
  
void CALLBACK display(void) { 
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(0.0F,0.0F,0.0F);
  glPushMatrix(); 
  glTranslatef(-1.0,0.0,0.0); 
  glRotatef((GLfloat) shoulder,0.0,0.0,1.0); 
  glTranslatef(1.0,0.0,0.0); 
  auxWireBox(2.0,0.4,1.0); 
  glTranslatef(1.0,0.0,0.0); 
  glRotatef((GLfloat) elbow,0.0,0.0,1.0); 
  glTranslatef(1.0,0.0,0.0); 
  auxWireBox(2.0,0.4,1.0); 
  glPopMatrix(); 
  glFlush();
  auxSwapBuffers();
} 
  
void myinit(void) { 
  glClearColor(1.0,1.0,1.0,1.0);
} 
  
void CALLBACK myReshape(int w,int h) { 
  glViewport(0,0,w,h); 
  glMatrixMode(GL_PROJECTION); 
  glLoadIdentity(); 
  gluPerspective(65.,(float)w/(float)h,1.0,20.0); 
  glMatrixMode(GL_MODELVIEW); 
  glLoadIdentity(); 
  glTranslatef(0.0,0.0,-5.0); 
}

void main(void) { 
  auxInitDisplayMode(AUX_DOUBLE|AUX_RGB); 
  auxInitPosition(0,0,300,300);
  auxInitWindow("Bras robot");
  myinit();
  auxKeyFunc(AUX_LEFT,shoulderSubtract);
  auxKeyFunc(AUX_RIGHT,shoulderAdd);
  auxKeyFunc(AUX_UP,elbowAdd);
  auxKeyFunc(AUX_DOWN,elbowSubtract);
  auxReshapeFunc(myReshape);
  auxMainLoop(display); 
}
 RETOUR