Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1004 connectés 

  FORUM HardWare.fr
  Programmation
  C++

  Linux, DSL, Open GL et drivers Nvidia : Probleme

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Linux, DSL, Open GL et drivers Nvidia : Probleme

n°279244
samuelp
Posté le 04-01-2003 à 17:21:25  profilanswer
 

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 :
  1. /* Example of OpenGL rendering through SDL. */
  2.  
  3.   #include <SDL/SDL.h>
  4.   #include <GL/gl.h>
  5.   #include <stdio.h>
  6.   #include <stdlib.h>
  7.  
  8.   int main()
  9.   {
  10.         /* Initialize SDL as usual. */
  11.         if (SDL_Init(SDL_INIT_VIDEO) != 0) {
  12.        printf("Error: %s\n", SDL_GetError());
  13.        return 1;
  14.         }
  15.    
  16.         atexit(SDL_Quit);
  17.    
  18.         /* Enable OpenGL double buffering. */
  19.         SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
  20.    
  21.         /* Set the color depth (16-bit 565). */
  22.         SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
  23.         SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
  24.         SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
  25.    
  26.         /* Create a 640x480, 16 bit window with support for
  27.            OpenGL rendering. Unfortunately we won't know
  28.            whether this is hardware accelerated. */
  29.         if (SDL_SetVideoMode(640, 480, 16, SDL_OPENGL) == NULL) {
  30.        printf("Error: %s\n", SDL_GetError());
  31.        return 1;
  32.         }
  33.    
  34.         /* Set a window title. */
  35.         SDL_WM_SetCaption("OpenGL with SDL!", "OpenGL" );
  36.    
  37.         /* We can now use any OpenGL rendering commands. */
  38.         glViewport(80, 0, 480, 480);
  39.         glMatrixMode(GL_PROJECTION);
  40.         glLoadIdentity();
  41.         glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 100.0);
  42.         glClearColor(0, 0, 0, 0);
  43.         glMatrixMode(GL_MODELVIEW);
  44.         glLoadIdentity();
  45.         glClear(GL_COLOR_BUFFER_BIT);
  46.         glBegin(GL_TRIANGLES);
  47.         glColor3f(1.0, 0, 0);
  48.         glVertex3f(0.0, 1.0, -2.0);
  49.         glColor3f(0, 1.0, 0);
  50.         glVertex3f(1.0, -1.0, -2.0);
  51.         glColor3f(0, 0, 1.0);
  52.         glVertex3f(-1.0, -1.0, -2.0);
  53.         glEnd();
  54.         glFlush();
  55.    
  56.         /* Display the back buffer to the screen. */
  57.         SDL_GL_SwapBuffers();
  58.    
  59.         /* Wait a few seconds. */
  60.         SDL_Delay(5000);
  61.    
  62.         return 0;
  63.   }


 
Pour compiler je fais
 
Code :

Code :
  1. gcc opengl-sdl.c -o open.exe `sdl-config ---libs`
  2.  
  3. ou 
  4. Code :
  5.  
  6.   gcc opengl-sdl.c -o open.exe `sdl-config --cflags --libs` -I/usr/X11R6/include -L/usr/X11R6/lib
  7.  
  8. Voila ce que ça me repond :
  9. Code :
  10.  
  11.   /tmp/ccKVYjh4.o: In function `main':
  12.   /tmp/ccKVYjh4.o(.text+0xf4): undefined reference to `glViewport'
  13.   /tmp/ccKVYjh4.o(.text+0x104): undefined reference to `glMatrixMode'
  14.   /tmp/ccKVYjh4.o(.text+0x10c): undefined reference to `glLoadIdentity'
  15.   /tmp/ccKVYjh4.o(.text+0x14a): undefined reference to `glFrustum'
  16.   /tmp/ccKVYjh4.o(.text+0x15a): undefined reference to `glClearColor'
  17.   /tmp/ccKVYjh4.o(.text+0x16a): undefined reference to `glMatrixMode'
  18.   /tmp/ccKVYjh4.o(.text+0x172): undefined reference to `glLoadIdentity'
  19.   /tmp/ccKVYjh4.o(.text+0x17f): undefined reference to `glClear'
  20.   /tmp/ccKVYjh4.o(.text+0x18c): undefined reference to `glBegin'
  21.   /tmp/ccKVYjh4.o(.text+0x1a0): undefined reference to `glColor3f'
  22.   /tmp/ccKVYjh4.o(.text+0x1be): undefined reference to `glVertex3f'
  23.   /tmp/ccKVYjh4.o(.text+0x1d2): undefined reference to `glColor3f'
  24.   /tmp/ccKVYjh4.o(.text+0x1fa): undefined reference to `glVertex3f'
  25.   /tmp/ccKVYjh4.o(.text+0x20e): undefined reference to `glColor3f'
  26.   /tmp/ccKVYjh4.o(.text+0x23d): undefined reference to `glVertex3f'
  27.   /tmp/ccKVYjh4.o(.text+0x245): undefined reference to `glEnd'
  28.   /tmp/ccKVYjh4.o(.text+0x24a): undefined reference to `glFlush'
  29.   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
mood
Publicité
Posté le 04-01-2003 à 17:21:25  profilanswer
 

n°279255
Taz
bisounours-codeur
Posté le 04-01-2003 à 17:25:05  profilanswer
 

moi je connais pas mais il manque un -llibdynamique

n°279256
samuelp
Posté le 04-01-2003 à 17:25:57  profilanswer
 

++Taz a écrit :

moi je connais pas mais il manque un -llibdynamique


 
Tu peux expliciter ?

n°279259
Taz
bisounours-codeur
Posté le 04-01-2003 à 17:30:23  profilanswer
 

ben ta librairie graphique est dynamique, donc, il faut l'indiquer au laoder
 
quand tu utilises des trucs de <math.h>, tu fais un -lm
pour les phthread, -lpthread, qui link&load aux libm.so et libpthread.so (on va dire sans lib*.a, n'est ce pas)
 
l'option -L indique un path supplémentaire ou chercher ces librairies dynamiques
 
 
fait un 'slocate lib*.so' et ca te donne tout ce que tu as d'installer
 
genre tu trouve /quelquepart/libgl.so
 
alors tu fais gcc -L/quelquepart/ -lgl

n°279260
samuelp
Posté le 04-01-2003 à 17:34:33  profilanswer
 

++Taz a écrit :

ben ta librairie graphique est dynamique, donc, il faut l'indiquer au laoder
 
quand tu utilises des trucs de <math.h>, tu fais un -lm
pour les phthread, -lpthread, qui link&load aux libm.so et libpthread.so (on va dire sans lib*.a, n'est ce pas)
 
l'option -L indique un path supplémentaire ou chercher ces librairies dynamiques
 
 
fait un 'slocate lib*.so' et ca te donne tout ce que tu as d'installer
 
genre tu trouve /quelquepart/libgl.so
 
alors tu fais gcc -L/quelquepart/ -lgl


 
Oki, j'ai pas de slocate, va falloir que je fouille avec un find

n°279261
Taz
bisounours-codeur
Posté le 04-01-2003 à 17:34:38  profilanswer
 

si tu veux faire ta propre lib dynamique
 
exemple
 


gcc -c -shared -o libFOO.so FOO.c
gcc -c main.c
gcc -L./ -lFOO main.o

n°279262
Taz
bisounours-codeur
Posté le 04-01-2003 à 17:35:06  profilanswer
 

locate alors?

n°279290
samuelp
Posté le 04-01-2003 à 18:17:04  profilanswer
 

++Taz a écrit :

locate alors?


 
fallait rajouter -lGL
 
Encore merci taz@PPC euh ++Taz :D :hello:

n°279294
Taz
bisounours-codeur
Posté le 04-01-2003 à 18:18:02  profilanswer
 

:hello:


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C++

  Linux, DSL, Open GL et drivers Nvidia : Probleme

 

Sujets relatifs
[mySQL] Problème de requête avec count(*) [résolu]Problème de liens
Probleme avec une pile en c ???[PHP] Problème de "mise à jour" [résolu]
kdevelop : problème de breakpointProbleme avec mon menu ....
Probleme avec des espaces... [ Resolu ][PHP] Probleme avec exec() positionné dans une boucle...[resolu]
[CSS] Contourner le problème "fixed" pour le défilement avec IE[open gl] pourquoi mon programme n'affiche rien ?
Plus de sujets relatifs à : Linux, DSL, Open GL et drivers Nvidia : Probleme


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR