Jump to content
  • Advertisement
Sign in to follow this  
hannibar

OpenGL glFinish() slowdown

This topic is 4481 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 have a program with two windows in which I draw with openGL. The problem is that sometimes glFinish() is very slow. It happens in this function :
Window *win = G->window->first;

	while (win){
		__int64 test1, test2;

		selectWindow(win);

		test1 = gui_get_current_time_precise(); //for measuring the slowness
		glFinish();
		test2 = gui_get_current_time_precise(); //for measuring the slowness
		printf("%d %d\n", (int)(test2 - test1), win->winHandle); //for measuring the slowness

		SwapBuffers(win->winInfo->hdc);
		//wglSwapLayerBuffers(win->winInfo->hdc, WGL_SWAP_MAIN_PLANE);
		win = win->next;
	}
}
I have two windows opened : One larger window (640 * 480) and a smaller one (320 * 240). When the small window is the active window, glfinish() slows down to more that 35 milliseconds when it is on top of the large window. When I place the small window next to the large one, glFinish() only takes about 2 ms. Does anyone know what can cause this behaviour ? btw : The content drawn in the window is not much. At the moment : One rectangle in each window. so no problem here. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Check out this and this.

If anything, you should be calling glFlush(), then do any necessary updating, then once you've done everything else, feel free to call SwapBuffers(). It pays to read up on these things, 'specially when you don't know how the functions work.

Share this post


Link to post
Share on other sites
Thanks for the answer. Unfortuantely, removing glFinish() and using glFlush() doesn't help either. Swapbuffers is still slow as hell. Also not calling anything doesn't help.

The weird thing is that this slowness doesn't always happen. It doesn't happen when the small window doesn't overlap the larger one. And when the small one overlaps the larger one partially is sometimes happens, and sometimes doesn't happen.

Share this post


Link to post
Share on other sites
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!