SwapBuffers on XP vs Vista/Win 7

Hi,

For synchronizing certain things in my application I moved Swapbuffers that refreshes my windows from the thread that handles opengl to another thread.

On XP, it works perfectly, however, on Vista/win 7, it slows the whole application down horribly.

Is there any reason for that?

Thanks.

It is impossible to tell without more information. Please provide your measured frame time on each OS, whether you are using windowed or fullscreen modes, whether Aero is enabled and, most importantly, whether vsync mode is enabled/disabled on each case.

My guess is that vsync is enabled on Vista and disabled on XP, hence the discrepancy.

Hi,

Thanks for the answer. I am using windowed mode, no Aero. Vsync - I think - should be on, because I do not do anything with it. I don’t think there is any point in measuring the frame times, the difference is so huge. In XP, playback of the scene is smooth, so FPS is at least 30, in the newer OSs it is not more than 2-3 FPS, CPU load is off the scale in task manager.

It really looks like that for some reason unknown to me, Swapbuffers cannot be used in threads other than the opengl calling thread. At least in Vista and Win 7.

I admit that it never crossed my mind that you could issue SwapBuffers from a different thread.

Msdn reads: “With multithread applications, flush the drawing commands in any other threads drawing to the same window before calling SwapBuffers.”

Other than that, I cannot help you, sorry. Maybe someone from the resident OpenGL gurus has some idea?

Never crossed my mind either. Why would you want to do such a thing? strokes beard in reflection

OK, I will try to make a long story short. The whole application is based on broadcast video output (I support various cards). To output to these cards, I have to use a separate thread (let’s call it video thread), and all other stuff is synced to this thread (even the one with the opengl render), ie. it signals to the others to do their jobs.

I have a preview window on the VGA monitor that is refreshed with Swapbuffer, but since PAL video is 50Hz and VGA is anything but, playback on this preview output is understandably not smooth.

If there is not broadcast video card in the system, the VGA preview is the only output, but unless I rewrite all of my threads just for the VGA-only setup, there is still a video thread calling all others. But this video thread has no idea about Vsync, it can signal the opengl thread to render the next frame, but playback will not be smooth.

At least it wasn’t until I tried to put the Swapbuffers call to the video thread. Now I get smooth playback on the preview window, but only in XP. The newer OSs do not tolerate this at all. If you think that it is not even expected to work in any other thread but the opengl rendering one, and I am only lucky with XP, then I will drop the idea altogether.

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