L'exécutable

Le source: MaillageBezier.cpp

#include <windows.h>

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

GLfloat pts[4][4][3] = { 
  { {-1.5,-1.5,4.0},{-0.5,-1.5,2.0}, 
    {0.5,-1.5,-1.0},{1.5,-1.5,2.0} }, 
  { {-1.5,-0.5,1.0},{-0.5,-0.5,3.0}, 
    {0.5,-0.5,0.0},{1.5,-0.5,-1.0} }, 
  { {-1.5,0.5,4.0},{-0.5,0.5,0.0}, 
    {0.5,0.5,3.0},{1.5,0.5,4.0} }, 
  { {-1.5,1.5,-2.0},{-0.5,1.5,-2.0}, 
    {0.5,1.5,0.0},{1.5,1.5,-1.0} } }; 
  
void CALLBACK display(void) { 
  int i,j; 
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 
  glColor3f(1.0F,1.0F,1.0F); 
  glPushMatrix(); 
  glRotatef(85.0F,1.0F,1.0F,1.0F); 
  for( j = 0 ; j <= 8 ; j++ ) { 
    glBegin(GL_LINE_STRIP); 
    for( i = 0 ; i <= 30 ; i++ ) 
      glEvalCoord2f((float)i/30.0F,(float)j/8.0F); 
    glEnd(); 
    glBegin(GL_LINE_STRIP); 
    for(i = 0; i <= 30; i++) 
      glEvalCoord2f((float)j/8.0F,(float)i/30.0F); 
    glEnd(); } 
  glPopMatrix(); 
  glFlush(); 
} 
  
void myinit(void) { 
  glClearColor(0.0,0.0,0.0,1.0); 
  glMap2f(GL_MAP2_VERTEX_3,0,1,3,4,0,1,12,4,&pts[0][0][0]); 
  glEnable(GL_MAP2_VERTEX_3); 
  glMapGrid2f(20,0.0,1.0,20,0.0,1.0); 
  glEnable(GL_DEPTH_TEST); 
  glShadeModel(GL_FLAT); 
} 
  
void CALLBACK myReshape(int w,int h) { 
  glViewport(0,0,w,h); 
  glMatrixMode(GL_PROJECTION); 
  glLoadIdentity(); 
  if ( w <= h ) 
    glOrtho(-3.2,3.2,-3.2*(float)h/(float)w,3.2*(float)h/(float)w,-4.0,4.0); 
    else 
    glOrtho(-3.2*(float)w/(float)h,3.2*(float)w/(float)h,-3.2,3.2,-4.0,4.0); 
  glMatrixMode(GL_MODELVIEW); 
  glLoadIdentity(); 
}

void main(void) { 
  auxInitDisplayMode(AUX_SINGLE|AUX_RGB|AUX_DEPTH);
  auxInitPosition(0,0,300,230); 
  auxInitWindow("Maillage de Bézier"); 
  myinit(); 
  auxReshapeFunc(myReshape); 
  auxMainLoop(display); 
}
 RETOUR