2D graphics with OpenGL

Hi,

I’m experimenting with 2D graphics on top of OpenGL (so as to get
hardware acceleration under X11), and I see there are 2 existings
solutions that works with SDL:

  • glSDL
  • SDL… 1.3 :slight_smile:

However I didn’t find how one should use them, and how they differ.

Do you know about their rationale / philosophy?
(or even, if I may, documentation links? ;))–
Sylvain

I could be wrong, but I don’t think glSDL is maintained anymore. It
was developed because SDL 1.2 didn’t have good GL support. 1.3
does, and if you’re just getting started with SDL and don’t have a
legacy codebase to maintain, you’d be better off with SDL 1.3.>----- Original Message ----

From: Sylvain Beucler
Subject: [SDL] 2D graphics with OpenGL

Hi,

I’m experimenting with 2D graphics on top of OpenGL (so as to get
hardware acceleration under X11), and I see there are 2 existings
solutions that works with SDL:

  • glSDL
  • SDL… 1.3 :slight_smile:

However I didn’t find how one should use them, and how they differ.

Do you know about their rationale / philosophy?
(or even, if I may, documentation links? ;))

You are wrong, but not about glSDL maintenance. glSDL is no longer
maintained, but this is largely because it was an experiment with what
ultimately did become the future OpenGL video back end in SDL.

SDL 1.2 has good OpenGL support. It does not back SDL surfaces with
OpenGL textures, however.On Tue, Jun 16, 2009 at 12:38 PM, Mason Wheeler wrote:

I could be wrong, but I don’t think glSDL is maintained anymore. ?It
was developed because SDL 1.2 didn’t have good GL support. ?1.3
does, and if you’re just getting started with SDL and don’t have a
legacy codebase to maintain, you’d be better off with SDL 1.3.


http://codebad.com/

I’m not a reference, a I only started playing with it yesterday :stuck_out_tongue:

But I am getting most of my information from the test/testsprite2.c file from SDL 1.3.

You can get it from:
http://www.libsdl.org/svn.php

Just know that it is still incomplete, and certain things do not work (last I checked, full-screen didn’t work properly with X11), but if it’s for a hobbyist project, not on a deadline, I would go with this :slight_smile:

Pat> ----- Original Message -----

From: Mason Wheeler
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Tuesday, June 16, 2009 11:38:20 AM
Subject: Re: [SDL] 2D graphics with OpenGL

I could be wrong, but I don’t think glSDL is maintained anymore. It
was developed because SDL 1.2 didn’t have good GL support. 1.3
does, and if you’re just getting started with SDL and don’t have a
legacy codebase to maintain, you’d be better off with SDL 1.3.

----- Original Message ----
From: Sylvain Beucler
Subject: [SDL] 2D graphics with OpenGL

Hi,

I’m experimenting with 2D graphics on top of OpenGL (so as to get
hardware acceleration under X11), and I see there are 2 existings
solutions that works with SDL:

  • glSDL
  • SDL… 1.3 :slight_smile:

However I didn’t find how one should use them, and how they differ.

Do you know about their rationale / philosophy?
(or even, if I may, documentation links? ;))


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yes, glSDL is no longer actively developed (says its homepage) but I
was interested into understanding how it was meant to be used. It was
supposed to be more or less transparent for the programmer, wasn’t it?On Tue, Jun 16, 2009 at 12:44:23PM -0400, Donny Viszneki wrote:

On Tue, Jun 16, 2009 at 12:38 PM, Mason Wheeler wrote:

I could be wrong, but I don’t think glSDL is maintained anymore. ?It
was developed because SDL 1.2 didn’t have good GL support. ?1.3
does, and if you’re just getting started with SDL and don’t have a
legacy codebase to maintain, you’d be better off with SDL 1.3.

You are wrong, but not about glSDL maintenance. glSDL is no longer
maintained, but this is largely because it was an experiment with what
ultimately did become the future OpenGL video back end in SDL.

SDL 1.2 has good OpenGL support. It does not back SDL surfaces with
OpenGL textures, however.


Sylvain

Thanks, I didn’t see this file.

So apparently when we store images on the card memory, we declare them
with the *Texture functions, instead of using SDL_HWSURFACE.

As for glSDL, I also found this:
http://icps.u-strasbg.fr/~marchesin/sdl/glsdl.htmlOn Tue, Jun 16, 2009 at 09:46:22AM -0700, Patryk Bratkowski wrote:

I’m not a reference, a I only started playing with it yesterday :stuck_out_tongue:

But I am getting most of my information from the test/testsprite2.c file from SDL 1.3.

You can get it from:
http://www.libsdl.org/svn.php

Just know that it is still incomplete, and certain things do not
work (last I checked, full-screen didn’t work properly with X11),
but if it’s for a hobbyist project, not on a deadline, I would go
with this :slight_smile:


Sylvain

I recommend you just use OpenGL directly, and rely on SDL ‘only’ for setting
up OpenGL, input and audio. Check out
http://svn.berlios.de/svnroot/repos/gltron/trunk/nebu/video/2d.c for some
very lightweight 2d stuff in OpenGL.

  • Andreas

What would be the advantage of that over SDL 1.3 with Textures?

Pat________________________________
From: umbach@gmail.com (Andreas Umbach)
To: A list for developers using the SDL library. (includes SDL-announce)
Sent: Tuesday, June 16, 2009 2:53:43 PM
Subject: Re: [SDL] 2D graphics with OpenGL

I recommend you just use OpenGL directly, and rely on SDL ‘only’ for setting up OpenGL, input and audio. Check out http://svn.berlios.de/svnroot/repos/gltron/trunk/nebu/video/2d.c for some very lightweight 2d stuff in OpenGL.

  • Andreas

Pros: relying on a stable, widespread, packaged SDL version
Cons: do all the optimizations/tricks yourself

:slight_smile:

On a similar topic I found this article with is a nice summary (except
it does the blit with polygons instead of quads):
http://www.andyofniall.net/2d-graphics-with-opengl/

Remain the texture/coord flips, the power-of-two work-arounds, etc.–
Sylvain

On Tue, Jun 16, 2009 at 12:57:30PM -0700, Patryk Bratkowski wrote:

What would be the advantage of that over SDL 1.3 with Textures?


From: Andreas Umbach
Sent: Tuesday, June 16, 2009 2:53:43 PM

I recommend you just use OpenGL directly, and rely on SDL ‘only’ for
setting up OpenGL, input and audio. Check out
http://svn.berlios.de/svnroot/repos/gltron/trunk/nebu/video/2d.c for
some very lightweight 2d stuff in OpenGL.

I thought 1.3 was supposed to have OpenGL accelerated 2D backend to the
standard SDL functions as Donny stated, this did make the list right? I
would think the user end code wouldn’t look very much different from 1.2 yet
would be accelerated. I’ve been using QT/GL lately(due to some GUI
requirements) but have been trying to follow this list when I can.

Other than that, my previous experience with SDL/OpenGL is the same as
Andreas Umbach, use SDL to set things up and probably input/output, but do
the rest of it in GL.

Well, it’d be a pity that the video part of SDL 1.3 get not used by previous 1.2 developers. I didn’t dig into 1.3 yet, the only test I made was not satisfying at all (cf. thread on SDL_Layer with an important? down in frame rates, without changing the code).
Moreover there seem to be a great competitor in the arena of OpenGL based libraries with general purpose multimedia functions, called SFML.

So the idea of using SDL to setup and use pure OpenGL for graphics seems justified, or switch to another multimedia library for people who don’t want to go deep into opengl.

I hope 1.3 will stay as good as 1.2 was when opengl was not the new religion. But now it seems to be the standard everywhere even for 2D so if 1.3 cannot catch up with it in a clear and efficient way, it’ll be a failure … and maybe I won’t stick with it any longer.

Julien

— En date de?: Jeu 18.6.09, Jonathan Greig a ?crit?:de: Jonathan Greig
Objet: Re: [SDL] 2D graphics with OpenGL
?: “A list for developers using the SDL library. (includes SDL-announce)”
Date: Jeudi 18 Juin 2009, 8h10

I thought 1.3 was supposed to have OpenGL accelerated 2D backend to the
standard SDL functions as Donny stated, this did make the list right? I would think the user end code wouldn’t look very much different from 1.2 yet would be accelerated. I’ve been using QT/GL lately(due to some GUI requirements) but have been trying to follow this list when I can.

Other than that, my previous experience with SDL/OpenGL is the same as
Andreas Umbach, use SDL to set things up and probably input/output, but
do the rest of it in GL.

-----La pi?ce jointe associ?e suit-----


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

there seem to be a great competitor in the arena of OpenGL based
libraries with general purpose multimedia functions, called SFML.

Yes, but SDL is C, while SFML is C++. It’s relatively easy to use C
functions from C++, but it’s not that simple the other way around.

Zoltan

I have used sfml once, not that bad, needs work, not as mature as sdl.

In particular, its lacking idle capabilities. Cpu was always maxed.

mattOn Fri, 19 Jun 2009, Zolt??n K??csi wrote:

there seem to be a great competitor in the arena of OpenGL based
libraries with general purpose multimedia functions, called SFML.

Yes, but SDL is C, while SFML is C++. It’s relatively easy to use C
functions from C++, but it’s not that simple the other way around.

Zoltan