/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Avril 2001 */
/* Un programme OpenGL tout simple */
/* mais complet */
#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "ModuleCouleurs.h"
#include "ModuleManipulateur.h"
#include "ModuleMenus.h"
void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
manipulateurSouris();
manipulateurClavier();
glBegin(GL_POLYGON) ;
glColor4fv(couleurRouge()) ;
glVertex2f(-0.5F,-0.5F) ;
glColor4fv(couleurVert()) ;
glVertex2f(-0.5F,0.5F) ;
glColor4fv(couleurBlanc()) ;
glVertex2f(0.5F,0.5F) ;
glColor4fv(couleurBleu()) ;
glVertex2f(0.5F,-0.5F) ;
glEnd() ;
glPopMatrix();
glFlush();
glutSwapBuffers();
}
void myinit (void) {
glClearColor (0.0,0.0,0.0,0.0);
glShadeModel(GL_SMOOTH);
}
void reshape(int w, int h) {
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if ( w > h )
glOrtho(-1.0/(float) h*w,1.0/(float) h*w,-1.0,1.0,-10.0,10.0);
else
glOrtho(-1.0,1.0,-1.0/(float) w*h,1.0/(float) w*h,-10.0,10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
setManipulateurDistance(1.0F);
}
int main(int argc,char **argv) {
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGBA|GLUT_DOUBLE);
glutInitWindowSize(300,220);
glutInitWindowPosition(50,50);
glutCreateWindow("Carré coloré");
myinit();
creationMenuBasique();
glutKeyboardFunc(keyBasique);
glutSpecialFunc(specialBasique);
glutMotionFunc(motionBasique);
glutMouseFunc(sourisBasique);
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutMainLoop();
return(0);
}