OpenGL probleme convertir?
Bonjour j'ai rencontrer un probleme lors de la lecture de mon livre de programmation et jaimerait me le faire expliquer et corriger s'il vous plait:)
l'erreur est que le programme esset de convertir une chose que je ne comprend pas pourquoi il la convertit et pourtant j'ai suivit toutes les instruction du livre.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
| #include <iostream>
#include <fstream>
#include"GL\glut.h"
using namespace std;
void LabyAffichage();
void LabyRedim();
void OuvrirNiveau(char* niveau);
void LibererMemoire();
void DessinerNiveau();
char** Matrice = NULL;
int NbColonnes = 10, NbLignes = 8;
void main(void)
{
OuvrirNiveau("niveau.txt");
glutInitWindowPosition(10,10);
glutInitWindowSize(500,500);
glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE);
glutCreateWindow("Labyrinthe");
glutDisplayFunc(LabyAffichage);
glutReshapeFunc(LabyRedim);
glutMainLoop();
}
void LabyAffichage()
{
glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
DessinerNiveau();
glFlush();
}
void LabyRedim(int x, int y)
{
glViewport(0, 0, x, y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, (double)NbColonnes, (double)NbLignes, 0.0);
}
void OuvrirNiveau(char* niveau)
{
ifstream fichier;
fichier.open(niveau);
if(!fichier)
{
cout<<"Erreur lors de l'ouverture du ficher!" << endl;
system("pause");
exit(1);
}
fichier>> NbColonnes;
fichier>> NbLignes;
Matrice = new char*[NbColonnes];
for(int i=0;i<NbColonnes; i++)
{Matrice[i] = new char[NbLignes];}
for(int i=0; i<NbColonnes; i++)
for(int j=0; j<NbLignes; j++)
Matrice[i][j] = '0';
for(int j=0; j<NbLignes; j++)
for(int i=0; i<NbLignes; i++)
fichier >> Matrice[i][j];
fichier.close();
}
void LibererMemoire()
{
if(Matrice !=NULL)
{
for(int i=0; i<NbColonnes; i++)
delete [] Matrice[i];
delete [] Matrice;
}
}
void DessinerNiveau()
{
glColor3d(0.5,0.5,0.5);
glBegin(GL_QUADS);
for(int i=0; i<NbColonnes; i++)
for(int j=0; j<NbLignes; j++)
if(Matrice[i][j] == '0')
{
glVertex2d(i, j);
glVertex2d(i, j+1);
glVertex2d(i+1, j+1);
glVertex2d(i+1, j);
}
glEnd();
} |
L'erreur est :
Code:
1 2 3 4 5
| 1>------ Début de la génération*: Projet*: Labyrinthe, Configuration*: Debug Win32 ------
1> Main.cpp
1>d:\c++\program visual c++\labyrinthe\labyrinthe\main.cpp(28): error C2664: 'glutReshapeFunc'*: impossible de convertir le paramètre 1 de 'void (__cdecl *)(void)' en 'void (__cdecl *)(int,int)'
1> Aucune fonction ayant ce nom dans la portée ne correspond au type de la cible
========== Génération*: 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignoré ========== |
J'utilise le programme Microsoft Visual c++ 2010 express
Merci d'avance:)