PIXELFORMATDESCRIPTOR pfd;
memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
// pfd.cAlphaBits = 8;
pfd.cDepthBits = 24;
pfd.iLayerType = PFD_MAIN_PLANE;
int iPixelFormat = ChoosePixelFormat(m_hDC, &pfd);
if (iPixelFormat == 0)
throw("Error calling ChoosePixelFormat");
if(!SetPixelFormat(m_hDC, iPixelFormat, &pfd))
throw("Error calling SetPixelFormat");
I am having problems initialising OpenGL on a GTX 1050 with latest driver. SetPixelFormat always fails. I tried changing cColorBits, cDepthBits, etc. makes no difference. Also, this same code works fine with Intel and AMD GPUs. Anyone have any ideas whats wrong?