Hi,
Been using SDL for a bit, half completed a 2D game using pure
SDL_BlitSurface and other 2D specific functionality. The big issue
now is that the more I look at it the more I think that the
advantages of 3D functionality(i.e. scaling of images, alpha
blending, particles effect et al) are worth re-write my game.
Partially it is a pipeline issue I ran into with my artists.
In some cases, you can get away with preprocessing (scaling, rotating
etc) graphics at load time.
I do this in Kobo Deluxe (scaling, brightness/contrast, alpha
"contrast" and cleaning and some stuff like that) - but, that is a
retro style 2D game, so real time transforms and the like aren’t
really needed or even desired. (There are some subtle alpha blending
effects and antialiazing to emulate old soft/blurry arcade monitors,
but that’s about it; the rest is plain, old school 2D programming.)
However, it sounds like you need more than what the SDL 1.2 2D API was
really designed to do, so OpenGL - or rather, an accelerated 3D API
(that is, OpenGL - but see below…) - is probably the more sensible
choice.
Would like to know if anybody is using OpenGL and SDL together. Also
would like to know how successfully they have been down this route
before I think about re-writing the game?
No problems. Great solution! OpenGL is very portable as far as the
actual rendering is concerned, and SDL takes care of the rest (input,
sound, threads, …), which would otherwise require platform
dependent code for each platform you want to support.
If your code is reasonably structured, there shouldn’t be much
rewriting involved either. Replacing the SDL rendering calls with
your own thin rendering layer lets you add (optional, if desired)
OpenGL support. The easiest way is probably to just implement a
subset of the SDL 2D functionality in your thin layer; just enough to
make your game work. Then you can extend your rendering layer as
needed to support the extra features you want. (Extreme programming
philosophy; don’t waste time designing and implementing stuff you
don’t need.)
Compatibility problems?
Possibly some issues with OpenGL on low end Windows systems, and on
certain versions of Windows. There are some 3D cards for which no
OpenGL drivers exist, and some that have very poor OpenGL support,
but usable Direct3D support.
Many shareware game developers recommend supporting Direct3D (only, or
as an alternative to OpenGL, if you need OpenGL for other platforms),
because Direct3D is generally a safer bet on Windows, if you want
your game to work on “pretty much anything”. And that is probably
what you want if you want to make money and aren’t making AAA
titles…
//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 --'On Friday 28 July 2006 14:22, terence tan wrote: