[SDL] glSDL and OpenGL at the same time
david at olofson.net
Thu Sep 1 03:43:25 PDT 2005
On Thursday 01 September 2005 09.20, Olivier Delannoy wrote:
> I am currently the main user of this system and I am not interested
> in learning multiple GUI or in multiplying modules.
That's a good reason for using glSDL - you need only the SDL 2D API.
> Using glSDL implies OpenGL and it's a requirement that did not
> bother me at all.
Actually, glSDL just *allows* you to use OpenGL - CEGUI would be what
adds the OpenGL *requirement*.
If you don't activate glSDL, SDL just uses the default 2D backend
instead. (Or, in the case of the old wrapper; glSDL passes the
affected calls through to SDL instead of "redirecting" them to
> That's why I am really interested in trying to link glSDL to CEGUI.
I see. Well, it *should* work with current versions of glSDL, but you
have been warned; mixing glSDL and OpenGL is not officially
supported. There is a risk of future versions of glSDL breaking your
code if you do this.
> My first idea was to load and use glSDL and to add the drawing of
> cegui right after glSDL. I am not sure if it's the good way to do
Well, as it is, glSDL basically just translates every SDL blit into an
OpenGL "blit", instantly, one by one. As long as you do the SDL and
OpenGL calls in the right order, they should also be rendered in that
order. (In current versions of glSDL, that is. Been thinking about
buffering and doing batch rendering in some way, but I'm not sure
it's worth the effort.)
Use SDL_Flip() instead of SDL_GL_SwapBuffers()! (I *think*
SDL_GL_SwapBuffers() would work with current versions of glSDL, but
don't be surprized if it doesn't.)
Finally, keep in mind that glSDL assumes that it's not sharing OpenGL
with anyone, so it will set up matrices and stuff the way it wants
them and then assumes they'll stay that way. If you need to change
certain things, you need to restore them before making further glSDL
calls. Read the glSDL source for details.
//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 ---
More information about the SDL