SDL Without X Windows System

Hello!

I’ve just been getting into Linux programming (in general) and SDL. I
really, really like SDL, but I’m not especially fond of the X Windows
System. Is there any way to use SDL without it? To get the OpenGL rendering
contexts, the input, the audio, etc, or is everything that SDL uses based
heavily around X? It’s not that I mind the very small overhead X can
provide, it’s more that I just really don’t like the way it deals with
things.

Anyway, that’s all I’m wondering. Thankee for your time. :)—
Felix (axilor at yahoo.com / @Felix_Haquejiel)

Using OpenGL under pretty much any Unix system (except OS X) implies
using GLX contexts under the X windowing system, so you have no choice
here.

But OpenGL aside, yes, SDL has many other 2D display targets available
under Linux, including framebuffer console, and some more old and/or
arcane methods, like svgalib. SDL is designed to automatically select
an appropriate 2D display backend depending on what it can find, so as
long as it’s compiled in, SDL can use it.

(I’ve once run UT2004 in software rendering mode right on my
framebuffer console, without X running. It didn’t run very well, but
was pretty cool to see it working.)

  • SROn 9/6/05, Felix Haquejiel wrote:

Hello!

I’ve just been getting into Linux programming (in general) and SDL. I
really, really like SDL, but I’m not especially fond of the X Windows
System. Is there any way to use SDL without it? To get the OpenGL rendering
contexts, the input, the audio, etc, or is everything that SDL uses based
heavily around X? It’s not that I mind the very small overhead X can
provide, it’s more that I just really don’t like the way it deals with
things.

Anyway, that’s all I’m wondering. Thankee for your time. :slight_smile:

Le Tue, 6 Sep 2005 15:56:13 -0500
Felix Haquejiel a ?crit:

I’ve just been getting into Linux programming (in general) and SDL. I
really, really like SDL, but I’m not especially fond of the X Windows
System. Is there any way to use SDL without it? To get the OpenGL
rendering contexts, the input, the audio, etc, or is everything that
SDL uses based heavily around X? It’s not that I mind the very small
overhead X can provide, it’s more that I just really don’t like the
way it deals with things.

You can have OpenGL support without X (at least under Linux):

  • either use OSMesa which is software rendering only. It could be easy
    to add this to the framebuffer SDL driver. Mesa has support for svgalib,
    but I don’t know how it could integrate the svgalib SDL driver. We could
    add osmesa support for all targets as a default OpenGL driver.

  • or add directfbgl support to the directfb SDL driver (this is a glx
    emulation layer), there is hardware accelerated drivers for just a few
    video cards:
    http://www.directfb.org/index.php?path=Development%2FProjects%2FDirectFBGL--
    Patrice Mandin
    WWW: http://pmandin.atari.org/
    Programmeur Linux, Atari
    Sp?cialit?: D?veloppement, jeux

— Felix Haquejiel wrote:

Hello!

I’ve just been getting into Linux programming (in general) and SDL. I

really, really like SDL, but I’m not especially fond of the X Windows

System. Is there any way to use SDL without it? To get the OpenGL
rendering
contexts, the input, the audio, etc, or is everything that SDL uses
based
heavily around X? It’s not that I mind the very small overhead X can
provide, it’s more that I just really don’t like the way it deals
with
things.

Anyway, that’s all I’m wondering. Thankee for your time. :slight_smile:

You can use the Linux framebuffer with SVGALib or DirectFB. I have used
those but I haven’t used OpenGL.

Regards
Javier Soques__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Patrice Mandin wrote:

Le Tue, 6 Sep 2005 15:56:13 -0500
Felix Haquejiel a ?crit:

I’ve just been getting into Linux programming (in general) and SDL. I
really, really like SDL, but I’m not especially fond of the X Windows
System. Is there any way to use SDL without it? To get the OpenGL
rendering contexts, the input, the audio, etc, or is everything that
SDL uses based heavily around X? It’s not that I mind the very small
overhead X can provide, it’s more that I just really don’t like the
way it deals with things.

You can have OpenGL support without X (at least under Linux):

  • either use OSMesa which is software rendering only. It could be easy
    to add this to the framebuffer SDL driver. Mesa has support for svgalib,
    but I don’t know how it could integrate the svgalib SDL driver. We could
    add osmesa support for all targets as a default OpenGL driver.

  • or add directfbgl support to the directfb SDL driver (this is a glx
    emulation layer), there is hardware accelerated drivers for just a few
    video cards:
    http://www.directfb.org/index.php?path=Development%2FProjects%2FDirectFBGL

There’s a third solution :

  • implement OpenGL in the fbcon backend, using Mesa’s miniglx (OpenGL
    over the framebuffer). This is limited to DRI-supported video cards but
    works fine and is hardware-accelerated. Actually, I had some code to do
    that somewhere and it even worked somehow, but I can’t seem to find it
    any more :frowning:

Stephane

You can have OpenGL support without X (at least under Linux):

  • either use OSMesa which is software rendering only. It could be easy
    to add this to the framebuffer SDL driver. Mesa has support for svgalib,
    but I don’t know how it could integrate the svgalib SDL driver. We could
    add osmesa support for all targets as a default OpenGL driver.

  • or add directfbgl support to the directfb SDL driver (this is a glx
    emulation layer), there is hardware accelerated drivers for just a few
    video cards:
    http://www.directfb.org/index.php?path=Development%2FProjects%2FDirectFBGL

There’s a third solution :

  • implement OpenGL in the fbcon backend, using Mesa’s miniglx (OpenGL
    over the framebuffer). This is limited to DRI-supported video cards but
    works fine and is hardware-accelerated. Actually, I had some code to do
    that somewhere and it even worked somehow, but I can’t seem to find it
    any more :frowning:

Ah, I finally found it :
http://icps.u-strasbg.fr/~marchesin/sdl/sdl_fb_miniglx.patch

Stephane

Cool. Nice to see I was wrong when I said that (hardware accelerated)
OpenGL under Linux is limited to X11.

I really doubt any of those solutions work on nVidia hardware though.
Which is what most people playing games under Linux have.

And X11 isn’t THAT bad anyway. Creating a window from the lowest-level
API is basically just as complicated under Windows. But with GUI
toolkits and SDL, who needs to do that anyway?

  • SROn 9/13/05, Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

Patrice Mandin wrote:

You can have OpenGL support without X (at least under Linux):

  • either use OSMesa which is software rendering only. It could be easy
    to add this to the framebuffer SDL driver. Mesa has support for svgalib,
    but I don’t know how it could integrate the svgalib SDL driver. We could
    add osmesa support for all targets as a default OpenGL driver.

  • or add directfbgl support to the directfb SDL driver (this is a glx
    emulation layer), there is hardware accelerated drivers for just a few
    video cards:
    http://www.directfb.org/index.php?path=Development%2FProjects%2FDirectFBGL

There’s a third solution :

  • implement OpenGL in the fbcon backend, using Mesa’s miniglx (OpenGL
    over the framebuffer). This is limited to DRI-supported video cards but
    works fine and is hardware-accelerated. Actually, I had some code to do
    that somewhere and it even worked somehow, but I can’t seem to find it
    any more :frowning: