Bonsoir,

j'aurai besoin d'aide au niveau des textures svp, en faite mon compilateur me dit que la fonction n'est pas declaré ..

voici le code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
109
110
#include <GL/openglut.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
 
 
GLuint text1;
GLfloat rot=0;
 
void texture_sol()
{
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_TEXTURE_2D);
    text1 = loadTexture("stainedglass05.jpg");
 
    glBindTexture(GL_TEXTURE_2D, text1);
}
 
 
 
void sol()
{
     glPushMatrix();
     texture_sol();
     glBegin(GL_QUADS);
       glColor3ub(0,130,65);
       glTexCoord2d(0,1);   glVertex3f(-3.0,-1.0,1.0);
       glTexCoord2d(10,0);  glVertex3f(3.0,-1.0,1.0);
       glTexCoord2d(10,10); glVertex3f(3.0,-1.0,-10.0);
       glTexCoord2d(0,10);  glVertex3f(-3.0,-1.0,-10.0);
     glEnd();
     glPopMatrix();
}
void caisse()
{
     glPushMatrix();
     glTranslatef(0,0.1f,-2.0);
     glRotated(rot,0,1.0f,0);
     glColor3ub(255,0,0);
     glBegin(GL_QUADS);
 
     glVertex3f(-0.5f,-0.5f,1.0);
     glVertex3f(0.5f,-0.5f,1.0);
     glVertex3f(0.5f,0.5f,1.0);
     glVertex3f(-0.5f,0.5f,1.0);
 
     glVertex3f(-0.5f,-0.5f,-1.0);
     glVertex3f(0.5f,-0.5f,-1.0);
     glVertex3f(0.5f,0.5f,-1.0);
     glVertex3f(-0.5f,0.5f,-1.0);
 
     glVertex3f(-0.5f,-0.5f,1.0);
     glVertex3f(0.5f,-0.5f,1.0);
     glVertex3f(0.5f,-0.5f,-1.0);
     glVertex3f(-0.5f,-0.5f,-1.0);
 
     glVertex3f(-0.5f,0.5f,1.0);
     glVertex3f(0.5f,0.5f,1.0);
     glVertex3f(0.5f,0.5f,-1.0);
     glVertex3f(-0.5f,0.5f,-1.0);
 
     glVertex3f(0.5f,0.5f,1.0);
     glVertex3f(0.5f,-0.5f,1.0);
     glVertex3f(0.5f,-0.5f,-1.0);
     glVertex3f(0.5f,0.5f,-1.0);
 
     glVertex3f(-0.5f,0.5f,1.0);
     glVertex3f(-0.5f,-0.5f,1.0);
     glVertex3f(-0.5f,-0.5f,-1.0);
     glVertex3f(-0.5f,0.5f,-1.0);
     glEnd();
     glPopMatrix();
}
 
void affichage()
{
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
     glLoadIdentity();
     gluLookAt(0,1,2.0, 0,0,0, 0,1,0);
     sol();
     caisse();
     glutSwapBuffers();
     rot+=0.1f;
}
 
void reshape(int w, int h) 
{
     glViewport ( 0, 0, ( GLsizei ) w, ( GLsizei ) h ) ;
     glMatrixMode ( GL_PROJECTION ) ; glEnd ();
     glLoadIdentity ( ) ;
     gluPerspective ( 60, ( GLfloat ) w / ( GLfloat ) h, 1.0, 100.0 ) ;
     glMatrixMode ( GL_MODELVIEW ) ; 
     glEnd ();
} 
 
int main(int argc, char *argv[])
{
    glutInit( &argc, argv);
    glutInitWindowPosition(100,100);
    glutInitWindowSize(640,480);
    glutInitDisplayMode(GLUT_DOUBLE);
    glutCreateWindow("OpenGL/Glut");
 
    glutDisplayFunc(affichage);
    glutIdleFunc(affichage);
    glutReshapeFunc(reshape);
 
    glutMainLoop();
    return 0;
}
L'erreur du compilateur est la suivante : 15 C:\Dev-Cpp\main.cpp `loadTexture' undeclared (first use this function)

Je ne vois pas trop comment procéder pour inialiser une texture et l'afficher ..

Merci bien