This week is a massive update on the rendering systems, simplifying
and improving them:
The theme has been focusing and streamlining the 2D rendering API so
that it is clear and easy to use.
To that end, I’ve fixed the feature set for this release, and removed
all partially functional renderers.? I’ve also added the ability to
create an SDL surface for windows which aren’t using rendering or 3D
functionality, and made it possible to create a software renderer for
arbitrary SDL surfaces.? Possibly the largest API change is that all
the rendering functions now take a rendering context as their first
parameter, so it’s clear what context they’re acting on.
You can also now create a texture of any format including YUV and SDL
will automatically take care of converting it into the formats
supported by the accelerated renderers. This means that new
accelerated renderers need only advertise the optimal texture formats.
Doing this resulted in a 50% speed boost on Mac OS X.
I’ve also simplified the driver interfaces so if you are porting to a
new platform you only have to implement 3 functions to get SDL 1.2
functionality and a software renderer, and you only have to implement
them if your platform doesn’t already support OpenGL or OpenGL ES.
As you might imagine, this update has reams of new code.? I’ve done a
bunch of testing but I’m sure there are bugs.? If you run into them,
please report them at http://bugzilla.libsdl.org/
On the up side, I’m very comfortable with this API set and am going on
to other areas that need love before release.
Here is the intro to the new SDL_render.h, and a complete list of API changes:----
This API supports the following features:
??? * single pixel points
??? * single pixel lines
??? * filled rectangles
??? * texture images
The primitives may be drawn in opaque, blended, or additive modes.
The texture images may be drawn in opaque, blended, or additive modes.
They can have an additional color tint or alpha modulation applied to
them, and may also be stretched with linear interpolation.
This API is designed to accelerate simple 2D operations. You may
want more functionality such as rotation and particle effects and
in that case you should use SDL’s OpenGL/Direct3D support or one
of the many good 3D engines.
Most SDL_Render* functions now take a context as their first parameter.
SDL_CreateTextureFromSurface() no longer needs a format, it
automatically converts to the optimal texture format.
SDL_SetWindowData() and SDL_GetWindowData() handle arbitrary named pointers.
A full log can be found here:
? ? -Sam Lantinga, Founder and CEO, Galaxy Gameworks