m_GLPixelIndex = ChoosePixelFormat( hDC, &pixelDesc);
if (m_GLPixelIndex==0) // Let's choose a default index.
{ m_GLPixelIndex = 1;
if (DescribePixelFormat(hDC, m_GLPixelIndex,
sizeof(PIXELFORMATDESCRIPTOR), &pixelDesc)==0)
{ return FALSE;
}
}
if (SetPixelFormat( hDC, m_GLPixelIndex, &pixelDesc)==FALSE)
{ return FALSE;
}
return TRUE;
}
接着用鼠标右键在CGLSample1View中添加保护型的成员变量:
int m_GLPixelIndex;
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/