/// <summary> /// Set the pixel format on Windows platform. /// </summary> private void SetPixelFormatWgl() { WindowsDeviceContext winDeviceContext = (WindowsDeviceContext)_DeviceContext; // Define most compatible pixel format Wgl.PIXELFORMATDESCRIPTOR pfd = new Wgl.PIXELFORMATDESCRIPTOR(24); int pFormat; // Find pixel format match pFormat = Wgl.ChoosePixelFormat(winDeviceContext.DeviceContext, ref pfd); // Get exact description of the pixel format Wgl.DescribePixelFormat(winDeviceContext.DeviceContext, pFormat, (uint)pfd.nSize, ref pfd); // Set pixel format before creating OpenGL context Wgl.SetPixelFormat(winDeviceContext.DeviceContext, pFormat, ref pfd); }