The 2D API thread got me thinking of what to do when the time comes
to migrate to SDL 1.3. So I wondered whether in SDL 1.3 there will
be better control for OpenGL textures?
Well, I have yet to figure it out completely, but SDL 1.3 does have
the concept of textures, along with the surfaces, and there are
various new functions related to these textures…
The things I wondered about were:
- non power-of-2 textures (AFAIK requires extensions but AFAIK glSDL
can do this)
Actually, glSDL just hides the actual texture management from you. A
glSDL surface can concist of a part of a texture, tiles layed out in
a single texture, or tiles placed in multiple textures. That’s how it
handles non power-of-two surfaces, and surfaces that are larger than
the maximum supported texture size.
- keep a shadow software SDL_Surface, to modify pixels and
re-upload.
This is exactly what glSDL does. (The wrapper version effectively
piggy-backs the texture management on top of SDL software surfaces.)
Replacements for the glu*() functions, that is?
That could be handy without OpenGL as well (together with scaling on
the 2D backends), so why not implement it on the SDL surface side?
Not sure if it should be integrated or an add-on library…
Integrating it could provide acceleration of the scaling and
filtering on some backends, I suppose.
- dithering (is AFAIK necessary if running in 16bit OpenGL video
mode)
Yes… Though I’m not sure where or how to implement this. Could be an
add-on library, but that pretty much rules out any chanses of
accelerating it.
Also note that dithering just doesn’t work with scaling, rotation and
similar transforms, unless it’s done “live” when blitting to the
screen.
So, although dithering can be very useful, it doesn’t fit perfectly
into the 1.3 API, unless we’re talking about real time dithering in
the backends. OpenGL and Direct3D can both provide this, AFAIK.
However, that conflicts with SDL 1.2 style SDL_DisplayFormat(), as
dithering is pointless if the source data has the same color depth as
the display buffer.
- control wrap/repeat mode and border.
BTW, this would apply to the SDL backends as well, if SDL was to add
the ability to specify texture coordinates explicitly. (With the 1.2
API, source surface coordinates are calculated implicitly.) However,
I see very few actual uses for this, unless perhaps if we’re
considering this OpenGL quad style free transform blit I’ve been
talking about. That might complicate software implementations quite a
bit, though…
- control anisotropy level + query max. anisotropy (requires
extensions)
- texture compression (requires extensions,
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT or
whatever)
This looks like OpenGL helper library stuff to me… If you’re relying
on OpenGL anyway, there isn’t really much point in wrapping stuff
that can be done via the OpenGL API. Then again, if it’s simple and
handy and doesn’t bloat SDL significantly, it doesn’t really hurt to
have.
Now, if we were to implement a new “Clean3D” API, wrapping OpenGL,
Direct3D and a software rasterizer + extensions and whatnot, it would
be a different matter. However, that’s most probably better done as
an optional add-on library instead. (Which may or may not require
minimal support from SDL to access Direct3D directly in a clean way.)
IMHO if SDL supports uploading textures to GL then why not also add
these features while you’re (we’re!) at it.
Well, even though SDL explicitly supports OpenGL for direct use by
applications, and it makes sense to provide reasonably simple and
basic functionality that practically every OpenGL application will
need anyway, one has to draw the line between SDL land and add-on
library land somewhere.
I would say that as a general rule, if a feature can be implemented
cleanly outside SDL (or any other lean and mean low level library for
that matter), it should not be integrated.
If you want to collect various handy stuff in a single place (for API
concistency, minimal number of dependencies etc), how about an
official SDL Utility Library?
//David Olofson - Programmer, Composer, Open Source Advocate
.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
’-- http://www.reologica.se - Rheology instrumentation --'On Wednesday 16 August 2006 11:58, Sebastian Posch wrote: