[SDL] 2D API evolution (SDL 1.3/2.0)

Bob Pendleton bob at pendleton.com
Thu Aug 17 05:47:56 PDT 2006


On Thu, 2006-08-17 at 03:10 +0200, David Olofson wrote:
> On Thursday 17 August 2006 02:12, Bob Pendleton wrote:
> > On Wed, 2006-08-16 at 12:13 +0200, Torsten Giebl wrote:
> > > Hello !
> > > 
> > > 
> > > > But you forget that 2D games can have rotations and scaling etc
> > > > when done directly using the 3D API's, but SDL 1.3 renderers
> > > > don't provide such things. Those simple transformations could be
> > > > done in SW too in real time with a litle bit of limited quality
> > > > as a fall back. And I have to say that I would think that as a
> > > > necessity in SDL 1.3. After all SDL 1.3 is a big leap forward
> > > > from SDL 1.2 so why restrict the drawing system to the old?
> > > 
> > > 
> > > For me it is okay to add these functions to SDL 1.3 +
> > > X/Y-Flipping. 
> > 
> > Code that can do general rotations can usually do X, Y flipping too.
> > All you have to do is flip the texture coordinates. And, while you
> > might not think that I really mean "texture" I do. 2D texture
> > operations are a simpler (and sometimes faster) version of 3D
> > texture operations. A good 2D texture handler can scale, rotate, and
> > flip all at once.
> 
> ...and it's still possible to detect special cases for fast shortcuts.
> (Anything with horizontal scans in both texture and display space 
> [eliminates 2D movement in the texture], dito with 1:1 scale [block 
> copy], and... well, that pretty much covers the most interesting 
> cases for the inner loop of a software rasterizer, doesn't it? 
> Similar logic for the outer/vectical loop, but that's probably only 
> worth worrying about if there is no direct access to the display 
> buffer.)
> 
> So, theoretically, backends could implement this function only, and be 
> done with it. The other calls would just be trivial wrappers 
> implemented in SDL.
> 
> For performance reasons, it *might* be a good idea to keep a dedicated 
> backend call for non-scaled rectangular blits... I dunno. 

That's a real easy case to detect at run time. Best to just let the
backend code catch special cases and optimize them.

btw, in the case of scaling 2D textures benefit from MIP maps just as
much as 3D textures do and using them lets you get away from a lot of
the need to do pixel level interpolation in the inner loop.

		Bob Pendleton

> Might 
> matter when doing loads of very small rectangular blits with a 
> software backend. (With OpenGL or Direct3D, it's of course 
> irrelevant, as this quad + texture thing is basically their native 
> interface anyway.)
> 
> 
> //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  --'
> 
> _______________________________________________
> 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