glSDL

I’ve recently read some posts talking about glSDL.
What’s exactly glSDL?
Is it an implementation of SDL over OpenGL?

I’ve searched on Google about glSDL and I haven’t got any good answer.
Where can I get it?

thanks

santi

I’ve recently read some posts talking about glSDL.
What’s exactly glSDL?
Is it an implementation of SDL over OpenGL?

Yep, that’s basically it. The version currently available is a source
level wrapper, and uses some #defines to redirect some SDL calls to
glSDL calls. SDL is still used for everything but blits that involve
the display surface.

glSDL abuses the ‘unused1’ field of the SDL_Surface struct to hook
surfaces up with OpenGL “texture info” structs. It’s recommended that
you use SDL 1.2.5 or later with glSDL, as older versions leave that
field uninitialized.

I’ve searched on Google about glSDL and I haven’t got any good
answer. Where can I get it?

The latest wrapper version can be found here:

http://olofson.net/mixed.html

//David Olofson - Programmer, Composer, Open Source Advocate

.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Saturday 21 June 2003 10.03, Santi Onta??n wrote:

im just wondering on the status of glSDL, how done is it and is there any
rough estimate of a completion/release date?

I’m pretty eager to see it/use it (:

to anyone who knows…

whats the status of glSDl, is it being developed, will it ever be a reality?? (:

also…

does anyone know how glSDL is going to overcome the limitation that makes it so all GL surfaces have to have dimensions that are power of 2?

i hope it isnt going to just mipmap all surfaces…

thanks!
Atrix

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello people,
if someone is interrested we have developped news glSDL
functions for our project. I currently have no site where
to put it in. There is also support for filled rects with
alpha. Mail me if you want it (63kB). The new functions:

void glSDL_SetLineWidth(float width);
void glSDL_SetLineStipple(int factor, Uint16 pattern);

int glSDL_DrawLine(SDL_Surface *dst, Sint16 x1, Sint16 y1,
~ Sint16 x2, Sint16 y2, Uint32 color);
int glSDL_DrawRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFA6zU8eyAGkzgDVa0RAhRoAKCZDiu3LlLyfHAE3XAxiLBDdmD/WwCfVjAc
1y6ODF6YQtQn7up03AeLhiw=
=ODl+
-----END PGP SIGNATURE-----

have you addressed the problem of loading and displaying arbitrary images in
a gl environment (having to have them be powers of 2 dimensions)?

a friend of mine is converting a straight sdl app to sdl/gl to and has LOTS
of art that doesn’t have dimensions that are powers of 2 so im tryin to
scout out some options for him.> ----- Original Message -----

From: nuage@ysagoon.com (Nuage)
To:
Sent: Tuesday, July 06, 2004 4:26 PM
Subject: [SDL] glSDL

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello people,
if someone is interrested we have developped news glSDL
functions for our project. I currently have no site where
to put it in. There is also support for filled rects with
alpha. Mail me if you want it (63kB). The new functions:

void glSDL_SetLineWidth(float width);
void glSDL_SetLineStipple(int factor, Uint16 pattern);

int glSDL_DrawLine(SDL_Surface *dst, Sint16 x1, Sint16 y1,
~ Sint16 x2, Sint16 y2, Uint32 color);
int glSDL_DrawRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFA6zU8eyAGkzgDVa0RAhRoAKCZDiu3LlLyfHAE3XAxiLBDdmD/WwCfVjAc
1y6ODF6YQtQn7up03AeLhiw=
=ODl+
-----END PGP SIGNATURE-----


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Alan Wolfe wrote:

to anyone who knows…

whats the status of glSDl, is it being developed, will it ever be a
reality?? (:

Hum, I’m working on it. However, I’m facing some problems with the
semantics of the SDL_OPENGL flag that have implications all over the SDL
source.
For now, if you want to try using glSDL (especially to optimize your
code for performance) you can use the glSDL wrapper that’s available there :
http://olofson.net/mixed.html

also…

does anyone know how glSDL is going to overcome the limitation that
makes it so all GL surfaces have to have dimensions that are power of 2?

What do you mean when saying “all GL surfaces have to have dimensions
that are power of 2” ? Of course, glSDL handles SDL surfaces or
arbitrary size. But of course at some point it ends up storing those in
one or more OpenGL textures which have the power of 2 limitation. David
wrote a surface tiler which handles this kind of situation (and other
things like working around the OpenGL maximum texture resolution).

i hope it isnt going to just mipmap all surfaces…

No, no mipmaps are used. Don’t you dare thinking that :slight_smile:

Stephane

awesome!

thanks for the info (:> ----- Original Message -----

From: stephane.marchesin@wanadoo.fr (Stephane Marchesin)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Wednesday, July 07, 2004 12:00 AM
Subject: Re: [SDL] glSDL

Alan Wolfe wrote:

to anyone who knows…

whats the status of glSDl, is it being developed, will it ever be a
reality?? (:

Hum, I’m working on it. However, I’m facing some problems with the
semantics of the SDL_OPENGL flag that have implications all over the SDL
source.
For now, if you want to try using glSDL (especially to optimize your
code for performance) you can use the glSDL wrapper that’s available there
:
http://olofson.net/mixed.html

also…

does anyone know how glSDL is going to overcome the limitation that
makes it so all GL surfaces have to have dimensions that are power of 2?

What do you mean when saying “all GL surfaces have to have dimensions
that are power of 2” ? Of course, glSDL handles SDL surfaces or
arbitrary size. But of course at some point it ends up storing those in
one or more OpenGL textures which have the power of 2 limitation. David
wrote a surface tiler which handles this kind of situation (and other
things like working around the OpenGL maximum texture resolution).

i hope it isnt going to just mipmap all surfaces…

No, no mipmaps are used. Don’t you dare thinking that :slight_smile:

Stephane


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

No, for now we have no special system trying to put multiple rectangle
images into a square open-gl texture. We are waiting for the final
video RAM use to know if this worth.

Alan Wolfe wrote:
| have you addressed the problem of loading and displaying arbitrary images in
| a gl environment (having to have them be powers of 2 dimensions)?
|
| a friend of mine is converting a straight sdl app to sdl/gl to and has LOTS
| of art that doesn’t have dimensions that are powers of 2 so im tryin to
| scout out some options for him.
|
| ----- Original Message -----
| From: “Nuage”
| To:
| Sent: Tuesday, July 06, 2004 4:26 PM
| Subject: [SDL] glSDL
|
|
|
| Hello people,
| if someone is interrested we have developped news glSDL
| functions for our project. I currently have no site where
| to put it in. There is also support for filled rects with
| alpha. Mail me if you want it (63kB). The new functions:
|
| void glSDL_SetLineWidth(float width);
| void glSDL_SetLineStipple(int factor, Uint16 pattern);
|
| int glSDL_DrawLine(SDL_Surface *dst, Sint16 x1, Sint16 y1,
| ~ Sint16 x2, Sint16 y2, Uint32 color);
| int glSDL_DrawRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

| _______________________________________________
| SDL mailing list
| SDL at libsdl.org
| http://www.libsdl.org/mailman/listinfo/sdl

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFA6+VseyAGkzgDVa0RAjjFAKC94h2hHxDbcug/c3KMrdVou5QVkQCfYQYZ
e6DDZ8PNKtmNyU4UD650upY=
=c/Wq
-----END PGP SIGNATURE-----

Concerning the GL surface dimension limitations, is it
possible to just allocate larger textures and copy the
contents of would-be SDL surfaces into that, and when
"blitting" those surfaces, you could simply tell GL to
map the texture in such a way that the GL primitive
only shows the portion that we want?

In other words, blit by rendering GL_QUADS, and use
glTexCoord to get the image to line up correctly,
creating the illusion that the SDL surface is actually
being blitted. Is that possible?__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail

Hey Donny,

Yeah it sounds possible (assuming the image isnt too big).

the downside is it wastes memory but the upside is it should be fairly
quick.

WIth the method they have in place already, it subdivides surfaces into
surfaces that are powers of 2.

the downside to that is that you have alot more surfaces used and it should
be slower cause you have to do more blits to get an image on the screen.

the upside is that it’s more memory efficient.

I guess it could have gone either way and they chose the memory efficient
model :P> ----- Original Message -----

From: smxrk@yahoo.com (Donny Viszneki)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Wednesday, July 07, 2004 9:13 PM
Subject: Re: [SDL] glSDL

Concerning the GL surface dimension limitations, is it
possible to just allocate larger textures and copy the
contents of would-be SDL surfaces into that, and when
"blitting" those surfaces, you could simply tell GL to
map the texture in such a way that the GL primitive
only shows the portion that we want?

In other words, blit by rendering GL_QUADS, and use
glTexCoord to get the image to line up correctly,
creating the illusion that the SDL surface is actually
being blitted. Is that possible?


Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hey Donny,

Yeah it sounds possible (assuming the image isnt too big).

the downside is it wastes memory but the upside is it should be fairly
quick.

WIth the method they have in place already, it subdivides surfaces into
surfaces that are powers of 2.

Hum, not exactly. We use an hybrid solution : we choose the next power of 2 size, unless the surface is too big (>256). If the surface is too big, it is the tiled into smaller surfaces.

The non-obvious problem when trying not to waste video memory is the following :
if you want to avoid memory waste, you have to packe multiple small surfaces into a big OpenGL texture. If one of these sub surfaces changes, you have to update it using glTexSubImage2D. On some OpenGL drivers, this works perfectly, i.e. only the changed part of the texture is uploaded to the video card. However, some other OpenGL drivers upload the whole texture. So if the texture is too big, that might give a huge slowdown.

the downside to that is that you have alot more surfaces used and it should
be slower cause you have to do more blits to get an image on the screen.

With big surfaces, tiling is actually speeding up the renedring, since it improves the memory locality of the access (for example, if you have insufficient video memory to hold the big surfaces , only the visible parts of the big surface will stay into the video ram, other parts won’t use up video memory). On smaller surfaces, we measured no speed difference.

Stephane

Hey Donny,

Yeah it sounds possible (assuming the image isnt too big).

the downside is it wastes memory but the upside is it should be fairly
quick.

WIth the method they have in place already, it subdivides surfaces
into
surfaces that are powers of 2.

Hum, not exactly. We use an hybrid solution : we choose the next power
of 2 size, unless the surface is too big (>256). If the surface is too
big, it is the tiled into smaller surfaces.

The non-obvious problem when trying not to waste video memory is the
following :
if you want to avoid memory waste, you have to packe multiple small
surfaces into a big OpenGL texture. If one of these sub surfaces
changes, you have to update it using glTexSubImage2D. On some OpenGL
drivers, this works perfectly, i.e. only the changed part of the
texture is uploaded to the video card. However, some other OpenGL
drivers upload the whole texture. So if the texture is too big, that
might give a huge slowdown.

Do you take advantage of the ARB extension that allows arbitrary
texture sizes? I think most of the cards made in the past year or two
(three?) support it. I know Apple has been using it in their
implementation of “Quartz Extreme”.

-bob
-------------- next part --------------
A non-text attachment was scrubbed…
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2357 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20040708/aa51d162/attachment.binOn Jul 8, 2004, at 6:03 AM, Stephane Marchesin wrote:

Do you take advantage of the ARB extension that allows arbitrary
texture sizes? I think most of the cards made in the past year or two
(three?) support it. I know Apple has been using it in their
implementation of “Quartz Extreme”.

Well, we considered it. At first sight it seemed nice, but after thinking about it a little we decided it wasn’t interesting for now :

  • the non power of two extensions are numerous (ARB_texture_non_power_of_two, EXT_texture_rectangle, NV_texture_rectangle) and differ in some points.
  • these extensions are not widespread, at least not for our OpenGL target system, which is OpenGL 1.1
  • using these extensions would only allow sparing some memory, some of which could also be gained (on any OpenGL system, not just the ones supporting non power of two textures) by a better texture allocator/tiler.

Similarly, the paletted texture extension would be nice to store the 8bpp surface. For almost the same reasons, we don’t use it for now. We’d like to get everyting to work correctly on OpenGL 1.1 first. Adding things on top will be easier when everythings works right.

Stephane

Do you take advantage of the ARB extension that allows arbitrary
texture sizes? I think most of the cards made in the past year or two
(three?) support it. I know Apple has been using it in their
implementation of “Quartz Extreme”.

Well, we considered it. At first sight it seemed nice, but after thinking
about it a little we decided it wasn’t interesting for now :

  • the non power of two extensions are numerous
    (ARB_texture_non_power_of_two, EXT_texture_rectangle,
    NV_texture_rectangle) and differ in some points.

  • these extensions are not widespread, at least not for our OpenGL target
    system, which is OpenGL 1.1

  • using these extensions would only allow sparing some memory, some of
    which could also be gained (on any OpenGL system, not just the ones
    supporting
    non power of two textures) by a better texture allocator/tiler.

Similarly, the paletted texture extension would be nice to store the 8bpp
surface. For almost the same reasons, we don’t use it for now. We’d like
to
get everyting to work correctly on OpenGL 1.1 first. Adding things on top
will be easier when everythings works right.

i wouldn’t agree. if everything works correctly on OGL 1.1 you will get some
problems when breaking the OGL 1.1 path to support different extensions for
the same task because you do not add things on top, you implement things
another way. maybe a better solution would be to implement the glSDL layer
without any concrete OGL implementation. one could create an interface for
surface allocation and drawing. this interface can be implemented for all
OGL versions and extensions. the correct interface can be fetched during
initialization of SDL.

OGL 1.1 is somehow outdated, so it would be great to implement newer
features. with an interface this task can be done by someone who knows a
special OGL path very well, but does not care about SDL management
internals.

i like the idea of this project, so keep up your good work :slight_smile:

regards,
jan–
“Sie haben neue Mails!” - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info

Yep, that’s what glSDL does - and has been doing from the start. Even
the first version would tile multiple textures horizontally or
vertically to make better use of texture space, and to deal with
surfaces that have a larger total area than the maximum OpenGL
texture size. (Can be as low as 256x256!)

The latest snapshots (0.7 and the latest glSDL/backend versions) can
tile two ways as well, so the effective surface size limit is the
amount of texture RAM available. There’s a test program that scrolls
around a 2400x2400 image, which works just fine with any card that
has enough memory, regardless of texture size limits.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Thursday 08 July 2004 06.13, Donny Viszneki wrote:

Concerning the GL surface dimension limitations, is it
possible to just allocate larger textures and copy the
contents of would-be SDL surfaces into that, and when
"blitting" those surfaces, you could simply tell GL to
map the texture in such a way that the GL primitive
only shows the portion that we want?

In other words, blit by rendering GL_QUADS, and use
glTexCoord to get the image to line up correctly,
creating the illusion that the SDL surface is actually
being blitted. Is that possible?

so what kinda timeline are we lookin at?

any upcoming releases? this sure is a neat project (:> ----- Original Message -----

From: david@olofson.net (David Olofson)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Thursday, July 08, 2004 6:19 PM
Subject: Re: [SDL] glSDL

On Thursday 08 July 2004 06.13, Donny Viszneki wrote:

Concerning the GL surface dimension limitations, is it
possible to just allocate larger textures and copy the
contents of would-be SDL surfaces into that, and when
"blitting" those surfaces, you could simply tell GL to
map the texture in such a way that the GL primitive
only shows the portion that we want?

In other words, blit by rendering GL_QUADS, and use
glTexCoord to get the image to line up correctly,
creating the illusion that the SDL surface is actually
being blitted. Is that possible?

Yep, that’s what glSDL does - and has been doing from the start. Even
the first version would tile multiple textures horizontally or
vertically to make better use of texture space, and to deal with
surfaces that have a larger total area than the maximum OpenGL
texture size. (Can be as low as 256x256!)

The latest snapshots (0.7 and the latest glSDL/backend versions) can
tile two ways as well, so the effective surface size limit is the
amount of texture RAM available. There’s a test program that scrolls
around a 2400x2400 image, which works just fine with any card that
has enough memory, regardless of texture size limits.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

so what kinda timeline are we lookin at?

Well, the situation is almost beyond control here (work, Real Life
etc), so I wouldn’t know. Stephane is the one doing the work on the
backend, and I think it’s mostly refactoring work and some minor
issues now…

any upcoming releases? this sure is a neat project (:

Some people got a prerelease of glSDL/wrapper 0.7 (with two-way
tiling, fixed clipping, dynamic OpenGL library loading and some other
changes), but the state last time I looked at it was that there were
some issues with surfaces going all black on Win32. (Apparently, 0.6
had the exact same problem.) I recieved a patch, but I haven’t had
the time to incorporate it, test and make a new release.

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Friday 09 July 2004 12.39, Alan Wolfe wrote:

David Olofson wrote:

any upcoming releases? this sure is a neat project (:

Some people got a prerelease of glSDL/wrapper 0.7 (with two-way
tiling, fixed clipping, dynamic OpenGL library loading and some other
changes), but the state last time I looked at it was that there were
some issues with surfaces going all black on Win32.

Hmm, I’m not sure if that’s the same problem, but I have a fix for a
similar problem.
In InitTexture, glBindTexture is used but the value of glstate.texture
isn’t set. That’ll obviously cause some trouble.

Stephane

Hello !

glSDL is really great. I tested it on MacOSX and there is
it the only way for me to get the FPS i wanted.

What is the last glSDL version ? Where can i download it ?
Or has the latest SDL CVS version glSDL integrated ?

CU