L'exécutable

Le source: CourbeBezier.cpp

#include <windows.h>

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

GLfloat points[4][3] = { 
  {-4.0,-4.0,0.0},{-2.0,4.0,0.0}, 
  { 2.0,-4.0,0.0},{ 4.0,4.0,0.0}}; 

void CALLBACK display(void) { 
  int i; 
  glClear(GL_COLOR_BUFFER_BIT); 
  glColor3f(1.0,1.0,1.0); 
  glBegin(GL_LINE_STRIP); 
  for( i = 0 ; i <= 30 ; i++ ) 
    glEvalCoord1f((GLfloat) i/30.0F); 
  glEnd(); 
  glPointSize(5.0); 
  glColor3f(1.0,1.0,0.0); 
  glBegin(GL_POINTS); 
  for( i = 0 ; i < 4 ; i++ ) 
    glVertex3fv(&points[i][0]); 
  glEnd(); 
  glFlush();
}

void CALLBACK myReshape(int w,int h) {
  glViewport(0,0,w,h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if( w <= h )
    glOrtho(-5.,5.,-5.*(float)h/(float)w,5.*(float)h/(float)w,-5.,5.); 
    else
    glOrtho(-5.*(float)w/(float)h,5.*(float)w/(float)h,-5.,5.,-5.,5.); 
  glMatrixMode(GL_MODELVIEW); 
  glLoadIdentity(); 
} 

void myinit(void) { 
  glClearColor(0.0,0.0,0.0,1.0); 
  glMap1f(GL_MAP1_VERTEX_3,0.0,1.0,3,4,&points[0][0]); 
  glEnable(GL_MAP1_VERTEX_3); 
  glShadeModel(GL_FLAT); 
}

void main(void) {
  auxInitDisplayMode(AUX_SINGLE|AUX_RGB);
  auxInitPosition(0,0,250,250);
  auxInitWindow("Courbe de Bezier");
  myinit();
  auxReshapeFunc(myReshape);
  auxMainLoop(display);
}
 RETOUR