Why VSync can not be opened under Windows7?

Below is my code to create a OpenGL Render RC:

m_hDC=::GetDC(m_hWnd);
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number

PFD_DRAW_TO_WINDOW |PFD_SUPPORT_OPENGL |PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA, // RGBA type
32, // 32-bit color depth
0, 0, 0, 0, 0, 0, // color bits ignored
0, // no alpha buffer
0, // shift bit ignored
0, // no accumulation buffer
0, 0, 0, 0, // accum bits ignored
0, // 32-bit z-buffer
0, // no stencil buffer
0, // no auxiliary buffer
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0 // layer masks ignored
};
BOOL bRet=FALSE;
int index=ChoosePixelFormat(m_hDC,&pfd);
if(index)
{
if(SetPixelFormat(m_hDC,index,&pfd))
{
m_hRC=wglCreateContext(m_hDC);
if(m_hRC)
bRet=wglMakeCurrent(m_hDC,m_hRC);
}
}
if(bRet)
Reshape();
else
assert(FALSE);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glEnable(GL_TEXTURE_2D);
wglSwapIntervalEXT(1);// turn on VSync
assert(wglGetSwapIntervalEXT() == 1); // Check VSync is opened or not
return bRet;

In WindowsXP,the code can turn on the “VSync” function and the rendered image looks smooth in OpenGL window,but in Windows7,the OpenGL API tell me I had turn on the function(the “wglGetSwapIntervalEXT()” return 1),but the rendered image in OpenGL Window is chapped,just like VSync is off,why the code can not turn on VSync under Windows7?

My test computer use NV Geforce GTX 670 display card,with V320.49 driver.

Yeah, that’s frustrating. Hopefully someone that does more Windows OpenGL dev will follow-up, but I believe the issue is that MS Windows versions since Vista (which include Windows 7 but not XP) have a compositing window manager (originally called Aero, now often just referred to as DWM) which whether you like it or not takes ownership of VSYNC.

Ways often mentioned for potentially getting around this problem are 1) disable Aero/DWM (which gets rid of the annoying software that’s stealing control of VSYNC), or 2) make your application full-screen (which may cause Aero/DWM to loan control of VSYNC to your application). Random websearch hits: Vista auto-fullscreen-detection disabling aero? and disable vsync with Windows 7 ?. For more, you now know the terms to search for: opengl vsync windows dwm vista

I had close the DWM(just close the “Desktop Window Manager Session Manager” serive from ControlPanal),but the problem still exist;my OpenGL render window is a MFC dialog with no border, and popup style added,and I reposition the dialog to cover fullscreen,is the dialog window cause my problem?I plan to write a new Window class to check it tomorrow.

Have you checked your NVIDIA control panel that you’re not forcing vsync off there? I’ve definitely got no problem with wglSwapInterval stuff under NVIDIA graphics and Windows 7.

I set vsync is controlled by application in NVIDIA control panal