[SDL] SDL 1.3 and rendering API state management

Johannes Schmidt sdl at myrealbox.com
Tue Sep 5 16:02:53 PDT 2006


Le Lundi 4 Septembre 2006 23:41, Bob Pendleton a écrit :
[...]
> OK, here I see we have two very different ways of looking at things.
> Remember that I have spent several full time months each of the last 2
> years working on adding multiple windows to SDL. I got it working the
> way I want it on X11. Right now I am just sitting here biting my tongue
> hoping SDL 1.3 will not undo all the work I have done.
>
> The right way to do GUI tool kits is to have multiple windows and
> windows within windows. The way I implemented it some windows can be
> normal SDL 2D windows and some can be 3D OpenGL windows with each OpenGL
> window having its own context. This way you can have any mixture of 2D
> and 3D on the screen that you want. You can have 3D pop ups over 2D and
> 2D pop ups over 3D. You can have a 3D window as part of your screen with
> a nice tree widget in a 2D window next to the 3D window.

No, you are kidding, right?
Mixing different graphic libraries or 2D and 3D windows messes things up 
rather quickly ...
And what if you want a GUI on top of your 3D environment?

Honestly, the best way is to choose one graphics lib (OpenGL, whatever) and 
get your toolkit to use this for all of your drawings.

It took me just a few hours to get a basic OpenGL backend for Cairo, another 
1.5h to get alpha blending and higher level stuff (patterns, gradients) right 
(and I haven't used cairo before).

You can strip off most of cairo to get a small vector graphics lib for every 
graphics backend you want. OpenGL wasn't that hard, D3D should work as 
well ...
(and with Mozilla and GTK going for cairo, it should be possible to render 
those components in your window ...)


Btw, I'd really appreciate if there would be a possibility to have just one 
OpenGL context for all SDL windows (a context switch is rather expensive).


Best regards,
Johannes




More information about the SDL mailing list