![]() |
OpenGL and SDL programming with Slackware
Hey all,
I've been trying to get my OpenGL programs (some of which make heavy use of SDL and SDL_mixer) to compile on Slackware (9.1 and 10.0), but no luck so far. I've tried all the various make variations as suggested by the glut-3.7 README file and the SDL README files, I've tried moving the header files around into various directories, but no luck so far. Since my error messages keep changing and are very numerous, I shall refrain from posting them here for now. My main question really is if anyone here has been able to code, compile and run programs that use both OpenGL and SDL on a Slackware distro. I know it works on SuSE and the like, but I've just never been able to get it to work on Slack. Getting it to work in Windows is a breeze of course, but *blegh* basically. Who wants their hands held anyway? ;) Well, off to :study: .... I'll be hoping to hear from at least one person with a success story. :) -zsejk |
I really don't know whats the problem but I've compiled several OpenGL-SDL applications and not a problem so.. that's my succes story
|
Hehehe.... that's really all I needed, someone to tell me it *is* possible.
:) The main issues are libraries that can't be found, GLUT functions not working, SDL_audio.h being unfindable even though it's in the same directory as SDL.h, etc. Basically there's something new every time I try to recompile or move stuff around. I guess I just have to keep tinkering until it works. One question though: did you use the SDL stuffs already in Slackware, or did you get packages from libsdl.org? Same question for glut: did you go to the OpenGL site and download the glut package (3.7 say), or do you use the glut stuffs already in Slack? Thanks!!! -zsejk |
SDL does not require glut to run open GL as far I know (but glu.h instead)
Try use these flags : Code:
gcc `sdl-config --cflags --libs` -L/usr/X11R6/lib -lGL -lGLU -lpthread -o program program.c |
Hey,
Thanks for that, I'll try it in a few minutes (have to eat some breakfast first). The reason I need glut.h though is because I use stuff like glutIdleFunc and glutSwapBuffers etc. :) -zsejk |
Quote:
|
Good question! :) Basically in the program I'm trying to run I used SDL for the sound effects and glut for the other stuff. I also use glu and regular gl of course, so basically it's the one program I want to get running. 'Cause if *it* runs, everything will run.
-zsejk |
Quote:
Code:
bash-2.05b$ make program:scratch: -zsejk |
You need to link the X libraries to, try adding the following flags : -lX11 -lXmu
If you still get undefined references run ldd /usr/X11R6/lib/libglut.so This will give you a list of libraries glut needs, then it's just a matter of linking the ones which are missing. |
I feel it a little curious to use both glut and sdl libraries in a program as all glut functions have an equivalent in SDL
|
Quote:
:) And Cedrik... I don't think GLUT provides sound events... does it? Which doesn't make it necessary to use GLUT, I realize that (just use SDL right?), but I have some programs using GLUT and not SDL, which I really don't feel like changing. So whether or not GLUT and SDL end up being able to work together in the same program, the very *least* thing I need is for GLUT to work by itself. -zsejk |
did you put -L/usr/X11R6/lib before -lX11 ?
[edit] From man glut : An example X11/Unix compile line would look like: cc -o foo foo.c -lglut -lGLU -lGL -lXmu -lXi -lXext -lX11 -lm |
Yeah, that's actually what I started out with. It can't find the -Xext though, but I will try your solution about the order of things. Right after I get Slakcware re-installed, that is.
:) -zsejk |
Well, you all were right... I was wrong. Nothing needs to be done to get this to work in Slackware 10.0. Especially make sure you don't go installing GLUT by downloading it somewhere, because you'll likely be messing up links and libraries that are best left alone.
In a fresh Slackware install, my makefile looks as follows: Code:
CC = g++Code:
#include <GL/glut.h>-zsejk |
| All times are GMT -5. The time now is 05:30 PM. |