wglMakeCurrent takes too long

Hello everyone!

I am new to this forum and I thought maybe I can get a little help.

I am working in sound software company and we have the following problem: We need to open a number of plugins, each in different window. Each plugin should display graphic information in approximate FPS of 50.

We tried 2 different approaches:

  1. We open one graphic thread drawing one after another in each window. In that case we are forced to call wglMakeCurrent in order to switch context between the threads and each time the call is approximately 10ms. This means that the TOTAL fps is not more than 100ms, and if I have, say, 5 windows open the FPS in each of them will be 20.

  2. Open different thread per window. In that case situation is MUCH worse. The stuck is in SwapBuffer function and I guess that it is in gFlush() that is inside SwapBuffers.

Now the funny thing, that if instead of opening 5 windows you open 5 applications and one window in each of them - it works fine.

Any suggestions?

Just to be curious, how do you count the time it takes for MakeCurrent ?

In my programs I use MakeCurrent on each begining of the rendering function. I never noticed such a suffering in rendering. Plus, I can have real high fps (> 100).

I have a call for timer before and after the function.

Which counter?
I have just measured the time my ActivateGL() function takes to execute. It contains Lock() and wglMakeCurrent(). Calls from the same thread eliminates Lock() call. So, on C2D E6750@2.66GHz and WinXP 32bit, wglMakeCurrent() lasts about 0.047323[ms]. It is a mean time (from 0.029333[ms] to 0.143594[ms]). Probably you have some other problems, or the measurement is inaccurate.

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