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

David Olofson david at olofson.net
Wed Aug 16 18:10:01 PDT 2006


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




More information about the SDL mailing list