# 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.

## 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 on other sites
Your options are to disable V-Synch or to use a seperate thread for each window.

• 10
• 9
• 48
• 12
• 10
• ### Forum Statistics

• Total Topics
631385
• Total Posts
2999705
×