hmm. Actually it seems that I have some spooky programs running that
make the scrolling kinda jerky.
That seems to be the most common problem by far…
In linux everything was fine. Now I
just need to get non-jerky fps-independant scrolling…
Well, I’d say the best you can do is OpenGL with subpixel accurate
rendering - and it works pretty well even without retrace sync or h/w
pageflipping. In fact, it works incredibly well under such
circumstances, as long as you keep the scrolling speeds reasonably low.
The traditional fixed speed scrolling shooters (usually 25 or 30 pixels/s
depending on whether the original version was PAL or NTSC) should be fine.
However, using OpenGL means that you’ll have to implement SDL 2D support
as well, unless you want to prevent any use on unaccelerated video
cards. It might be a good idea to start with SDL (smooth enough, usually,
especially in resolutions like 320x240), and implement the OpenGL part
later.
You can look at my smoothscrolling example at
http://olofson.net/mixed.html
for a simple demonstration of scrolling with both SDL and OpenGL. (It’s a
common “rendering API” - a bunch of function pointers - and two
implementations of that. Sub-pixel accurate rendering is used with
OpenGL, but not with SDL 2D.)
Does SDL allow some kinda wainting for the monitors vsync, or
something…?
Not explicitly, but it is supported where possible. AFAIK, syncronization
is done either in SDL_FlipSurface(), or the next time the screen surface
is locked (ie the next time you try to blit to it), depending on target.
I remember back in the old dos days to get good smooth
stuff onto the screen, I called something like waitvsync() after every
frame…
Right, that’s how it used to be done when you wanted fixed speed
scrolling on a display with a known, fixed refresh rate - like arcade
games, consoles and practically any computer that was designed to be
connected to a TV or video (PAL/NTSC) monitor.
VGA Mode-X (“custom mode”) counts as well, although even there, you
might find some weird card that refuses to comply with the standard VGA
clock rates. (I haven’t seen one, but OTOH, I’ve seen plenty that don’t
implement VGA h/w scrolling properly.)
Retrace sync still is essential for that perfectly smooth, flicker free
and tearing free scrolling that we were used to, BUT, you have to realize
that you have no idea what kind of refresh rate you’ll get. You just have
to deal with whatever you get, one way or another.
The most common solution is to calculate the position of every object for
each frame, and the round down to the nearest pixel. A more sophisticated
approach is doing the same, but with sub-pixel accurate rendering instead
of rounding.
//David Olofson — Programmer, Reologica Instruments AB
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |
-------------------------------------> http://olofson.net -'On Wednesday 03 April 2002 20:10, Marius Andra wrote: