#1 Le 14/02/2018, à 20:57
- Aureole
OpenGl erreurs lors de la compilation
Salut tout le monde, je voudrais installer openGL sur mon ordi portable sur Ubuntu afin de pouvoir faire mes travaux pratiques de mon cours d'infographie sur mon portable et le cours utilise openGL, mais je suis bloqué lorsque je dois faire la commande make du makefile, ça me donne des erreurs pour tous les méthodes de glm.
Voici le fichier makefile
CONTEXT=sdl2
ifeq "$(shell uname)" "Darwin"
CONTEXT=glfw3
LDFLAGS += -lobjc -framework Foundation -framework OpenGL -framework Cocoa
endif
CXXFLAGS += -g -W -Wall -Wno-unused-parameter -Wno-deprecated-declarations
CXXFLAGS += $(shell pkg-config --cflags glew)
CXXFLAGS += $(shell pkg-config --cflags $(CONTEXT))
LDFLAGS += -g
LDFLAGS += $(shell pkg-config --libs glew)
LDFLAGS += $(shell pkg-config --libs $(CONTEXT))
TP="tp2"
SRC=main
exe : $(SRC).exe
run : exe
./$(SRC).exe
$(SRC).exe : $(SRC).cpp *.h
$(CXX) $(CXXFLAGS) -o$@ $(SRC).cpp $(LDFLAGS)
sol : ; make SRC=$(SRC)Solution exe
runs : ; make SRC=$(SRC)Solution run
clean :
rm -rf *.o *.exe *.exe.dSYM
remise zip :
make clean
rm -f INF2705_remise_$(TP).zip
zip -r INF2705_remise_$(TP).zip *.cpp *.h *.glsl makefile *.txt
Voici le fichier main.cpp
// Prénoms, noms et matricule des membres de l'équipe:
// - Gabriel Cote-Jones (1771119)
// - Hon-Leung Eric Chao (1827022)
#warning "Écrire les prénoms, noms et matricule des membres de l'équipe dans le fichier et commenter cette ligne"
#include <stdlib.h>
#include <iostream>
#include "inf2705-matrice.h"
#include "inf2705-nuanceur.h"
#include "inf2705-fenetre.h"
#include "inf2705-forme.h"
#include <glm/gtx/io.hpp>
#include <vector>
#define SOMMETS 0
#define CONNECTI 1
// variables pour l'utilisation des nuanceurs
GLuint prog; // votre programme de nuanceurs
GLint locVertex = -1;
GLint locColor = -1;
GLint locmatrModel = -1;
GLint locmatrVisu = -1;
GLint locmatrProj = -1;
GLint locplanCoupe = -1;
GLint loccoulProfondeur = -1;
GLuint progBase; // le programme de nuanceurs de base
GLint locVertexBase = -1;
GLint locColorBase = -1;
GLint locmatrModelBase = -1;
GLint locmatrVisuBase = -1;
GLint locmatrProjBase = -1;
// matrices du pipeline graphique
MatricePipeline matrProj, matrVisu, matrModel;
// les formes
FormeCube *cube = NULL;
FormeSphere *sphere = NULL;
FormeTheiere *theiere = NULL;
FormeTore *toreTerre = NULL;
FormeTore *toreMars = NULL;
FormeTore *toreJupiter = NULL;
GLuint vao = 0;
GLuint vbo[2] = {0,0};
//
// variables d'état
//
struct Etat
{
int modele; // le modèle à afficher comme CorpsCeleste (1-sphère, 2-cube, 3-théière).
bool modeSelection; // on est en mode sélection?
bool enmouvement; // le modèle est en mouvement/rotation automatique ou non
bool afficheAxes; // indique si on affiche les axes
bool coulProfondeur; // indique si on veut colorer selon la profondeur
GLenum modePolygone; // comment afficher les polygones
glm::ivec2 sourisPosPrec;
// partie 1: utiliser un plan de coupe
glm::vec4 planCoupe; // équation du plan de coupe (partie 1)
GLfloat angleCoupe; // angle (degrés) autour de x (partie 1)
// apprentissage supplémentaire: facteur de réchauffement
float facteurRechauffement; // un facteur qui sert à calculer la couleur des pôles (0.0=froid, 1.0=chaud)
} etat = { 1, false, true, true, false, GL_FILL, glm::ivec2(0), glm::vec4( 0, 0, 1, 0 ), 0.0, 0.2 };
//
// variables pour définir le point de vue
//
class Camera
{
public:
void definir()
{
matrVisu.LookAt( dist*cos(glm::radians(theta))*sin(glm::radians(phi)),
dist*sin(glm::radians(theta))*sin(glm::radians(phi)),
dist*cos(glm::radians(phi)),
0, 0, 0,
0, 0, 1 );
// (pour apprentissage supplémentaire): La caméra est sur la Terre et voir passer les autres objets célestes en utilisant l'inverse de la matrice mm
}
void verifierAngles() // vérifier que les angles ne débordent pas les valeurs permises
{
const GLdouble MINPHI = 0.01, MAXPHI = 180.0 - 0.01;
phi = glm::clamp( phi, MINPHI, MAXPHI );
}
double theta; // angle de rotation de la caméra (coord. sphériques)
double phi; // angle de rotation de la caméra (coord. sphériques)
double dist; // distance (coord. sphériques)
bool modeLookAt; // on utilise LookAt (au lieu de Rotate et Translate)
} camera = { 90.0, 75.0, 35.0, true };
//
// les corps célestes
//
class CorpsCeleste
{
public:
CorpsCeleste( float r, float dist, float rot, float rev, float vitRot, float vitRev,
glm::vec4 coul=glm::vec4(1.,1.,1.,1.), bool select = false, glm::vec4 coul2=glm::vec4(1.,1.,1.,1.) ) :
rayon(r), distance(dist),
rotation(rot), revolution(rev),
vitRotation(vitRot), vitRevolution(vitRev),
couleur(coul),
estSelectionne(select),
couleurSel(coul2)
{ }
void ajouteEnfant( CorpsCeleste &bebe )
{
enfants.push_back( &bebe );
}
void afficher( )
{
matrModel.PushMatrix(); {
matrModel.Rotate( revolution, 0, 0, 1 ); // révolution du corps autour de son parent
matrModel.Translate( distance, 0, 0 ); // position par rapport à son parent
// afficher d'abord les enfants
std::vector<CorpsCeleste*>::iterator it;
for ( it = enfants.begin() ; it!=enfants.end() ; it++ )
{
(*it)->afficher();
}
// afficher le parent
matrModel.PushMatrix(); {
matrModel.Rotate( rotation, 0, 0, 1 ); // rotation sur lui-même
matrModel.Scale( rayon, rayon, rayon ); // la taille du corps
glUniformMatrix4fv( locmatrModel, 1, GL_FALSE, matrModel );
// la couleur du corps
if (!etat.modeSelection)
{
glVertexAttrib4fv( locColor, glm::value_ptr(couleur) );
}
else
{
glVertexAttrib4fv( locColor, glm::value_ptr(couleurSel) );
}
switch ( etat.modele )
{
default:
case 1:
sphere->afficher();
break;
case 2:
cube->afficher();
break;
case 3:
matrModel.Scale( 0.5, 0.5, 0.5 );
matrModel.Translate( 0.0, 0.0, -1.0 );
glUniformMatrix4fv( locmatrModel, 1, GL_FALSE, matrModel );
theiere->afficher( );
break;
}
} matrModel.PopMatrix(); glUniformMatrix4fv( locmatrModel, 1, GL_FALSE, matrModel );
} matrModel.PopMatrix(); glUniformMatrix4fv( locmatrModel, 1, GL_FALSE, matrModel );
}
void avancerPhysique()
{
if (!estSelectionne)
{
const float dt = 0.5; // intervalle entre chaque affichage (en secondes)
rotation += dt * vitRotation;
revolution += dt * vitRevolution;
}
}
std::vector<CorpsCeleste*> enfants; // la liste des enfants
float rayon; // le rayon du corps
float distance; // la distance au parent
float rotation; // l'angle actuel de rotation en degrés
float revolution; // l'angle actuel de révolution en degrés
float vitRotation; // la vitesse de rotation
float vitRevolution; // la vitesse de révolution
glm::vec4 couleur; // la couleur du corps
bool estSelectionne; // le corps est sélectionné ?
glm::vec4 couleurSel; // la couleur en mode sélection
};
// rayon dist rota revol vrota vrevol
CorpsCeleste Soleil( 4.00, 0.0, 0.0, 0.0, 0.05, 0.0, glm::vec4(1.0, 1.0, 0.0, 0.5), false, glm::vec4(0.0, 0.0, 0.0, 0.0) );
CorpsCeleste Terre( 0.70, 7.0, 30.0, 30.0, 2.5, 0.10, glm::vec4(0.5, 0.5, 1.0, 1.0), false, glm::vec4(0.0, 0.0, 0.0, 1.0) );
CorpsCeleste Lune( 0.20, 1.5, 20.0, 30.0, 2.5, -0.35, glm::vec4(0.6, 0.6, 0.6, 1.0), false, glm::vec4(0.0, 0.0, 1.0, 0.0) );
CorpsCeleste Mars( 0.50, 11.0, 20.0,140.0, 2.5, 0.13, glm::vec4(0.6, 1.0, 0.5, 1.0), false, glm::vec4(0.0, 0.0, 1.0, 1.0) );
CorpsCeleste Phobos( 0.20, 1.0, 5.0, 15.0, 3.5, 1.7, glm::vec4(0.4, 0.4, 0.8, 1.0), false, glm::vec4(0.0, 1.0, 0.0, 0.0) );
CorpsCeleste Deimos( 0.25, 1.7, 10.0, 2.0, 4.0, 0.5, glm::vec4(0.5, 0.5, 0.1, 1.0), false, glm::vec4(0.0, 1.0, 0.0, 1.0) );
CorpsCeleste Jupiter( 1.20, 16.0, 10.0, 40.0, 0.2, 0.02, glm::vec4(1.0, 0.5, 0.5, 1.0), false, glm::vec4(0.0, 1.0, 1.0, 0.0) );
CorpsCeleste Io( 0.20, 1.7, 5.0, 1.5, 2.5, 4.3, glm::vec4(0.7, 0.4, 0.5, 1.0), false, glm::vec4(0.0, 1.0, 1.0, 1.0) );
CorpsCeleste Europa( 0.25, 2.5, 87.0, 11.9, 3.5, 3.4, glm::vec4(0.4, 0.4, 0.8, 1.0), false, glm::vec4(1.0, 0.0, 0.0, 0.0) );
CorpsCeleste Ganymede( 0.30, 3.1, 10.0, 42.4, 4.0, 1.45, glm::vec4(0.5, 0.5, 0.1, 1.0), false, glm::vec4(1.0, 0.0, 0.0, 1.0) );
CorpsCeleste Callisto( 0.35, 4.0, 51.0, 93.1, 1.0, 0.45, glm::vec4(0.7, 0.5, 0.1, 1.0), false, glm::vec4(1.0, 0.0, 1.0, 0.0) );
void calculerPhysique( )
{
if ( etat.enmouvement )
{
// incrémenter rotation[] et revolution[] pour faire tourner les planètes
Soleil.avancerPhysique();
Terre.avancerPhysique();
Lune.avancerPhysique();
Mars.avancerPhysique();
Phobos.avancerPhysique();
Deimos.avancerPhysique();
Jupiter.avancerPhysique();
Io.avancerPhysique();
Europa.avancerPhysique();
Ganymede.avancerPhysique();
Callisto.avancerPhysique();
}
}
void chargerNuanceurs()
{
// charger le nuanceur de base
{
// créer le programme
progBase = glCreateProgram();
// attacher le nuanceur de sommets
{
GLuint nuanceurObj = glCreateShader( GL_VERTEX_SHADER );
glShaderSource( nuanceurObj, 1, &ProgNuanceur::chainesSommetsMinimal, NULL );
glCompileShader( nuanceurObj );
glAttachShader( progBase, nuanceurObj );
ProgNuanceur::afficherLogCompile( nuanceurObj );
}
// attacher le nuanceur de fragments
{
GLuint nuanceurObj = glCreateShader( GL_FRAGMENT_SHADER );
glShaderSource( nuanceurObj, 1, &ProgNuanceur::chainesFragmentsMinimal, NULL );
glCompileShader( nuanceurObj );
glAttachShader( progBase, nuanceurObj );
ProgNuanceur::afficherLogCompile( nuanceurObj );
}
// faire l'édition des liens du programme
glLinkProgram( progBase );
ProgNuanceur::afficherLogLink( progBase );
// demander la "Location" des variables
if ( ( locVertexBase = glGetAttribLocation( progBase, "Vertex" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de Vertex" << std::endl;
if ( ( locColorBase = glGetAttribLocation( progBase, "Color" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de Color" << std::endl;
if ( ( locmatrModelBase = glGetUniformLocation( progBase, "matrModel" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de matrModel" << std::endl;
if ( ( locmatrVisuBase = glGetUniformLocation( progBase, "matrVisu" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de matrVisu" << std::endl;
if ( ( locmatrProjBase = glGetUniformLocation( progBase, "matrProj" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de matrProj" << std::endl;
}
{
// charger le nuanceur de ce TP
// créer le programme
prog = glCreateProgram();
// attacher le nuanceur de sommets
const GLchar *chainesSommets = ProgNuanceur::lireNuanceur( "nuanceurSommets.glsl" );
if ( chainesSommets != NULL )
{
GLuint nuanceurObj = glCreateShader( GL_VERTEX_SHADER );
glShaderSource( nuanceurObj, 1, &chainesSommets, NULL );
glCompileShader( nuanceurObj );
glAttachShader( prog, nuanceurObj );
ProgNuanceur::afficherLogCompile( nuanceurObj );
delete [] chainesSommets;
}
#if 1
// partie 2:
const GLchar *chainesGeometrie = ProgNuanceur::lireNuanceur( "nuanceurGeometrie.glsl" );
if ( chainesGeometrie != NULL )
{
GLuint nuanceurObj = glCreateShader( GL_GEOMETRY_SHADER );
glShaderSource( nuanceurObj, 1, &chainesGeometrie, NULL );
glCompileShader( nuanceurObj );
glAttachShader( prog, nuanceurObj );
ProgNuanceur::afficherLogCompile( nuanceurObj );
delete [] chainesGeometrie;
}
#endif
// attacher le nuanceur de fragments
const GLchar *chainesFragments = ProgNuanceur::lireNuanceur( "nuanceurFragments.glsl" );
if ( chainesFragments != NULL )
{
GLuint nuanceurObj = glCreateShader( GL_FRAGMENT_SHADER );
glShaderSource( nuanceurObj, 1, &chainesFragments, NULL );
glCompileShader( nuanceurObj );
glAttachShader( prog, nuanceurObj );
ProgNuanceur::afficherLogCompile( nuanceurObj );
delete [] chainesFragments;
}
// faire l'édition des liens du programme
glLinkProgram( prog );
ProgNuanceur::afficherLogLink( prog );
// demander la "Location" des variables
if ( ( locVertex = glGetAttribLocation( prog, "Vertex" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de Vertex" << std::endl;
if ( ( locColor = glGetAttribLocation( prog, "Color" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de Color" << std::endl;
if ( ( locmatrModel = glGetUniformLocation( prog, "matrModel" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de matrModel" << std::endl;
if ( ( locmatrVisu = glGetUniformLocation( prog, "matrVisu" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de matrVisu" << std::endl;
if ( ( locmatrProj = glGetUniformLocation( prog, "matrProj" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de matrProj" << std::endl;
if ( ( locplanCoupe = glGetUniformLocation( prog, "planCoupe" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de planCoupe" << std::endl;
if ( ( loccoulProfondeur = glGetUniformLocation( prog, "coulProfondeur" ) ) == -1 ) std::cerr << "!!! pas trouvé la \"Location\" de coulProfondeur" << std::endl;
}
}
void FenetreTP::initialiser()
{
// donner la couleur de fond
glClearColor( 0.1, 0.1, 0.1, 1.0 );
// activer les etats openGL
glEnable( GL_DEPTH_TEST );
// activer le mélange de couleur pour la transparence
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
// charger les nuanceurs
chargerNuanceurs();
glUseProgram( prog );
// les valeurs à utiliser pour tracer le quad
const GLfloat taille = Jupiter.distance + Callisto.distance + Callisto.rayon;
GLfloat coo[] = { -taille, taille, 0,
taille, taille, 0,
taille, -taille, 0,
-taille, -taille, 0 };
const GLuint connec[] = { 0, 1, 2, 2, 3, 0 };
// partie 1: initialiser le VAO (quad)
glBindVertexArray(vao);
// partie 1: créer les deux VBO pour les sommets et la connectivité
glGenBuffers(1,&vbo[0]);
glBindBuffer( GL_ARRAY_BUFFER, vbo[0] );
glBufferData( GL_ARRAY_BUFFER, sizeof(coo), coo, GL_STATIC_DRAW);
glVertexAttribPointer( locVertex, 3, GL_FLOAT, GL_FALSE, 0, 0 );
glEnableVertexAttribArray(locVertex);
glGenBuffers(1,&vbo[1]);
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vbo[1] );
glBufferData( GL_ELEMENT_ARRAY_BUFFER, sizeof(connec), connec, GL_STATIC_DRAW);
glBindVertexArray(0);
// construire le graphe de scène
Soleil.ajouteEnfant(Terre);
Terre.ajouteEnfant(Lune);
Soleil.ajouteEnfant(Mars);
Mars.ajouteEnfant(Phobos);
Mars.ajouteEnfant(Deimos);
Soleil.ajouteEnfant(Jupiter);
Jupiter.ajouteEnfant(Io);
Jupiter.ajouteEnfant(Europa);
Jupiter.ajouteEnfant(Ganymede);
Jupiter.ajouteEnfant(Callisto);
// créer quelques autres formes
cube = new FormeCube( 1.5 );
sphere = new FormeSphere( 1.0, 16, 16 );
theiere = new FormeTheiere( );
toreTerre = new FormeTore( 0.08, Terre.distance, 8, 200 );
toreMars = new FormeTore( 0.08, Mars.distance, 8, 200 );
toreJupiter = new FormeTore( 0.08, Jupiter.distance, 8, 200 );
}
void FenetreTP::conclure()
{
delete cube;
delete sphere;
delete theiere;
delete toreTerre;
delete toreMars;
delete toreJupiter;
glDeleteBuffers( 2, vbo );
glDeleteVertexArrays( 1, &vao );
}
void afficherQuad( GLfloat alpha ) // le plan qui ferme les solides
{
glVertexAttrib4f( locColor, 1.0, 1.0, 1.0, alpha );
// afficher le plan tourné selon l'angle courant et à la position courante
// partie 1: modifs ici ...
// ...
matrModel.Rotate(etat.angleCoupe, 0.0, 1.0, 0.0);
matrModel.Translate(etat.planCoupe.x,etat.planCoupe.y,-etat.planCoupe.w);
glUniformMatrix4fv( locmatrModel, 1, GL_FALSE, matrModel );
glBindVertexArray( vao );
glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0 );
glBindVertexArray(0);
// ...
}
void afficherModele()
{
glVertexAttrib4f( locColor, 1.0, 1.0, 1.0, 1.0 );
#if 1
// afficher les deux tores pour identifier les orbites des planetes
glVertexAttrib3f( locColor, 0.0, 0.0, 1.0 );
toreTerre->afficher();
glVertexAttrib3f( locColor, 0.0, 1.0, 0.0 );
toreMars->afficher();
glVertexAttrib3f( locColor, 1.0, 0.0, 0.0 );
toreJupiter->afficher();
#endif
// afficher le système solaire en commençant à la racine
Soleil.afficher( );
}
void FenetreTP::afficherScene( )
{
// effacer l'ecran et le tampon de profondeur et le stencil
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
glUseProgram( progBase );
// définir le pipeline graphique
matrProj.Perspective( 50.0, (GLdouble) largeur_ / (GLdouble) hauteur_, 0.1, 100.0 );
glUniformMatrix4fv( locmatrProjBase, 1, GL_FALSE, matrProj );
camera.definir();
glUniformMatrix4fv( locmatrVisuBase, 1, GL_FALSE, matrVisu );
matrModel.LoadIdentity();
glUniformMatrix4fv( locmatrModelBase, 1, GL_FALSE, matrModel );
// afficher les axes
if ( etat.afficheAxes ) FenetreTP::afficherAxes();
// dessiner la scène
glUseProgram( prog );
glUniformMatrix4fv( locmatrProj, 1, GL_FALSE, matrProj );
glUniformMatrix4fv( locmatrVisu, 1, GL_FALSE, matrVisu );
glUniformMatrix4fv( locmatrModel, 1, GL_FALSE, matrModel );
glUniform4fv( locplanCoupe, 1, glm::value_ptr(etat.planCoupe) );
glUniform1i( loccoulProfondeur, etat.coulProfondeur );
// afficher le modèle et tenir compte du stencil et du plan de coupe
// partie 1: modifs ici ...
if (!etat.modeSelection)
{
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS,1,1);
glStencilOp(GL_KEEP,GL_KEEP,GL_INCR);
glEnable(GL_CLIP_PLANE0);
glDepthMask(GL_FALSE);
glEnable(GL_BLEND);
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
afficherModele();
glDisable(GL_CLIP_PLANE0);
matrModel.PushMatrix();
afficherQuad(0.25);
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
glStencilFunc(GL_EQUAL,2,1);
matrModel.PopMatrix();
afficherQuad(0.25);
glDisable(GL_STENCIL_TEST);
}
else
{
afficherModele();
glFinish();
//obtenir position
GLint cloture[4]; glGetIntegerv( GL_VIEWPORT, cloture );
GLint posX = etat.sourisPosPrec.x, posY = cloture[3]-etat.sourisPosPrec.y;
glReadBuffer(GL_BACK);
//obtenir couleur a la position obtenue
GLubyte couleur[4];
glReadPixels( posX, posY, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, couleur );
if (couleur[0] == 0 && couleur[1] == 0 && couleur[2] == 0 && couleur[3] == 0)
Soleil.estSelectionne = !Soleil.estSelectionne;
else if (couleur[0] == 0 && couleur[1] == 0 && couleur[2] == 0 && couleur[3] != 0)
Terre.estSelectionne = !Terre.estSelectionne;
else if (couleur[0] == 0 && couleur[1] == 0 && couleur[2] != 0 && couleur[3] == 0)
Lune.estSelectionne = !Lune.estSelectionne;
else if (couleur[0] == 0 && couleur[1] == 0 && couleur[2] != 0 && couleur[3] != 0)
Mars.estSelectionne = !Mars.estSelectionne;
else if (couleur[0] == 0 && couleur[1] != 0 && couleur[2] == 0 && couleur[3] == 0)
Phobos.estSelectionne = !Phobos.estSelectionne;
else if (couleur[0] == 0 && couleur[1] != 0 && couleur[2] == 0 && couleur[3] != 0)
Deimos.estSelectionne = !Deimos.estSelectionne;
else if (couleur[0] == 0 && couleur[1] != 0 && couleur[2] != 0 && couleur[3] == 0)
Jupiter.estSelectionne = !Jupiter.estSelectionne;
else if (couleur[0] == 0 && couleur[1] != 0 && couleur[2] != 0 && couleur[3] != 0)
Io.estSelectionne = !Io.estSelectionne;
else if (couleur[0] != 0 && couleur[1] == 0 && couleur[2] == 0 && couleur[3] == 0)
Europa.estSelectionne = !Europa.estSelectionne;
else if (couleur[0] != 0 && couleur[1] == 0 && couleur[2] == 0 && couleur[3] != 0)
Ganymede.estSelectionne = !Ganymede.estSelectionne;
else if (couleur[0] != 0 && couleur[1] == 0 && couleur[2] != 0 && couleur[3] == 0)
Callisto.estSelectionne = !Callisto.estSelectionne;
}
}
void FenetreTP::redimensionner( GLsizei w, GLsizei h )
{
// glViewport( 0, 0, w, h );
GLfloat h2 = 0.5*h;
glViewport( 0, 0, w, h2 ); // pour le viewport 0
glViewportIndexedf( 1, 0, h2, w, h2 ); // pour le viewport 1
glScissorIndexed( 1, 0, h2, w, h2 );
}
void FenetreTP::clavier( TP_touche touche )
{
switch ( touche )
{
case TP_ECHAP:
case TP_q: // Quitter l'application
quit();
break;
case TP_x: // Activer/désactiver l'affichage des axes
etat.afficheAxes = !etat.afficheAxes;
std::cout << "// Affichage des axes ? " << ( etat.afficheAxes ? "OUI" : "NON" ) << std::endl;
break;
case TP_v: // Recharger les fichiers des nuanceurs et recréer le programme
chargerNuanceurs();
std::cout << "// Recharger nuanceurs" << std::endl;
break;
case TP_ESPACE: // Mettre en pause ou reprendre l'animation
etat.enmouvement = !etat.enmouvement;
break;
case TP_g: // Permuter l'affichage en fil de fer ou plein
etat.modePolygone = ( etat.modePolygone == GL_FILL ) ? GL_LINE : GL_FILL;
glPolygonMode( GL_FRONT_AND_BACK, etat.modePolygone );
break;
case TP_m: // Choisir le modèle: 1-sphère, 2-cube, 3-théière (déjà implanté)
if ( ++etat.modele > 3 ) etat.modele = 1;
std::cout << " etat.modele=" << etat.modele << std::endl;
break;
case TP_p: // Atténuer ou non la couleur selon la profondeur
etat.coulProfondeur = !etat.coulProfondeur;
std::cout << " etat.coulProfondeur=" << etat.coulProfondeur << std::endl;
break;
case TP_HAUT: // Déplacer le plan de coupe vers le haut
etat.planCoupe.w += 0.1;
std::cout << " etat.planCoupe.w=" << etat.planCoupe.w << std::endl;
break;
case TP_BAS: // Déplacer le plan de coupe vers le bas
etat.planCoupe.w -= 0.1;
std::cout << " etat.planCoupe.w=" << etat.planCoupe.w << std::endl;
break;
case TP_CROCHETDROIT:
case TP_DROITE: // Augmenter l'angle du plan de coupe
etat.angleCoupe += 0.5;
etat.planCoupe.x = sin(glm::radians(etat.angleCoupe));
etat.planCoupe.z = cos(glm::radians(etat.angleCoupe));
std::cout << " etat.angleCoupe=" << etat.angleCoupe << std::endl;
break;
case TP_CROCHETGAUCHE:
case TP_GAUCHE: // Diminuer l'angle du plan de coupe
etat.angleCoupe -= 0.5;
etat.planCoupe.x = sin(glm::radians(etat.angleCoupe));
etat.planCoupe.z = cos(glm::radians(etat.angleCoupe));
std::cout << " etat.angleCoupe=" << etat.angleCoupe << std::endl;
break;
// case TP_c: // Augmenter le facteur de réchauffement
// etat.facteurRechauffement += 0.05; if ( etat.facteurRechauffement > 1.0 ) etat.facteurRechauffement = 1.0;
// std::cout << " etat.facteurRechauffement=" << etat.facteurRechauffement << " " << std::endl;
// break;
// case TP_f: // Diminuer le facteur de réchauffement
// etat.facteurRechauffement -= 0.05; if ( etat.facteurRechauffement < 0.0 ) etat.facteurRechauffement = 0.0;
// std::cout << " etat.facteurRechauffement=" << etat.facteurRechauffement << " " << std::endl;
// break;
case TP_PLUS: // Incrémenter la distance de la caméra
case TP_EGAL:
camera.dist--;
std::cout << " camera.dist=" << camera.dist << std::endl;
break;
case TP_SOULIGNE:
case TP_MOINS: // Décrémenter la distance de la caméra
camera.dist++;
std::cout << " camera.dist=" << camera.dist << std::endl;
break;
default:
std::cout << " touche inconnue : " << (char) touche << std::endl;
imprimerTouches();
break;
}
}
static bool pressed = false;
void FenetreTP::sourisClic( int button, int state, int x, int y )
{
pressed = ( state == TP_PRESSE );
if ( pressed )
{
switch ( button )
{
default:
case TP_BOUTON_GAUCHE: // Modifier le point de vue
etat.modeSelection = false;
break;
case TP_BOUTON_DROIT: // Sélectionner des objets
etat.modeSelection = true;
break;
}
etat.sourisPosPrec.x = x;
etat.sourisPosPrec.y = y;
}
else
{
etat.modeSelection = false;
}
}
void FenetreTP::sourisWheel( int x, int y ) // Déplacer le plan de coupe
{
const int sens = +1;
etat.planCoupe.w += 0.02 * sens * y;
std::cout << " etat.planCoupe.w=" << etat.planCoupe.w << std::endl;
}
void FenetreTP::sourisMouvement( int x, int y )
{
if ( pressed )
{
if ( !etat.modeSelection )
{
int dx = x - etat.sourisPosPrec.x;
int dy = y - etat.sourisPosPrec.y;
camera.theta -= dx / 3.0;
camera.phi -= dy / 3.0;
}
etat.sourisPosPrec.x = x;
etat.sourisPosPrec.y = y;
camera.verifierAngles();
}
}
int main( int argc, char *argv[] )
{
// créer une fenêtre
FenetreTP fenetre( "INF2705 TP" );
// allouer des ressources et définir le contexte OpenGL
fenetre.initialiser();
bool boucler = true;
while ( boucler )
{
// mettre à jour la physique
calculerPhysique( );
// affichage
fenetre.afficherScene();
if ( etat.modeSelection )
{
etat.modeSelection = pressed = false;
}
else
fenetre.swap();
// récupérer les événements et appeler la fonction de rappel
boucler = fenetre.gererEvenement();
}
// détruire les ressources OpenGL allouées
fenetre.conclure();
return 0;
}
et une partie des erreurs parce que la liste dépasse la console
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:92:29: note: ‘template<class genType> genType glm::two_over_root_pi()’ previously declared here
GLM_FUNC_QUALIFIER genType two_over_root_pi()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:122:43: error: redefinition of ‘template<class genType> genType glm::one_over_root_two()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_root_two()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:98:29: note: ‘template<class genType> genType glm::one_over_root_two()’ previously declared here
GLM_FUNC_QUALIFIER genType one_over_root_two()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:128:43: error: redefinition of ‘template<class genType> genType glm::root_half_pi()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_half_pi()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:104:29: note: ‘template<class genType> genType glm::root_half_pi()’ previously declared here
GLM_FUNC_QUALIFIER genType root_half_pi()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:134:43: error: redefinition of ‘template<class genType> genType glm::root_two_pi()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_two_pi()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:110:29: note: ‘template<class genType> genType glm::root_two_pi()’ previously declared here
GLM_FUNC_QUALIFIER genType root_two_pi()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:140:43: error: redefinition of ‘template<class genType> genType glm::root_ln_four()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_ln_four()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:116:29: note: ‘template<class genType> genType glm::root_ln_four()’ previously declared here
GLM_FUNC_QUALIFIER genType root_ln_four()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:146:43: error: redefinition of ‘template<class genType> genType glm::e()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType e()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:122:29: note: ‘template<class genType> genType glm::e()’ previously declared here
GLM_FUNC_QUALIFIER genType e()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:152:43: error: redefinition of ‘template<class genType> genType glm::euler()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType euler()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:128:29: note: ‘template<class genType> genType glm::euler()’ previously declared here
GLM_FUNC_QUALIFIER genType euler()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:158:43: error: redefinition of ‘template<class genType> genType glm::root_two()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_two()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:134:29: note: ‘template<class genType> genType glm::root_two()’ previously declared here
GLM_FUNC_QUALIFIER genType root_two()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:164:43: error: redefinition of ‘template<class genType> genType glm::root_three()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_three()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:140:29: note: ‘template<class genType> genType glm::root_three()’ previously declared here
GLM_FUNC_QUALIFIER genType root_three()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:170:43: error: redefinition of ‘template<class genType> genType glm::root_five()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_five()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:146:29: note: ‘template<class genType> genType glm::root_five()’ previously declared here
GLM_FUNC_QUALIFIER genType root_five()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:176:43: error: redefinition of ‘template<class genType> genType glm::ln_two()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_two()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:152:29: note: ‘template<class genType> genType glm::ln_two()’ previously declared here
GLM_FUNC_QUALIFIER genType ln_two()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:182:43: error: redefinition of ‘template<class genType> genType glm::ln_ten()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_ten()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:158:29: note: ‘template<class genType> genType glm::ln_ten()’ previously declared here
GLM_FUNC_QUALIFIER genType ln_ten()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:188:43: error: redefinition of ‘template<class genType> genType glm::ln_ln_two()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_ln_two()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:164:29: note: ‘template<class genType> genType glm::ln_ln_two()’ previously declared here
GLM_FUNC_QUALIFIER genType ln_ln_two()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:194:43: error: redefinition of ‘template<class genType> genType glm::third()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType third()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:170:29: note: ‘template<class genType> genType glm::third()’ previously declared here
GLM_FUNC_QUALIFIER genType third()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:200:43: error: redefinition of ‘template<class genType> genType glm::two_thirds()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_thirds()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:176:29: note: ‘template<class genType> genType glm::two_thirds()’ previously declared here
GLM_FUNC_QUALIFIER genType two_thirds()
^
In file included from /usr/include/glm/gtc/constants.hpp:205:0,
from /usr/include/glm/gtx/quaternion.hpp:47,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/constants.inl:206:43: error: redefinition of ‘template<class genType> genType glm::golden_ratio()’
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType golden_ratio()
^
In file included from /usr/local/include/glm/gtc/constants.hpp:184:0,
from /usr/local/include/glm/gtc/quaternion.hpp:46,
from /usr/local/include/glm/gtc/type_ptr.hpp:65,
from inf2705-matrice.h:18,
from main.cpp:8:
/usr/local/include/glm/gtc/constants.inl:182:29: note: ‘template<class genType> genType glm::golden_ratio()’ previously declared here
GLM_FUNC_QUALIFIER genType golden_ratio()
^
In file included from /usr/include/glm/gtc/quaternion.hpp:382:0,
from /usr/include/glm/gtx/quaternion.hpp:48,
from /usr/include/glm/gtx/io.hpp:51,
from main.cpp:12:
/usr/include/glm/gtc/quaternion.inl:42:32: error: type/value mismatch at argument 1 in template parameter list for ‘template<template<class,glm::precision <anonymous> > class vecType, class T, glm::precision P> struct glm::detail::compute_dot’
struct compute_dot<tquat, T, P>
^
/usr/include/glm/gtc/quaternion.inl:42:32: note: expected a template of type ‘template<class, glm::precision <anonymous> > class vecType’,got ‘template<class T> struct glm::detail::tquat’
main.cpp: In member function ‘void Camera::definir()’:
main.cpp:74:51: error: call of overloaded ‘radians(double&)’ is ambiguous
matrVisu.LookAt( dist*cos(glm::radians(theta))*sin(glm::radians(phi)),
^
In file included from /usr/local/include/glm/core/func_trigonometric.hpp:199:0,
from /usr/local/include/glm/glm.hpp:100,
from inf2705-matrice.h:17,
from main.cpp:8:
/usr/local/include/glm/core/func_trigonometric.inl:33:29: note: candidate: genType glm::radians(const genType&) [with genType = double]
GLM_FUNC_QUALIFIER genType radians
^
In file included from /usr/include/glm/detail/func_trigonometric.hpp:205:0,
from /usr/include/glm/trigonometric.hpp:35,
from /usr/include/glm/glm.hpp:110,
from /usr/include/glm/gtx/io.hpp:50,
from main.cpp:12:
/usr/include/glm/detail/func_trigonometric.inl:41:43: note: candidate: genType glm::radians(genType) [with genType = double]
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
^
main.cpp:74:74: error: call of overloaded ‘radians(double&)’ is ambiguous
matrVisu.LookAt( dist*cos(glm::radians(theta))*sin(glm::radians(phi)),
^
In file included from /usr/local/include/glm/core/func_trigonometric.hpp:199:0,
from /usr/local/include/glm/glm.hpp:100,
from inf2705-matrice.h:17,
from main.cpp:8:
/usr/local/include/glm/core/func_trigonometric.inl:33:29: note: candidate: genType glm::radians(const genType&) [with genType = double]
GLM_FUNC_QUALIFIER genType radians
^
In file included from /usr/include/glm/detail/func_trigonometric.hpp:205:0,
from /usr/include/glm/trigonometric.hpp:35,
from /usr/include/glm/glm.hpp:110,
from /usr/include/glm/gtx/io.hpp:50,
from main.cpp:12:
/usr/include/glm/detail/func_trigonometric.inl:41:43: note: candidate: genType glm::radians(genType) [with genType = double]
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
^
main.cpp:75:51: error: call of overloaded ‘radians(double&)’ is ambiguous
dist*sin(glm::radians(theta))*sin(glm::radians(phi)),
^
In file included from /usr/local/include/glm/core/func_trigonometric.hpp:199:0,
from /usr/local/include/glm/glm.hpp:100,
from inf2705-matrice.h:17,
from main.cpp:8:
/usr/local/include/glm/core/func_trigonometric.inl:33:29: note: candidate: genType glm::radians(const genType&) [with genType = double]
GLM_FUNC_QUALIFIER genType radians
^
In file included from /usr/include/glm/detail/func_trigonometric.hpp:205:0,
from /usr/include/glm/trigonometric.hpp:35,
from /usr/include/glm/glm.hpp:110,
from /usr/include/glm/gtx/io.hpp:50,
from main.cpp:12:
/usr/include/glm/detail/func_trigonometric.inl:41:43: note: candidate: genType glm::radians(genType) [with genType = double]
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
^
main.cpp:75:74: error: call of overloaded ‘radians(double&)’ is ambiguous
dist*sin(glm::radians(theta))*sin(glm::radians(phi)),
^
In file included from /usr/local/include/glm/core/func_trigonometric.hpp:199:0,
from /usr/local/include/glm/glm.hpp:100,
from inf2705-matrice.h:17,
from main.cpp:8:
/usr/local/include/glm/core/func_trigonometric.inl:33:29: note: candidate: genType glm::radians(const genType&) [with genType = double]
GLM_FUNC_QUALIFIER genType radians
^
In file included from /usr/include/glm/detail/func_trigonometric.hpp:205:0,
from /usr/include/glm/trigonometric.hpp:35,
from /usr/include/glm/glm.hpp:110,
from /usr/include/glm/gtx/io.hpp:50,
from main.cpp:12:
/usr/include/glm/detail/func_trigonometric.inl:41:43: note: candidate: genType glm::radians(genType) [with genType = double]
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
^
main.cpp:76:49: error: call of overloaded ‘radians(double&)’ is ambiguous
dist*cos(glm::radians(phi)),
^
In file included from /usr/local/include/glm/core/func_trigonometric.hpp:199:0,
from /usr/local/include/glm/glm.hpp:100,
from inf2705-matrice.h:17,
from main.cpp:8:
/usr/local/include/glm/core/func_trigonometric.inl:33:29: note: candidate: genType glm::radians(const genType&) [with genType = double]
GLM_FUNC_QUALIFIER genType radians
^
In file included from /usr/include/glm/detail/func_trigonometric.hpp:205:0,
from /usr/include/glm/trigonometric.hpp:35,
from /usr/include/glm/glm.hpp:110,
from /usr/include/glm/gtx/io.hpp:50,
from main.cpp:12:
/usr/include/glm/detail/func_trigonometric.inl:41:43: note: candidate: genType glm::radians(genType) [with genType = double]
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
^
main.cpp: In member function ‘void Camera::verifierAngles()’:
main.cpp:85:45: error: call of overloaded ‘clamp(double&, const GLdouble&, const GLdouble&)’ is ambiguous
phi = glm::clamp( phi, MINPHI, MAXPHI );
^
In file included from /usr/local/include/glm/core/func_common.hpp:428:0,
from /usr/local/include/glm/glm.hpp:102,
from inf2705-matrice.h:17,
from main.cpp:8:
/usr/local/include/glm/core/func_common.inl:323:29: note: candidate: genType glm::clamp(const genType&, const genType&, const genType&) [with genType = double]
GLM_FUNC_QUALIFIER valType clamp
^
In file included from /usr/include/glm/detail/func_common.hpp:455:0,
from /usr/include/glm/common.hpp:35,
from /usr/include/glm/glm.hpp:112,
from /usr/include/glm/gtx/io.hpp:50,
from main.cpp:12:
/usr/include/glm/detail/func_common.inl:451:29: note: candidate: genType glm::clamp(genType, genType, genType) [with genType = double]
GLM_FUNC_QUALIFIER genType clamp(genType x, genType minVal, genType maxVal)
^
main.cpp: In member function ‘void FenetreTP::clavier(TP_touche)’:
main.cpp:591:58: error: call of overloaded ‘radians(GLfloat&)’ is ambiguous
etat.planCoupe.x = sin(glm::radians(etat.angleCoupe));
^
In file included from /usr/local/include/glm/core/func_trigonometric.hpp:199:0,
from /usr/local/include/glm/glm.hpp:100,
from inf2705-matrice.h:17,
from main.cpp:8:
/usr/local/include/glm/core/func_trigonometric.inl:33:29: note: candidate: genType glm::radians(const genType&) [with genType = float]
GLM_FUNC_QUALIFIER genType radians
^
In file included from /usr/include/glm/detail/func_trigonometric.hpp:205:0,
from /usr/include/glm/trigonometric.hpp:35,
from /usr/include/glm/glm.hpp:110,
from /usr/include/glm/gtx/io.hpp:50,
from main.cpp:12:
/usr/include/glm/detail/func_trigonometric.inl:41:43: note: candidate: genType glm::radians(genType) [with genType = float]
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
^
main.cpp:592:58: error: call of overloaded ‘radians(GLfloat&)’ is ambiguous
etat.planCoupe.z = cos(glm::radians(etat.angleCoupe));
^
In file included from /usr/local/include/glm/core/func_trigonometric.hpp:199:0,
from /usr/local/include/glm/glm.hpp:100,
from inf2705-matrice.h:17,
from main.cpp:8:
/usr/local/include/glm/core/func_trigonometric.inl:33:29: note: candidate: genType glm::radians(const genType&) [with genType = float]
GLM_FUNC_QUALIFIER genType radians
^
In file included from /usr/include/glm/detail/func_trigonometric.hpp:205:0,
from /usr/include/glm/trigonometric.hpp:35,
from /usr/include/glm/glm.hpp:110,
from /usr/include/glm/gtx/io.hpp:50,
from main.cpp:12:
/usr/include/glm/detail/func_trigonometric.inl:41:43: note: candidate: genType glm::radians(genType) [with genType = float]
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
^
main.cpp:598:58: error: call of overloaded ‘radians(GLfloat&)’ is ambiguous
etat.planCoupe.x = sin(glm::radians(etat.angleCoupe));
^
In file included from /usr/local/include/glm/core/func_trigonometric.hpp:199:0,
from /usr/local/include/glm/glm.hpp:100,
from inf2705-matrice.h:17,
from main.cpp:8:
/usr/local/include/glm/core/func_trigonometric.inl:33:29: note: candidate: genType glm::radians(const genType&) [with genType = float]
GLM_FUNC_QUALIFIER genType radians
^
In file included from /usr/include/glm/detail/func_trigonometric.hpp:205:0,
from /usr/include/glm/trigonometric.hpp:35,
from /usr/include/glm/glm.hpp:110,
from /usr/include/glm/gtx/io.hpp:50,
from main.cpp:12:
/usr/include/glm/detail/func_trigonometric.inl:41:43: note: candidate: genType glm::radians(genType) [with genType = float]
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
^
main.cpp:599:58: error: call of overloaded ‘radians(GLfloat&)’ is ambiguous
etat.planCoupe.z = cos(glm::radians(etat.angleCoupe));
^
In file included from /usr/local/include/glm/core/func_trigonometric.hpp:199:0,
from /usr/local/include/glm/glm.hpp:100,
from inf2705-matrice.h:17,
from main.cpp:8:
/usr/local/include/glm/core/func_trigonometric.inl:33:29: note: candidate: genType glm::radians(const genType&) [with genType = float]
GLM_FUNC_QUALIFIER genType radians
^
In file included from /usr/include/glm/detail/func_trigonometric.hpp:205:0,
from /usr/include/glm/trigonometric.hpp:35,
from /usr/include/glm/glm.hpp:110,
from /usr/include/glm/gtx/io.hpp:50,
from main.cpp:12:
/usr/include/glm/detail/func_trigonometric.inl:41:43: note: candidate: genType glm::radians(genType) [with genType = float]
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType radians(genType degrees)
^
makefile:22: recipe for target 'main.exe' failed
make: *** [main.exe] Error 1
J'ai pas mal scruté les tutos les plus populaires pour installer openGl, du coup je pense que j'ai taper pas mal tous les commandes de base pour installer openGl, j'ai même suivi un tuto pour installer des drivers AMD parce que ma carte graphique est intel. Un de mes coéquipiers m'avait dit qu'il avait réussit à l'installer en updatant les drivers de sa carte graphique, du coup je pense que ça doit être possible.
Merci d'avance.
Hors ligne
#2 Le 15/02/2018, à 10:26
- LukePerp
Re : OpenGl erreurs lors de la compilation
Bonjour,
Avais tu regardé si openGL était déjà présent sur ton système ? Parce que c'est le cas normalement pour Ubuntu. Tape cette commande pour vérifier :
glxinfo | grep "OpenGL version"
Ou simplement et regardes les lignes OpenGL :
glxinfo | grep 'version'
Sur mon Ubuntu 14.04 j'ai le retour :
OpenGL version string: 2.1 Mesa 10.1.3
Si tu n'as pas glxinfo, alors tu il faut installer ce petit paquet :
sudo apt-get install mesa-utils
Dernière modification par LukePerp (Le 15/02/2018, à 10:29)
Desktop & Laptop - Ubuntu Mate dernière LTS - Intel i5 - 16 Go - Dual boot Windows offline
Hors ligne
#3 Le 16/02/2018, à 02:13
- Aureole
Re : OpenGl erreurs lors de la compilation
Ah ouais ouais j'ai pas mal taper tous les commandes pour installer opengl, du coup
OpenGL version string: 3.0 Mesa 18.1.0-devel - padoka PPA
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
Max core profile version: 4.5
Max compat profile version: 3.0
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.1.0-devel - padoka PPA
OpenGL core profile shading language version string: 4.50
OpenGL version string: 3.0 Mesa 18.1.0-devel - padoka PPA
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 18.1.0-devel - padoka PPA
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
Hors ligne
#4 Le 16/02/2018, à 08:37
- LukePerp
Re : OpenGl erreurs lors de la compilation
Tu donc bien opengl d'installé. En revanche, si tu veux exploiter les fonctions opengl, il faut que le logiciel 3D que tu va utiliser soit compatible opengl. Je te laisse le soin de vérifier ce point.
Desktop & Laptop - Ubuntu Mate dernière LTS - Intel i5 - 16 Go - Dual boot Windows offline
Hors ligne
#5 Le 17/02/2018, à 04:15
- Aureole
Re : OpenGl erreurs lors de la compilation
Ah ouais il faut un logiciel 3D? Habituellement en laboratoire je dois juste faire la commande "make" du fichier makefile et ça lance le programme tout seul. En sachant que je veux l'utiliser pour le développement (bah en fait c'est pour mon cours d'infographie), tu me conseilles quel logiciel 3D?
Hors ligne