[…SDL->OpenGL blit…]
So, what do you think? What could be done to find a permanent,
consistent solution to this problem?
Well, glSDL (both the wrapper and the backend) actually does what you
want. It’s just that it’s behavior in relation to an application
sharing it’s OpenGL state is undefined. This is to ensure that the
glSDL backend implementation can be improved and optimized without
working around more problems than the current SDL API is already
causing.
I suppose one could add an API extension that applications can use
when they want to take over the OpenGL state for a moment, or return
it to glSDL. This would ensure that the glSDL implementation has a
chance of working properly together with OpenGL applications, and it
would allow OpenGL applications to use glSDL with native OpenGL
without depending on glSDL internals.
Still, something like this will never have quite the performance and
flexibility of using native OpenGL all the way through. Due to
limitations of the OpenGL API, it’ll never be completely transparent
anyway. Though pretty much any SDL 2D code should work with glSDL,
there are operations that will invariably result in very slow
rendering, and there’s nothing we can do about that without relying
on features that are not yet widely available.
So, what’s the point in (ab)using a 2D rendering API when you depend
on OpenGL anyway, really?
IMHO, the only truly valid answer to that is “code reuse.” It would be
very handy to be able to pull in SDL 2D code and make it work in an
OpenGL application, just like that. However, my experience is that
GUI toolkits, drop-down consoles and things like that - the most
interesting stuff in this context, I guess - will not perform well
with glSDL without changes.
Then again, the changes you have to make would help other h/w
accelerated backends as well, since it’s mostly a matter of adapting
to the way modern computers handle graphics. Should be a good thing,
provided the changes are fed back into the official versions of the
code.
Conclusion:
It shouldn’t be all that hard to add an API extension that
allows applications to mix glSDL and OpenGL in a well
defined manner. It’s not optimal, and cannot be 100% SDL 2D
compatible, but should be sufficient as a shortcut to make
code work in both SDL 2D and OpenGL applications. Also, the
changes made to adapt SDL 2D code are often relevant to h/w
accelerated backends in general.
//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.net — http://www.reologica.se —On Sunday 08 May 2005 13.11, Daniel Secrieru wrote: