/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Avril 2001 */
/* Dessin OpenGL d'une courbe de Bezier */
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "ModuleCouleurs.h"
#include "ModuleManipulateur.h"
#include "ModuleMenus.h"
#include "ModuleReshape.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 display(void) {
int i;
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glPushMatrix();
manipulateurSouris();
manipulateurClavier();
glColor4fv(couleurBlanc());
glBegin(GL_LINE_STRIP);
for( i = 0 ; i <= 30 ; i++ )
glEvalCoord1f((GLfloat) i/30.0F);
glEnd();
glPointSize(5.0);
glColor4fv(couleurJaune());
glBegin(GL_POINTS);
for( i = 0 ; i < 4 ; i++ )
glVertex3fv(&points[i][0]);
glEnd();
glPopMatrix();
glFlush();
glutSwapBuffers();
}
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);
glEnable(GL_AUTO_NORMAL);
glEnable(GL_NORMALIZE);
}
int main(int argc,char **argv) {
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE);
glutInitWindowSize(250,250);
glutInitWindowPosition(50,50);
glutCreateWindow("Courbe de Bezier");
myinit();
creationMenuBasique();
setParametresOrthoBasique(-5.0,5.0,-5.0,5.0,-500.0,500.0);
setManipulateurDistance(1.0F);
glutReshapeFunc(reshapeOrthoBasique);
glutKeyboardFunc(keyBasique);
glutSpecialFunc(specialBasique);
glutMotionFunc(motionBasique);
glutMouseFunc(sourisBasique);
glutDisplayFunc(display);
glutMainLoop();
return(0);
}