SDL and OpenGL, should it be so slow?

Started by
28 comments, last by DuncanBojangles 20 years, 5 months ago
I''m using Linux and SDL to get an OpenGL rendering context. I just came from the rabbit-hole known as Windows and my programs ran okay. Now that I''m using SDL, though, it runs very slowly! Has this happened to anyone else? I used the code that SDL had in their documentation and I can''t find any glaring bottlenecks. Does anyone know why this might be happening? Oh, and it definitely isn''t the graphics card, ''cause I don''t have one "Donkey, if it were me, you''d be dead." I cna ytpe 300 wrods pre mniute.
"Donkey, if it were me, you'd be dead."I cna ytpe 300 wrods pre mniute.
Advertisement
What is your code doing? how fast is it running?

And, um, if you don''t have a graphics card, how can you see the screen to type? Last I checked, computers didn''t usually have line printers anymore.

How appropriate. You fight like a cow.
Heh, I meant that I didn't have a good graphics card. The graphics capabilities I have are built into the motherboard of my computer. My computer is not top of the line, but it usually isn't this slow, even when they are my programs! All my program does is create a doublebuffered RGB OpenGL rendering context and spins a cube! Terribly slow, I believe at around 3 - 5 frames per second. I'm not sure, but you might be able to find the code I'm using on SDL's site, libSDL.org .

"Donkey, if it were me, you'd be dead."
I cna ytpe 300 wrods pre mniute.

[edited by - duncanbojangles on October 22, 2003 5:43:52 PM]
"Donkey, if it were me, you'd be dead."I cna ytpe 300 wrods pre mniute.
Maybe the problem is that your linux has no hw accelerated OpenGL drivers for your graphics card. Does everything run fine in Windows? Also using SDL?
What kind of chipset is it?
edit: try running 'glxgears' in X, see if it works ok.

SwSh website!

[edited by - SwSh on October 22, 2003 5:51:35 PM]
Everything ran fine in Windows, but I was using GLUT. Glxgears also runs fine. Is there another option to obtain a rendering context for OpenGL without SDL? The chipset is a generic SiS and I''m running Slackware 9.0.

"Donkey, if it were me, you''d be dead."
I cna ytpe 300 wrods pre mniute.
"Donkey, if it were me, you'd be dead."I cna ytpe 300 wrods pre mniute.
Well, you could use Glut in linux too. Or make your hands dirty by using pure X calls, but that sounds like black magic to me.
edit: also, what do you get when you run 'glxinfo' ?
If you get an error saying that the GLX extension could not be found, that means you don't have hardware accelerated drivers for OpenGL in linux.
edit: uh, yeah, you probably have GLX, otherwise you couldn't run glxgears. I need some sleep

SwSh website!

[edited by - SwSh on October 22, 2003 6:37:15 PM]

[edited by - SwSh on October 22, 2003 6:40:20 PM]
Well, after finally using my 2 week old GLUT that I couldn''t get to work, I realized I forgot to link to the X libraries. Stupid me! Oh, SDL and OpenGL don''t mix. I tried out OpenGL with GLUT, so much better. Now I have to port all my programs from Windows to Linux. Shouldn''t be too hard, except for GetAsyncKeyState( ) ;
Thanks for all your help, though!

"Donkey, if it were me, you''d be dead."
I cna ytpe 300 wrods pre mniute.
"Donkey, if it were me, you'd be dead."I cna ytpe 300 wrods pre mniute.
Hmm, thats odd. SDL works great with OpenGL for me (under Linux and Windows). SDL just creates the OpenGL context for you and gets out of the way (except for its I/O and audio APIs you might want to use).

SDL is much more reasonable for games than GLUT I believe.

Take it easy.
Last I checked, SDL created the OpenGL context the old way on Windows, without using WGL_ARB_pixel_format, which pretty much prevents you from using pbuffers or other advanced GL features. Did they fix that?
enum Bool { True, False, FileNotFound };
Hey Anonymous Poster, are you using basically the same code that the SDL documentation uses? I tried it and it takes forever for it to handle events such as keypresses. Just using GLUT is okay for me, because most of my programs aren''t that intensive. By the way, what kind of hardware acceleration do you have?

"Donkey, if it were me, you''d be dead."
I cna ytpe 300 wrods pre mniute.
"Donkey, if it were me, you'd be dead."I cna ytpe 300 wrods pre mniute.

This topic is closed to new replies.

Advertisement