PC’s do have dedicated graphical processing things, they just tend to
Except when they don’t. My undead of a game project, Quadra (it just
won’t die, people keep downloading it, playing it, and filing bugs!),
tends to be still popular on computers that do not have 3D hardware at
all. Think five year old computers that someone still fiercely
addicted to Tetris would still have.
If your game is going to require a minimum amount of CPU, you could
start assuming that since you need a recent enough computer, there is
a better chance of there being 3D hardware. I personally applaud the
Intel chipsets for that: while they are not nearly capable enough for
proper 3D games, they do plenty well for the “2D using 3D” type of
games, letting me forget about such horrors as DirectDraw and DGA2.
Most of the 2D acceleration is basic blitting with a raster op (vram
to vram), a hardware cursor (mouse pointer like thing), simple
bresenham line drawing (where you still have to do some of the math to
get values to plug in), dac start offset (page flipping, or depending
on hardware, vertical scrolling), and different pattern/flood fills.
Some things might have alpha blending or some kind of overlay color
space conversion (yuv etc) as well.
Note that for some of these operations, you need exclusive control of
the video card, which at the very minimum means not being windowed,
and in the worst case means not possible (X11 had DGA, but eww! and
many drivers didn’t get it right, since it wasn’t used much).
Basically, what’s accelerated is stuff that is used in GUI
applications. Which usually means fills (solid color desktop
background), solid blits (scrolling), colorkeyed blits (for icons),
and colour conversions (for video playback). If you’re lucky, you get
alpha blending (for shadows). Since you rarely see windows rotate or
scale (except on a Mac, maybe? hehe!), you don’t get that.
Standards ? No. With Vesa2/Vesa3, the VESA group wanted to charge an
arm and a leg for their spec for hardware manufacturers to be able to
implement things. As such, it spelled the end for a low level
standard API. And, with things moving to Windows, there wasn’t seen
much of a need for a lower level API – you’d just talk to the windows
driver. Annnnnddd the Win16/32 GDI is more or less just lines, rop
blits, and such… nothing terribly interesting.
People should remember that back in the DOS days, each game contained
the drivers for the hardware. If you wanted to use an accelerated blit
(say), which wasn’t in the VGA standard, you had to find out how to
make it work on every card and code a big “switch” statement (or
something) in your game to do that. If you didn’t support my S3 968v2,
then your game DID NOT WORK AT ALL on my computer (or fall back to
software, yet more headaches)! Of course, game developers didn’t use
those non-VGA features very much, because they didn’t have the
man-power to support all these video cards.
Microsoft, though, had either the man-power to do it, or had the
leverage to ask the video card manufacturers to write a chunk of code
for them. In addition, GUI is the kind of thing where a software
fallback is usually tolerable, so it would at least work to a nominal
level, until you could figure out what was wrong.
XFree86 (and now Xorg) is basically the same kind of situation.
Today’s lowest common denominator for 2d graphics is a LFB and
hardware cursor. The rest is up to you.
And what they call a hardware cursor is probably not what you have in
mind (as in, “way crappier”).
… so if you want some faster 2d, use OpenGL and set it up to do a
2d-style game. You’ll get lots of free bonuses… subpixel
manipulation, free hardware rotation, free parallax scrolling
occlusion, blendy goodness, etc etc etc etc. The only malfunction
might be the previous thread concerning OpenGL being broken on some
hardware/os things (which I have never hit, fwiw).
The other hangup is those people stuck with non-3D hardware, but
they’re becoming quite the rare breed.
An interesting tidbit of history is that DirectDraw used to give you
access to the 2D accelerated hardware in a way that is actually useful
to games, but at some point, it become enough of a hassle that
Microsoft got rid of it, and replaced it with a Direct3D backend
(essentially doing what you described), which works wonderfully,
except if you don’t have actual 3D hardware. If you’re in that
situation, then your game that used to be 80-100 fps is now 2 fps, or
something equally craptacular. The irony is that in the meantime, the
CPU and memory became faster, so using the GDI and doing everything in
software could give you something like 40-50 fps, say (made up
numbers, the important is “probably a chunk slower than 2D
accelerated, but fast enough to be useful”, as opposed to “unusably
slow”, which is what you get with 3D without the hardware).
So on some older computers, the DirectDraw backend of SDL can be
faster than the GDI backend is on a faster computer, but on that
faster computer, the DirectDraw backend would be very slow. If you’re
especially unlucky, your user has an old enough computer that he
doesn’t have 3D hardware, but a new enough machine that he has WinXP
with the recent enough DirectX that doesn’t have the "real"
DirectDraw, in which case there is simply no way to get at the 2D
acceleration (or an equivalent performance faking it with 3D
Again, you just can’t rely on anything.On Sat, Jul 26, 2008 at 11:40 AM, Will Langford wrote: