Archived

This topic is now archived and is closed to further replies.

carbon14

accurate refresh rate

Recommended Posts

hi i am working on this scientific program that uses directx i have a random dots module that shows a bunch of random dots traveling in a chosen direction with a chosen speed on the monitor for low speeds, each dot actually appears as one dot on the screen for higher speeds, each dot leaves a trail behind it do i have a refresh rate problem? here is how i calculate refresh rate: double DrawingClass::ComputeRefresh() { static int const PRECOUNTS=100; static int const COUNTS=500; if(!g_lpdd) return 60.; /* DWORD f; HRESULT dderr=g_lpdd->GetMonitorFrequency(&f); //THIS IS TOTALLY UNRELIABLE!!! if(dderr==DD_OK) return (double)f; */ // I measure it by myself! AfxGetThread()->SetThreadPriority(THREAD_PRIORITY_TIME_CRITICAL); for(int i=0;iFlip(NULL,DDFLIP_WAIT ); } LARGE_INTEGER freq,start,act; QueryPerformanceFrequency( &freq); // this calibrates the freq of the hi prec clock fi=(double) freq.QuadPart; QueryPerformanceCounter(&start); for( i=0;iFlip(NULL,DDFLIP_WAIT ); /* while(g_lpddsPrimary->Flip(NULL, DDFLIP_DONOTWAIT )!=DD_OK) { Sleep(0); }*/ } QueryPerformanceCounter(&act); double time=(((double)(act.QuadPart-start.QuadPart))/fi)/COUNTS; AfxGetThread()->SetThreadPriority(THREAD_PRIORITY_NORMAL); double r=(double)((int)(1./time+.5)); if(usedebug) debuglog<<"Measured Freq: "<

Share this post


Link to post
Share on other sites
yes and no.

if you are syncing to the refresh rate then its likly a natural ghosting effect of the eye (which ta max has a refresh rate of 60hz but at th center of vision its only 30hz). this motion blur is used to help relay movement to the brain however moniters show an infinte number of frames per second. thus you get a ghost effect instead of motion blur. ie imagine film being used to capture something fast and you get a blur. thats how the eye works. moniters show instant frames thus its an exact showing of position of objects on screen. you can realy fix this. measuring the refresh rate wont do you any good at all. use the refresh rate reported by the moniter (ie press the control adjustment button and see what the refresh rate is).

Share this post


Link to post
Share on other sites
quote:
Original post by a person
this motion blur is used to help relay movement to the brain however moniters show an infinte number of frames per second.
....
moniters show instant frames thus its an exact showing of position of objects on screen


You are right about motion blur (when an object is moved very fast we tend to see multiple faded copies) To see this hold your hand in front of your face and move your fingers up and down very fast.


However your "instant frames" is off. A monitors refresh rate is the rate at which it redraws itself, thus if a monitor refreshes at 60hz the highest number of *distinct* frames you will see is 60. Even with vsync turned off the best you can do is cause tearing, where the upper part of the monitor has one frame and the lower part has another (due to the contents of video ram changing in the middle of a refresh).

Share this post


Link to post
Share on other sites