L'exécutable

 

Le source: EliminationPartiesCachees.cpp

#include <windows.h>

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

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

static int mode = 0 ;
static float rotx = 0.0f ;
static float roty = 0.0f ;
static float rotz = 0.0f ;

void CALLBACK display(void) {
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
  glPushMatrix();
  glRotatef(rotx,1.0f,0.0f,0.0f);
  glRotatef(roty,0.0f,1.0f,0.0f);
  glRotatef(rotz,0.0f,0.0f,1.0f);
  if ( mode )
    glEnable(GL_DEPTH_TEST) ;
  glBegin(GL_TRIANGLES) ;
  glColor3f(0.0F,0.0F,1.0F) ;
  glVertex3f(1.0F,-1.5F,-0.5F) ;
  glVertex3f(1.5F,1.5F,0.5F) ;
  glVertex3f(-1.1F,-0.2F,0.2F) ;
  glColor3f(0.0F,1.0F,0.0F) ;
  glVertex3f(-1.0F,-1.5F,-0.5F) ;
  glVertex3f(-1.5F,1.5F,0.5F) ;
  glVertex3f(0.5F,-0.5F,0.2F) ;
  glColor3f(1.0F,0.0F,0.0F) ;
  glVertex3f(-1.2F,1.3F,-0.5F) ;
  glVertex3f(1.2F,1.1F,0.5F) ;
  glVertex3f(0.1F,-0.5F,0.3F) ;
  glEnd() ;
  glDisable(GL_DEPTH_TEST) ;
  glPopMatrix();
  glFlush();
  auxSwapBuffers();
}

void myinit (void) {
  glShadeModel(GL_SMOOTH);
  glClearColor(0.0,0.0,0.0,0.0);
}

void CALLBACK myReshape(int w, int h) {
  glViewport(0,0,w,h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(-2.0,2.0,-2.0/w*h,2.0/w*h,-5.0,5.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
}

void CALLBACK auxSpace(void) {
  mode = 1 - mode ;
}

void CALLBACK auxX(void) {
  rotx += 2 ;
}

void CALLBACK auxx(void) {
  rotx -= 2 ;
}

void CALLBACK auxY(void) {
  roty += 2 ;
}

void CALLBACK auxy(void) {
  roty -= 2 ;
}

void CALLBACK auxZ(void) {
  rotz += 2 ;
}

void CALLBACK auxz(void) {
  rotz -= 2 ;
}

void main(void) {
  auxInitDisplayMode(AUX_DOUBLE|AUX_RGBA|AUX_DEPTH);
  auxInitPosition (0,0,280,280);
  auxInitWindow("Elimination des parties cachées") ;
  myinit();
  auxKeyFunc(AUX_SPACE,auxSpace) ;
  auxKeyFunc(AUX_X,auxX) ;
  auxKeyFunc(AUX_x,auxx) ;
  auxKeyFunc(AUX_Y,auxY) ;
  auxKeyFunc(AUX_y,auxy) ;
  auxKeyFunc(AUX_Z,auxZ) ;
  auxKeyFunc(AUX_z,auxz) ;
  auxReshapeFunc(myReshape);
  auxMainLoop(display);
}
 RETOUR