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

David Olofson david at olofson.net
Tue Aug 15 07:16:50 PDT 2006


On Tuesday 15 August 2006 15:21, Torsten Giebl wrote:
[...]
> Sorry i still don't understand the problem.
> 
> A few simple cases :
> 
> 
> 1. You are writing a 2D application, like an oldschool
> JumpNrun for example. SDL 1.2 is the perfect choice
> for you, it supports a lot of backends and is well and long tested.
> 
> 2. You are writing a 2D application, but need for using
> a lot of Alpha Blending stuff hardware acceleration. SDL 1.3
> is your best choice it supports OpenGL, DirectX, X11 and the
> user can choice whatever is the fastest on his system.
> A way to make it easier is to include a little benchmark into your
> game just testing the different backends and printing out the max.
> FPS. 
>
> 3. You are writing a 3D game. You are already bitten today even
> without SDL. You have to choice what System you use. Is your game
> only for Windows and XBOXes. DirectX is perfect. Do you want to get
> it also running on Mac OS X and Linux you have to write it with
> OpenGL. If you now write two backends and be safe or just write the
> OpenGL backend and people may yell about the bad performance is not
> a problem that could be solved by SDL. Linux users most of the time
> are pretty advanced in the knowledge of the system. Even the ....
> Windows User today install the NVIDIA or ATI driver on his system
> and both provide good OpenGL drivers.

I think there are a few simple cases missing between 2 and 3. What 
defines 2D and what defines 3D? How much, beyond single pixel 
plotting are you allowed to do before you're forced to use OpenGL 
and/or Direct3D? Rectangular blits? Colorkeying? Alpha blending? 
Additive blending? Scaling? Rotation? Other 2D transforms?

As it is, if you want to make something that looks and feels serious 
by current standards (and I'm talking casual games - not AAA 3D 
titles), you have to support one or two 3D APIs pretty much no matter 
what type of game you want to do. I would say a game that runs well 
and looks nice without full acceleration is the exception rather than 
the rule.

Rectangular blits, colorkey and alpha have been around for a good 
while, although AFAIK, alpha wasn't even accelerated by any 2D APIs 
around when that feature was added. Seems like additional blend modes 
are already in 1.3. (?) Accelerated scaling was mentioned long ago, 
and IIRC, it's in the TODO for 1.3.

How about rotation, or preferably, the superset of that; single plane 
four point transform? (Like OpenGL quads with 2D coordinates only.) 
Still rather basic rendering if you were to implement it in software, 
and most trivial to implement over any 3D API, of course.

IMHO, it just doesn't make sense to learn one or two 3D APIs as soon 
as you need any of these fundamental *2D* features, that have been 
accelerated in mainstream hardware for at least ten years now. Nor 
does it make sense to implement two or even three versions to ensure 
portability without going for the (s)lowest common denominator.

Now, if you need much more than that, you probably *do* need a 3D API, 
and as it is, there isn't much we can do about the situation. 
Direct3D for Windows-only, OpenGL for portability, both if you want 
both portability and the casual gamer user base. Besides, when 
developing an actual 3D engine, learning one or even two rendering 
APIs is a relatively small part of the job, so not the end of the 
world, really.

My point is that the more you can do - within reasonable limits - 
before you're forced into this OpenGL vs Direct3D situation, the 
better.


//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