"EXT_swap_control extension" unexpected behaviour

Hi,

I’ve just “implemented” the EXT_swap_control extension. I set the “video frame period” with the wglSwapIntervalEXT(int interval) function.

My lcd-screen refresh rate is 60 Hz, or so says the property window.

If I pass an interval value of 0, I (indeed) get a fps of 500+ (no vsync). But passing 1 gives 120 (?). Passing 2 gives 60, passing 3 gives 40, passing 4 gives 20…

Why would passing an interval value of 1 give a fps result that doubles the monitor refresh rate?

I’m working on a MacBook Pro with XP32 under bootcamp. It has an nVidia 8600M GT videocard. But other computers give simular results. I have a standard double-buffered render loop:
Render(…);
glFlush();
SwapBuffers(…);

Kind Regards,
Daniel Dekkers

Try taking out glFlush function.
Also how do you measure fps?

Removing glFlush doesn’t change the fps results.
I’m using this function with a high-resolution counter c_StopWatch…

std::wstring
c_WindowOpenGL::GetFrameRate(void)
{
static bool l_StopWatchCounting = false;
static int l_Fps = -1;
std::wstring l_String;
static c_StopWatch l_StopWatch;
static int l_NrOfFrames;

if (!l_StopWatchCounting)
{
	// Initialise the StopWatch...
	l_StopWatch.SetTime(0.0);
	l_StopWatch.ResumeTime();
	l_StopWatchCounting = true;
	return TEXT("FPS: NA");
}
else
{
	if (l_StopWatch.ElapsedTime()>1.0)
	{
		// We have a valid frame rate for this second...
		l_Fps = l_NrOfFrames;
		// Reset the stopwatch...
		l_NrOfFrames = 0;
		l_StopWatch.SetTime(0.0);
		l_StopWatch.ResumeTime();
	}
	else
	{
		// Add 1 to the frame rate counter...
		++l_NrOfFrames;
	}

	if (l_Fps==-1)
	{
		return TEXT("FPS: NA");
	}
	else
	{
		return str(boost::wformat(TEXT("FPS: %d")) % l_Fps);
	}
}

}

Did you read the spec?
http://www.opengl.org/registry/specs/EXT/wgl_swap_control.txt

Actually I do understand myself this sentence:

An interval set to a value of 2
means that the color buffers will be swapped at most every other video
frame.

It sounds like you count your frames twice.
For 60hz lcd, I always have :
0: inf+
1: 60
2: 30
3: 20
… never tried farther.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.