Path: chuka.playstation.co.uk!news From: James Chow Newsgroups: scee.yaroze.beginners Subject: Re: Questions about VSync. Date: Tue, 05 May 1998 00:26:32 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 53 Message-ID: <354E4EA8.A92F3D10@chowfam.demon.co.uk> References: <354C8851.709D2E83@chowfam.demon.co.uk> <6ij6jd$jpr18@chuka.playstation.co.uk> <354D8AA7.17CA37C6@chowfam.demon.co.uk> <354E298F.2865CC25@netmagic.net> NNTP-Posting-Host: chowfam.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=x-user-defined Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (Win95; I) Nope. Still confused. Read on. Elliott Lee wrote: > > And the return values for calling VSync(mode): > > - if mode>=0: the number of horizontal sync units should be > returned. If I understand the docs correctly, this should probably > be the total number of horizontal lines from the top of the screen > to the bottom, including the lines before and after the visible > screen data. This may also include some bogus horizontal retrace > period interrupts triggered during the retrace period---the ray > gun doesn't always travel in a straight line back to (0,0). > Will someone _just_ answer this question then. while (1) { //do work cnt = VSync(0); //more work } Why does cnt _not_ equal 312 for PAL or 262 for NTSC, through each loop iteration? > - if mode<0: the number of horizontal syncs since the beginning > of the program. > > As far as I can tell, the number of h-syncs is probably not a good > way to time your program because you only get that value after every > v-sync. You shouldn't really switch the video pages until the > vertical retrace begins. And, getting an arbitrary time is probably > not that useful because drawing the graphics with the GPU will take > different amounts of time depending on the complexity of the scene > you are rendering... > I know it's not a good way to do timing, but are there any other suggestions of how to get a finer resolution than 1/50th sec or 1/60th sec? But not too fine, eg. using the root counter, which flies past like f*** and has probably "gone round" a few times before you've checked again. Games like Ridge Racer have timers going down to 1/1000th sec resolution. Now how to do they manage that? Personally I find using vsync(-1) + rand()/RAND_MAX a bit too tacky. Cheers. -- jc