Jump to content
  • Advertisement
Sign in to follow this  
hannibar

SwapBuffers & fps

This topic is 4482 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!