Sign in to follow this  
hannibar

SwapBuffers & fps

Recommended Posts

hannibar    122
I'm writing a program in which more than one window can be opened. I call the following function every frame :
void swap_buffers(void){
	Window *win = G->window->first;

	while (win){
		wglMakeCurrent(win->hdc, win->hrc);
		SwapBuffers(win->hdc);
		win = win->next;
	}
}
Here, Window is a self defined structure which is linked in a linked list, and contains the handles to the rendering context and the device context. The problem is the following : - when I have 1 window opened, my framerate is 85 fps (on average). - when I have 2 windows opened, my framerate is 42.5 fps. - when I have 3 windows opened, my framerate is 28.3 fps. - when I have 4 windows opened, my framerate is 21.25 fps. => fps = my monitor refresh rate devided by the number of windows opened. I suspect that the problem lies with the vertical sync which limits the pfs to (in my case) 85 fps. I don't mind having a maximum of 85 fps, but when I open 8 windows, my fps is about 10 fps which is to low. this is probably caused by calling SwapBuffers(...) more than once each frame (once for each window). But I don't know how I can solve this, because all windows have to be redrawn each frame. Can anyone help me here ? Thanks in advance. [Edited by - hannibar on March 13, 2006 5:22:41 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this