Is there a simple Scrolling Example available online at www.libsdl.org ???
I was thinking about writing one just the other day…
I am converting a Game and i want to use a Multiplattformlib like SDL or
ALLEGRO or PTC ???
But before i use this or that Lib i want to see how good the Lib is able to
scroll. Is the Scrolling acurate, is it soft and so on.
Well, providing you have enough power to update the screen at full frame
rate, there shouldn’t be much (see below) trouble on targets that support
retrace sync. It’s about as fast as it gets, provided you do everything right.
There are some performance issues due to the lack of sysRAM->VRAM DMA blits
on some targets, but that’s not SDL’s fault. AFAIK, this issue, as well as
the lack of retrace sync - is mostly related to UN*X based targets.
If there is no Scrolling Example available on www.libsdl.org
could anybody write a simple
Example in SDL that scrolls a 16Bit Picture out of the Right or Left Border
with a given Framerate ???
If you want it real smooth, you should use hardware accelerated OpenGL with
bilinear filtering. I’m working on a library for that (also including
transparent software rendering “fallback”), and it looks incredibly smooth,
regardless of frame rate and scroll speed.
The problem with smooth scrolling these days is that you cannot safely set or
even check the refresh rate, so you can’t rely on fixed integer pixels/frame
My solution is to “abuse” the texture filtering of the 3D accelerator for sub
pixel accurate rendering, which means that you can scroll say 0.97
pixels/frame, and still create an illusion of the background moving with a
rock steady, constant speed.
This applies to sprites as well, of course. Full scene antialiazing and
focus/blurring effects are free bonuses.
Of course, there is a disadvantage: You really need hardware acceleration
for this to look good, and you need pretty decent acceleration at that, at
least for resolutions that really look good. The screen has to use at least
50% higher resolution than the source graphics data to get smooth sub pixel
accurate animation without “phasor” effects on small details.
Machines that I’ve sucessfully tried the basic methods on:
P-II 400 Mach64 Rage Pro AGP
P-III 933 Matrox G400 MAX AGP
3D cards from the generation before the Rage Pro and older probably won’t
work too well, as many of them can’t blend and filter at the same time. Some
can’t filter at all! Most of them probably have inadequate fillrates for full
frame rate in anything higher than 320x240…
So, it all comes down to your target audience, and how much work you want to
put into making arcade machines look worthless.
Note: On Utah-GLX/XFree86, you also need my retrace sync patch - or you can
forget about smooth scrolling without tearing. (No h/w pageflipping…)
Ok… Now we’re almost off topic!
So back to basics; what exactly do you mean by “accurate” and “soft”?
If you want the ultra smooth full frame rate feel of high powered game
consoles and arcade machines, you’re pretty much limited to using 3D
If you were happy with the average Amiga game with half frame rate (25 Hz)
animation, you might get away with software rendering without sub pixel
accuracy. However, as you can’t rely on getting the exact refresh rate you
tuned the game for (say 70 Hz), you may have to accept smooth scrolling with
a “jerk” every few frames. (I personally find that pretty annoying; worse
than a lower frame rate actually!)
If you considered “Flying Shark” on Amiga and Atari ST smooth (varying
between ~8 and 16 fps, I think), well, then you don’t have to worry about any
(Rolling Thunder? hehe I don’t think I’ve ever seen a game that slow, not
even java applets on slow PCs! Amazing… Locked at 6 fps or so; C64, Amiga
and Atari ST all the same. Even more amazing; I still liked something about
that dog slow and bl**dy annoying game.)
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Thursday 15 February 2001 11:38, WIZARD / SYNTHETIC - Crew wrote: