[SDL] SDL in Linux with X window system

Christian Leger chrism.leger at gmail.com
Fri Jul 16 02:25:32 PDT 2010


Hi,

I've worked on this very issue for a while, and have a possible solution.
Look up the glXSwapIntervalSGI() function. As far as I know, it's not part
of either SDL or the OpenGL standard, but is an extension provided by my
NVIDIA drivers. Whether or not you can use the same or a similar function if
you have ATI or integrated graphics is a mystery to me because all my
machines happen to be NVIDIA. A similar function, wglSwapIntervalEXT, seems
to do the exact same thing in windows, although requires more effort to be
able to use it.

Let us know if that helped!

Christian

On Tue, Jul 13, 2010 at 10:44 AM, Ollbert <ollbert at gmx.de> wrote:

>  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?
>
> Greetings
> Oliver
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20100716/ef05278c/attachment-0008.htm>


More information about the SDL mailing list