private void initPixelFormat() { int pixelFormatIndex = 0; WGL.PIXELFORMATDESCRIPTOR pixelFormatDescriptor = new WGL.PIXELFORMATDESCRIPTOR(); WGL.ZeroPixelDescriptor(ref pixelFormatDescriptor); pixelFormatDescriptor.nVersion = 1; pixelFormatDescriptor.dwFlags = (WGL.PFD_DRAW_TO_WINDOW | WGL.PFD_SUPPORT_OPENGL | WGL.PFD_DOUBLEBUFFER); pixelFormatDescriptor.iPixelType = (byte)(WGL.PFD_TYPE_RGBA); pixelFormatDescriptor.cColorBits = 32; pixelFormatDescriptor.cDepthBits = 32; pixelFormatDescriptor.iLayerType = (byte)(WGL.PFD_MAIN_PLANE); pixelFormatDescriptor.cStencilBits = 32; pixelFormatIndex = WGL.ChoosePixelFormat(m_uint_DC, ref pixelFormatDescriptor); if (pixelFormatIndex == 0) { MessageBox.Show("Unable to retrieve pixel format"); return; } if (WGL.SetPixelFormat(m_uint_DC, pixelFormatIndex, ref pixelFormatDescriptor) == 0) { MessageBox.Show("Unable to set pixel format"); return; } }