[SDL] SDL in Linux with X window system

Ollbert ollbert at gmx.de
Tue Jul 13 07:44:35 PDT 2010

It is nice to have my programs run in Windows and Linux. SDL can help here.

There was one frustrating thing, when running a first example in linux: I got tearing-effects and couldn't get rid of them for a few days.

I read, that SDL doesn't support vsync in Linux, becouse X11 doesn't and root rights would be requiered to get a direct hardware surface. And of course, no app should run with root rights, if it doesn't really need to.

There was another hint, that using OpenGL with SDL could  help around that problem. And it does! using double buffering within OpenGL enables vsync by default. But, only if your Grafics-driver is setup to do that. And mine per default was not.

In the "NVIDIA X Server Settings > OpenGL Settings" I could setup "Sync to VBlank" and after that: I could setup with SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); wheater or not I want to have vsync. I think 1 is default. But it only helps, when your graphics-driver is correctly setup. And I also read about graphic-drivers which don't support this. I hope they are dying out.

Maybe this helps someone.

But I also have a question. Since I just start experimenting:
Are there other features, I would get problems within Linux?
Is it for some case bad to have no hardware-surface even with using OpenGL?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20100713/cc71d4d7/attachment-0007.htm>

More information about the SDL mailing list