L'exécutable

Le source: TerreLune.cpp

#include <windows.h>

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

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

static int year = 0, day = 0; 

void CALLBACK dayAdd(void) { 
  day = (day + 10) % 360; 
}

void CALLBACK daySubtract(void) { 
  day = (day - 10) % 360; 
}

void CALLBACK yearAdd(void) { 
  year = (year + 5) % 360; 
}

void CALLBACK yearSubtract(void) { 
  year = (year - 5) % 360; 
}

void CALLBACK display(void) { 
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(0.0F,0.0F,0.0F);
  glPushMatrix(); 
  auxWireSphere(1.0); 
  glRotatef((GLfloat) year,0.0,1.0,0.0); 
  glTranslatef(2.0,0.0,0.0); 
  glRotatef((GLfloat) day,0.0,1.0,0.0); 
  auxWireSphere(0.2); 
  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(36.0,(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,200);
  auxInitWindow("Système Terre-Lune");
  myinit();
  auxKeyFunc(AUX_LEFT,yearSubtract);
  auxKeyFunc(AUX_RIGHT,yearAdd);
  auxKeyFunc(AUX_UP,dayAdd);
  auxKeyFunc(AUX_DOWN,daySubtract);
  auxReshapeFunc(myReshape);
  auxMainLoop(display);
}
 RETOUR