[SDL] SDL 1.3 and rendering API state management

Bob Pendleton bob at pendleton.com
Wed Sep 6 14:01:54 PDT 2006


On Wed, 2006-09-06 at 01:02 +0200, Johannes Schmidt wrote:
> 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?

What part do you think I was kidding about. I have everything I
described working based on the SDL 1.2 code base.

> Mixing different graphic libraries or 2D and 3D windows messes things up 
> rather quickly ...

Yep, you can use the 2D API on 2D windows and the 3D API on the 3D
windows.

> And what if you want a GUI on top of your 3D environment?

In the same window? Then you use the 3D API and build a GUI from scratch
or find one that works that way. 

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

That is not always the case. It makes perfect sense to implement a drop
down menu as a 2D window that is drawn on top of all other windows. Not
even hard to do using any modern windowing system.

> 
> 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).

That is great, good for you. Does that have anything to do with SDL?

	Bob Pendleton

> 
> 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
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
> 
-- 
+--------------------------------------+
+ Bob Pendleton: writer and programmer +
+ email: Bob at Pendleton.com             +
+ web: www.GameProgrammer.com          +
+ www.Wise2Food.com                    +
+ nutrient info on 7,000+ common foods +
+--------------------------------------+






More information about the SDL mailing list