/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Octobre 2005 */
/* Superclasse de gestion d'objets */
#ifndef OBJET
#define OBJET
class Objet {
public :
Objet(void);
~Objet(void);
void print(char *format);
void dessine(void);
};
#endif
/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Octobre 2005 */
/* Superclasse de gestion d'objets */
#include "ModuleFont.h"
#include "Objet.h"
Objet::Objet(void) {
}
Objet::~Objet(void) {
}
void Objet::dessine(void) {
}
void Objet::print(char *format) {
simpleBitmapOutput(1,REGULAR8x13,"%p",this);
}
/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Octobre 2005 */
/* Classe de gestion de vecteurs */
/* a quatre coordonnees */
#ifndef VECTEUR
#define VECTEUR
#include "Objet.h"
class Vecteur : public Objet {
public :
float x;
float y;
float z;
float t;
public :
Vecteur(void);
Vecteur(float x,float y,float z,float t);
~Vecteur(void);
void print(char *format);
};
#endif
/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Octobre 2005 */
/* Classe de gestion de vecteurs */
/* a quatre coordonnees */
#include "ModuleFont.h"
#include "Vecteur.h"
Vecteur::Vecteur(void) {
this->x = 0.0F;
this->y = 0.0F;
this->z = 0.0F;
this->t = 0.0F;
}
Vecteur::Vecteur(float x,float y,float z,float t) {
this->x = x;
this->y = y;
this->z = z;
this->t = t;
}
Vecteur::~Vecteur(void) {
}
void Vecteur::print(char *format) {
simpleBitmapOutput(1,REGULAR8x13,format,x,y,z);
}
/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Octobre 2005 */
/* Classe de gestion de positions 3D */
/* en coordonnees homogenes */
#ifndef POSITION
#define POSITION
#include "Vecteur.h"
class Position : public Vecteur {
public :
Position(void);
Position(float x,float y,float z);
Position(Position *p);
~Position(void);
float Position::distance(Position *p);
void dessine(void);
};
#endif
/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Octobre 2005 */
/* Classe de gestion de positions 3D */
/* en coordonnees homogenes */
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <math.h>
#include "Position.h"
Position::Position(void) : Vecteur(0.0F,0.0F,0.0F,1.0F) {
}
Position::Position(float x,float y,float z) : Vecteur(x,y,z,1.0F) {
}
Position::Position(Position *p) : Vecteur(p->x,p->y,p->z,1.0F) {
}
Position::~Position(void) {
}
float Position::distance(Position *p) {
float dx = p->x-x;
float dy = p->y-y;
float dz = p->z-z;
return((float) sqrt(dx*dx+dy*dy+dz*dz));
}
void Position::dessine(void) {
glPushMatrix();
glTranslatef(x,y,z);
glutSolidSphere(0.1,36,36);
glPopMatrix();
}
/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Octobre 2005 */
/* Classe de gestion de directions 3D */
/* en coordonnees homogenes */
#ifndef DIRECTION
#define DIRECTION
#include "Position.h"
#include "Vecteur.h"
class Direction : public Vecteur {
public :
Direction(void);
Direction(float x,float y,float z);
Direction(Position *p1,Position *p2);
Direction(Direction *d);
~Direction(void);
float norme(void);
void normalise(void);
float produitScalaire(Direction *d);
void produitVectoriel(Direction *d1,Direction *d2);
int estVecteurNul(void);
int estColineaire(Direction *d);
};
#endif
/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Octobre 2005 */
/* Classe de gestion de directions 3D */
/* en coordonnees homogenes */
#include <math.h>
#include <stdio.h>
#include "ModuleFont.h"
#include "Direction.h"
#include "Position.h"
Direction::Direction(void) : Vecteur(0.0F,0.0F,0.0F,0.0F) {
}
Direction::Direction(float x,float y,float z) : Vecteur(x,y,z,0.0F) {
}
Direction::Direction(Position *p1,Position *p2) : Vecteur(p2->x-p1->x,p2->y-p1->y,p2->z-p1->z,0.0F) {
}
Direction::Direction(Direction *d) : Vecteur(d->x,d->y,d->z,1.0F) {
}
Direction::~Direction(void) {
}
float Direction::norme() {
return((float) pow(pow((double) x,2.0)+pow((double) y,2.0)+pow((double) z,2.0),0.5));
}
void Direction::normalise(void) {
float n = norme();
if ( n != 0 ) {
x /= n;
y /= n;
z /= n; }
}
float Direction::produitScalaire(Direction *d2) {
return(x*d2->x+y*d2->y+z*d2->z);
}
void Direction::produitVectoriel(Direction *d1,Direction *d2) {
Direction *d = new Direction(d1->y*d2->z-d1->z*d2->y,
d1->z*d2->x-d1->x*d2->z,
d1->x*d2->y-d1->y*d2->x);
x = d->x;
y = d->y;
z = d->z;
t = 0.0F;
delete(d);
}
int Direction::estVecteurNul(void) {
if ( fabs(x) > 0.000001F )
return(0);
if ( fabs(y) > 0.000001F )
return(0);
if ( fabs(z) > 0.000001F )
return(0);
return(1);
}
int Direction::estColineaire(Direction *d2) {
Direction *pv = new Direction();
pv->produitVectoriel(d2,this);
if ( fabs(pv->x) > 0.000001F )
return(0);
if ( fabs(pv->y) > 0.000001F )
return(0);
if ( fabs(pv->z) > 0.000001F )
return(0);
return(1);
}
/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Octobre 2005 */
/* Classe de gestion de facettes triangulaires */
#ifndef TRIANGLE
#define TRIANGLE
#include "Position.h"
#include "Direction.h"
#include "Objet.h"
class Triangle : public Objet {
public :
Position *p1;
Position *p2;
Position *p3;
Direction *d1;
Direction *d2;
public :
Triangle(void);
Triangle(Position *p1,Position *p2,Position *p3);
Triangle(Position *p1,Direction *d1,Direction *d2);
~Triangle(void);
Direction *normale(void);
int estParallele(Triangle *t);
void dessine();
};
#endif
/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Octobre 2005 */
/* Classe de gestion de facettes triangulaires */
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "ModuleFleche.h"
#include "Triangle.h"
Triangle::Triangle(void) {
this->p1 = NULL;
this->p2 = NULL;
this->p3 = NULL;
this->d1 = NULL;
this->d2 = NULL;
}
Triangle::Triangle(Position *p1,Position *p2,Position *p3){
this->p1 = p1;
this->p2 = p2;
this->p3 = p3;
this->d1 = new Direction(p1,p2);
this->d2 = new Direction(p1,p3);
}
Triangle::Triangle(Position *p1,Direction *d1,Direction *d2){
this->p1 = p1;
this->d1 = d1;
this->d2 = d2;
this->p2 = new Position(p1->x+d1->x,p1->y+d1->y,p1->z+d1->z);
this->p3 = new Position(p1->x+d2->x,p1->y+d2->y,p1->z+d2->z);
}
Triangle::~Triangle(void){
}
Direction* Triangle::normale(void){
Direction *d = new Direction();
d->produitVectoriel(d1,d2);
d->normalise();
return(d);
}
int Triangle::estParallele(Triangle *t) {
Direction *d = new Direction();
d->produitVectoriel(d1,d2);
{ float ps = d->produitScalaire(t->d1);
if ( fabs(ps) > 0.000001F )
return(0); }
{ float ps = d->produitScalaire(t->d2);
if ( fabs(ps) > 0.000001F )
return(0); }
return(1);
}
void Triangle::dessine() {
p1->dessine();
glPushMatrix();
glTranslatef(p1->x,p1->y,p1->z);
flecheEnVolume(d1->x,d1->y,d1->z,0.1F,0.5F,0.025F);
flecheEnVolume(d2->x,d2->y,d2->z,0.1F,0.5F,0.025F);
Direction *n = normale();
glBegin(GL_POLYGON);
glNormal3f(n->x,n->y,n->z);
glVertex3f(0.0F,0.0F,0.0F);
glVertex3f(d1->x,d1->y,d1->z);
glVertex3f(d2->x,d2->y,d2->z);
glEnd();
glPopMatrix();
}
/* Auteur: Nicolas JANEY */
/* nicolas.janey@univ-fcomte.fr */
/* Octobre 2005 */
/* Calculs mathematiques */
/* sur les vecteurs et les facettes */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "Position.h"
#include "Direction.h"
#include "Triangle.h"
#include "ModuleCouleurs.h"
#include "ModuleManipulateur.h"
#include "ModuleAxes.h"
#include "ModuleFleche.h"
#include "ModuleMenus.h"
#include "ModuleReshape.h"
#include "ModuleFont.h"
static int question = 0;
static int f1 ;
static int f2 ;
static Direction *v1;
static Direction *v2;
static Triangle *t;
static Direction *v11 = new Direction(1.9F,0.0F,0.0F);
static Direction *v21 = new Direction(0.0F,1.8F,0.0F);
static Direction *v12 = new Direction(1.5F,1.0F,1.0F);
static Direction *v22 = new Direction(-1.0F,-1.2F,-1.8F);
static Position *p1 = new Position(-1.3F,1.6F,-1.5F);
static Position *p2 = new Position(1.7F,-1.2F, 1.8F);
static Direction *v = new Direction();
static Direction *n = new Direction();
static Direction *pv = new Direction();
static Triangle *f = new Triangle(new Position(-1.5F,-1.3F,-0.6F),
new Direction(3.0F,-0.2F,3.1F),
new Direction(2.4F,2.8F,0.3F));
static Triangle *t1 = new Triangle(new Position(-1.8F,-0.6F,1.1F),
new Direction(3.0F,-0.2F,3.1F),
new Direction(2.4F,2.8F,0.3F));
static Triangle *t2 = new Triangle(new Position(-1.8F,-0.6F,1.1F),
new Direction(3.0F,-0.2F,3.1F),
new Direction(2.1F,2.3F,1.8F));
void scene1(void) {
glDisable(GL_LIGHTING);
axes();
glEnable(GL_LIGHTING);
glPushMatrix();
glTranslatef(p1->x,p1->y,p1->z);
v = new Direction(p1,p2);
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,couleurVert());
flecheEnVolume(v->x,v->y,v->z,0.1F,0.5F,0.025F);
n = new Direction(p1,p2);
n->normalise();
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,couleurRouge());
flecheEnVolume(n->x,n->y,n->z,0.1F,0.5F,0.04F);
glPopMatrix();
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,couleurJaune());
p1->dessine();
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,couleurBleu());
p2->dessine();
}
void display1() {
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glPushMatrix();
manipulateurSouris();
manipulateurClavier();
scene1();
glPopMatrix();
glFlush();
glutSwapBuffers();
glutPostWindowRedisplay(f2);
int error = glGetError();
if ( error != GL_NO_ERROR )
printf("Attention, erreur OpenGL %d\n",error);
}
void scene2() {
glDisable(GL_LIGHTING);
axes();
glEnable(GL_LIGHTING);
glPushMatrix();
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,couleurVert());
flecheEnVolume(v1->x,v1->y,v1->z,0.1F,0.5F,0.025F);
glPopMatrix();
glPushMatrix();
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,couleurRouge());
flecheEnVolume(v2->x,v2->y,v2->z,0.1F,0.5F,0.025F);
glPopMatrix();
pv->produitVectoriel(v1,v2);
glPushMatrix();
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,couleurJaune());
flecheEnVolume(pv->x,pv->y,pv->z,0.1F,0.5F,0.025F);
glPopMatrix();
}
void display2() {
v1 = v11;
v2 = v21;
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glPushMatrix();
manipulateurSouris();
manipulateurClavier();
scene2();
glPopMatrix();
glFlush();
glutSwapBuffers();
glutPostWindowRedisplay(f2);
int error = glGetError();
if ( error != GL_NO_ERROR )
printf("Attention, erreur OpenGL %d\n",error);
}
void display3() {
v1 = v12;
v2 = v22;
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glPushMatrix();
manipulateurSouris();
manipulateurClavier();
scene2();
glPopMatrix();
glFlush();
glutSwapBuffers();
glutPostWindowRedisplay(f2);
int error = glGetError();
if ( error != GL_NO_ERROR )
printf("Attention, erreur OpenGL %d\n",error);
}
void scene4(void) {
glDisable(GL_LIGHTING);
axes();
glEnable(GL_LIGHTING);
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,couleurBleu());
f->p1->dessine();
glPushMatrix();
glTranslatef(f->p1->x,f->p1->y,f->p1->z);
flecheEnVolume(f->d1->x,f->d1->y,f->d1->z,0.1F,0.5F,0.025F);
flecheEnVolume(f->d2->x,f->d2->y,f->d2->z,0.1F,0.5F,0.025F);
glPopMatrix();
n = f->normale();
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,couleurBlanc());
glPushMatrix();
glTranslatef(f->p1->x+(f->d1->x+f->d2->x)/3.0F,
f->p1->y+(f->d1->y+f->d2->y)/3.0F,
f->p1->z+(f->d1->z+f->d2->z)/3.0F);
flecheEnVolume(n->x,n->y,n->z,0.1F,0.5F,0.025F);
glPopMatrix();
glPushMatrix();
glMaterialfv(GL_FRONT,GL_DIFFUSE,couleurRouge(0.5F));
glMaterialfv(GL_BACK,GL_DIFFUSE,couleurVert(0.5F));
glTranslatef(f->p1->x,f->p1->y,f->p1->z);
glBegin(GL_POLYGON);
glNormal3f(n->x,n->y,n->z);
glVertex3f(0.0F,0.0F,0.0F);
glVertex3f(f->d1->x,f->d1->y,f->d1->z);
glVertex3f(f->d2->x,f->d2->y,f->d2->z);
glEnd();
glPopMatrix();
}
void display4() {
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glPushMatrix();
manipulateurSouris();
manipulateurClavier();
scene4();
glPopMatrix();
glFlush();
glutSwapBuffers();
glutPostWindowRedisplay(f2);
int error = glGetError();
if ( error != GL_NO_ERROR )
printf("Attention, erreur OpenGL %d\n",error);
}
void scene5(void) {
glDisable(GL_LIGHTING);
axes();
glEnable(GL_LIGHTING);
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,couleurRouge(0.5F));
f->dessine();
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,couleurBleu(0.5F));
t->dessine();
}
void display5() {
t = t1;
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glPushMatrix();
manipulateurSouris();
manipulateurClavier();
scene5();
glPopMatrix();
glFlush();
glutSwapBuffers();
glutPostWindowRedisplay(f2);
int error = glGetError();
if ( error != GL_NO_ERROR )
printf("Attention, erreur OpenGL %d\n",error);
}
void display6() {
t = t2;
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glPushMatrix();
manipulateurSouris();
manipulateurClavier();
scene5();
glPopMatrix();
glFlush();
glutSwapBuffers();
glutPostWindowRedisplay(f2);
int error = glGetError();
if ( error != GL_NO_ERROR )
printf("Attention, erreur OpenGL %d\n",error);
}
void displayV1(void) {
glClearColor(0.0F,0.0F,0.0F,1.0F) ;
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glPushMatrix();
float pos = 1.0F;
glColor4fv(couleurJaune());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
p1->print("P1 : %8.4f %8.4f %8.4f");
pos += 1.0F;
glColor4fv(couleurBleu());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
p2->print("P2 : %8.4f %8.4f %8.4f");
pos += 1.0F;
glColor4fv(couleurVert());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
v->print("V : %8.4f %8.4f %8.4f");
pos += 1.0F;
glColor4fv(couleurBlanc());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
simpleBitmapOutput(1,REGULAR8x13,"NORME : %8.4f",v->norme());
pos += 1.0F;
glColor4fv(couleurRouge());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
n->print("N : %8.4f %8.4f %8.4f");
glPopMatrix();
glFlush();
glutSwapBuffers();
}
void displayV2(void) {
glClearColor(0.0F,0.0F,0.0F,1.0F) ;
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glPushMatrix();
float pos = 1.0F;
glColor4fv(couleurVert());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
v1->print("V1 : %8.4f %8.4f %8.4f");
pos += 1.0F;
glColor4fv(couleurRouge());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
v2->print("V2 : %8.4f %8.4f %8.4f");
pos += 1.0F;
glColor4fv(couleurBlanc());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
simpleBitmapOutput(1,REGULAR8x13,"V1.V2 : %8.4f",v1->produitScalaire(v2));
pos += 1.0F;
glColor4fv(couleurJaune());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
pv->print("V1^V2 : %8.4f %8.4f %8.4f");
glPopMatrix();
glFlush();
glutSwapBuffers();
}
void displayV4(void) {
glClearColor(0.0F,0.0F,0.0F,1.0F) ;
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glPushMatrix();
float pos = 1.0F;
glColor4fv(couleurBleu());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
f->p1->print("P : %8.4f %8.4f %8.4f");
pos += 1.0F;
glColor4fv(couleurRouge());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
f->d1->print("D1 : %8.4f %8.4f %8.4f");
pos += 1.0F;
glColor4fv(couleurRouge());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
f->d2->print("D2 : %8.4f %8.4f %8.4f");
pos += 1.0F;
glColor4fv(couleurBlanc());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
n->print("N : %8.4f %8.4f %8.4f");
glPopMatrix();
glFlush();
glutSwapBuffers();
}
void displayV5(void) {
glClearColor(0.0F,0.0F,0.0F,1.0F) ;
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glPushMatrix();
float pos = 1.0F;
glColor4fv(couleurRouge());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
f->p1->print("F1 P : %8.4f %8.4f %8.4f");
pos += 1.0F;
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
f->d1->print("F1 D1 : %8.4f %8.4f %8.4f");
pos += 1.0F;
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
f->d2->print("F1 D2 : %8.4f %8.4f %8.4f");
pos += 1.0F;
glColor4fv(couleurBleu());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
t->p1->print("F2 P : %8.4f %8.4f %8.4f");
pos += 1.0F;
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
t->d1->print("F2 D1 : %8.4f %8.4f %8.4f");
pos += 1.0F;
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
t->d2->print("F2 D2 : %8.4f %8.4f %8.4f");
pos += 1.0F;
glColor4fv(couleurBlanc());
placeFontCursor(5.0F,-pos*20.0F,0.0F) ;
if ( f->estParallele(t) )
simpleBitmapOutput(1,REGULAR8x13,"FACETTES PARALLELES");
else
simpleBitmapOutput(1,REGULAR8x13,"FACETTES NON PARALLELES");
glPopMatrix();
glFlush();
glutSwapBuffers();
}
void special(int key,int x,int y) {
if ( specialManipulateur(key,x,y) ) {
glutPostWindowRedisplay(f1); }
}
void key(unsigned char k,int x,int y) {
if ( keyManipulateur(k,x,y) )
glutPostWindowRedisplay(f1);
else
switch ( k ) {
case 0x0D : { question = (question+1)%6;
int win = glutGetWindow();
switch ( question ) {
case 0 : glutSetWindow(f1);
glutDisplayFunc(display1);
glutSetWindow(f2);
glutReshapeWindow(370,110);
glutDisplayFunc(displayV1);
break;
case 1 : glutSetWindow(f1);
glutDisplayFunc(display2);
glutSetWindow(f2);
glutReshapeWindow(370,90);
glutDisplayFunc(displayV2);
break;
case 2 : glutSetWindow(f1);
glutDisplayFunc(display3);
glutSetWindow(f2);
glutReshapeWindow(370,90);
glutDisplayFunc(displayV2);
break;
case 3 : glutSetWindow(f1);
glutDisplayFunc(display4);
glutSetWindow(f2);
glutReshapeWindow(370,90);
glutDisplayFunc(displayV4);
break;
case 4 : glutSetWindow(f1);
glutDisplayFunc(display5);
glutSetWindow(f2);
glutReshapeWindow(370,150);
glutDisplayFunc(displayV5);
break;
case 5 : glutSetWindow(f1);
glutDisplayFunc(display6);
glutSetWindow(f2);
glutReshapeWindow(370,150);
glutDisplayFunc(displayV5);
break; }
glutSetWindow(win);
glutPostWindowRedisplay(f1); }
break ; }
}
void myInit() {
glEnable(GL_AUTO_NORMAL);
glEnable(GL_NORMALIZE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHT0);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,1);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glClearColor(0.5F,0.5F,0.5F,1.0F);
}
void reshapeV(int w,int h) {
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,w,-h,0,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int main(int argc,char **argv) {
glutInit(&argc,argv);
glutInitWindowSize(270,270);
glutInitWindowPosition(50,50);
glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE);
f1 = glutCreateWindow("Mathematiques de l'infographie");
myInit();
creationMenuBasique();
setParametresOrthoBasique(-2.5,2.5,-2.5,2.5,-50.0,50.0);
setManipulateurDistance(1.0F);
setManipulateurSourisAngle(10.0F,-20.0F,0.0F);
glutReshapeFunc(reshapeOrthoBasique);
glutMotionFunc(motionBasique);
glutMouseFunc(sourisBasique);
glutKeyboardFunc(key);
glutDisplayFunc(display1);
glutSpecialFunc(special);
glutInitWindowSize(370,110);
glutInitWindowPosition(60,360);
glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_DOUBLE);
f2 = glutCreateWindow("Valeurs");
creationMenuBasique();
glutDisplayFunc(displayV1);
glutReshapeFunc(reshapeV);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutMainLoop();
return(0);
}