samuelp | Bonjour,
j'ai un probleme pour l'execution d'un programme de test afin de vérifier la fonctionnalité Open GL avec SDL
Voici le programme :
Code :
Code :
- /* Example of OpenGL rendering through SDL. */
-
- #include <SDL/SDL.h>
- #include <GL/gl.h>
- #include <stdio.h>
- #include <stdlib.h>
-
- int main()
- {
- /* Initialize SDL as usual. */
- if (SDL_Init(SDL_INIT_VIDEO) != 0) {
- printf("Error: %s\n", SDL_GetError());
- return 1;
- }
-
- atexit(SDL_Quit);
-
- /* Enable OpenGL double buffering. */
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-
- /* Set the color depth (16-bit 565). */
- SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
- SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
-
- /* Create a 640x480, 16 bit window with support for
- OpenGL rendering. Unfortunately we won't know
- whether this is hardware accelerated. */
- if (SDL_SetVideoMode(640, 480, 16, SDL_OPENGL) == NULL) {
- printf("Error: %s\n", SDL_GetError());
- return 1;
- }
-
- /* Set a window title. */
- SDL_WM_SetCaption("OpenGL with SDL!", "OpenGL" );
-
- /* We can now use any OpenGL rendering commands. */
- glViewport(80, 0, 480, 480);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0);
- glClearColor(0, 0, 0, 0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glClear(GL_COLOR_BUFFER_BIT);
- glBegin(GL_TRIANGLES);
- glColor3f(1.0, 0, 0);
- glVertex3f(0.0, 1.0, -2.0);
- glColor3f(0, 1.0, 0);
- glVertex3f(1.0, -1.0, -2.0);
- glColor3f(0, 0, 1.0);
- glVertex3f(-1.0, -1.0, -2.0);
- glEnd();
- glFlush();
-
- /* Display the back buffer to the screen. */
- SDL_GL_SwapBuffers();
-
- /* Wait a few seconds. */
- SDL_Delay(5000);
-
- return 0;
- }
|
Pour compiler je fais
Code :
Code :
- gcc opengl-sdl.c -o open.exe `sdl-config ---libs`
-
- ou
- Code :
-
- gcc opengl-sdl.c -o open.exe `sdl-config --cflags --libs` -I/usr/X11R6/include -L/usr/X11R6/lib
-
- Voila ce que ça me repond :
- Code :
-
- /tmp/ccKVYjh4.o: In function `main':
- /tmp/ccKVYjh4.o(.text+0xf4): undefined reference to `glViewport'
- /tmp/ccKVYjh4.o(.text+0x104): undefined reference to `glMatrixMode'
- /tmp/ccKVYjh4.o(.text+0x10c): undefined reference to `glLoadIdentity'
- /tmp/ccKVYjh4.o(.text+0x14a): undefined reference to `glFrustum'
- /tmp/ccKVYjh4.o(.text+0x15a): undefined reference to `glClearColor'
- /tmp/ccKVYjh4.o(.text+0x16a): undefined reference to `glMatrixMode'
- /tmp/ccKVYjh4.o(.text+0x172): undefined reference to `glLoadIdentity'
- /tmp/ccKVYjh4.o(.text+0x17f): undefined reference to `glClear'
- /tmp/ccKVYjh4.o(.text+0x18c): undefined reference to `glBegin'
- /tmp/ccKVYjh4.o(.text+0x1a0): undefined reference to `glColor3f'
- /tmp/ccKVYjh4.o(.text+0x1be): undefined reference to `glVertex3f'
- /tmp/ccKVYjh4.o(.text+0x1d2): undefined reference to `glColor3f'
- /tmp/ccKVYjh4.o(.text+0x1fa): undefined reference to `glVertex3f'
- /tmp/ccKVYjh4.o(.text+0x20e): undefined reference to `glColor3f'
- /tmp/ccKVYjh4.o(.text+0x23d): undefined reference to `glVertex3f'
- /tmp/ccKVYjh4.o(.text+0x245): undefined reference to `glEnd'
- /tmp/ccKVYjh4.o(.text+0x24a): undefined reference to `glFlush'
- collect2: ld returned 1 exit status
|
J'utilise les drivers Nvidia et a priori il me faut Mesa (qui n'est pas compatible avec les drivers Nvidia)
Les libs nvidias se trouvent dans :
/usr/include/GL
J'ai essayer de changer le chemin de l'option -L avec celui de mes libs nvidia mais rien à faire
QQn a une idee ? Message édité par samuelp le 04-01-2003 à 17:22:02
|