www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/11/07:29:31

From: "Arthur" <arfa AT clara DOT net>
To: <djgpp AT delorie DOT com>
Subject: RE: vsync
Date: Sun, 11 Oct 1998 12:24:41 +0100
Message-ID: <000001bdf509$bd9dfb40$f24e08c3@arthur>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
In-Reply-To: <6vp6lh$g71$2@otis.netspace.net.au>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

> when I use vsync in my program, the maximum frame rate is only about 60
> frames per second. when I remove the vsync, the program runs at 3000 and
> something frames per second, however, the graphics looked all
> flickered, how
> do I solve this problem?

The vsync is controlled by your graphics card. For most people it's around
60Hz in 640x480 dos mode, but does depend on your card (and whether you have
a 3Dfx card installed).

The vsync waits for the electron gun in your monitor to reach the top of the
screen. At that point you can draw the screen without flicker. If you don't
wait for the vsync, you'll find that "shearing" occurs halfway down your
screen - as though two images have been stuck very roughly together.
Obviously, this is worse than waiting for a vsync.

You can't get around waiting for a vsync on the PC as the hardware won't
allow it. You can, however, draw stuff according to the timer. A clever
method used in quite a few games nowadays is to have a timebase set by the
timer. Instead of saying that something moves a distance x per frame, you
say that each object moves a distance y per timer click. This way you can
accurately calculate the distance that each object should have moved and so
it is in the right place whether your framerate is fast or slow. It just
looks better when your framerate is fast.

For more info you should have a look at the source for the Allegro demo game
which comes with the Allegro package. www.talula.demon.co.uk/allegro

Oh, and while you're there, join the AGP mailing list.

HTH

James Arthur
jaa AT arfa DOT clara DOT net
ICQ#15054819

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019