Voilà, j'essaie de me mettre à la programmation openGL, et malheureusement code::blocks n'arrête pas de me crier dessus... :'( si quelqu'un pouvait me dire ce qui cloche dans ce code source, ça serait sympa...
Je suppose que c'est un problème évident mais j'arrive pas à le résoudre...
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 #ifdef __cplusplus #include <cstdlib> #else #include <stdlib.h> #endif #ifdef __APPLE__ #include <SDL/SDL.h> #else #include <SDL.h> #endif #include <GL/gl.h> #include <GL/glu.h> #include "glext.h" int main ( int argc, char** argv ) { // initialize SDL video if ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { printf( "Unable to init SDL: %s\n", SDL_GetError() ); return 1; } // make sure SDL cleans up before exit atexit(SDL_Quit); // create a new window SDL_Surface* openGLContext = SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE|SDL_OPENGL); if ( !openGLContext ) { printf("Unable to set 640x480 video: %s\n", SDL_GetError()); return 1; } // création du cell-shading GLuint fragmentShader; GLuint vertexShader; vertexShader = glCreateShader(GL_VERTEX_SHADER); fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); glDeleteShader(fragmentShader); glDeleteShader(vertexShader); fragmentShader = 0; vertexShader = 0; // FAIRE QQCH ICI // program main loop bool done = false; while (!done) { // message processing loop SDL_Event event; while (SDL_PollEvent(&event)) { // check for messages switch (event.type) { // exit if the window is closed case SDL_QUIT: done = true; break; // check for keypresses case SDL_KEYDOWN: { // exit if ESCAPE is pressed if (event.key.keysym.sym == SDLK_ESCAPE) done = true; break; } } // end switch } // end of message processing } // all is well ;) printf("Exited cleanly\n"); return 0; }
Et voici les injures de code::blocks :
"Error, GL_VERTEX_SHADER was not declared in this scope."
Cette erreur est présent une fois pour chaque élément : GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, glCreateShader(), glDeleteShader()...
Je comprend bien ce que veux dire "not defined in this scope" mais je vois pas pourquoi... j'ai zappé un préfixe ou quelque-chose dans le genre ?? Je suis perdu, toute aide est là bienvenue !!
Merci d'avance
Partager