// Find a pixel format with no antialiasing, if not needed or not supported func BestChoosePixelFormat(hdc C.HDC, bitsPerPixel uint, settings *ContextSettings) C.int { // Setup a pixel format descriptor from the rendering settings descriptor := C.PIXELFORMATDESCRIPTOR{ nSize: C.PIXELFORMATDESCRIPTOR_size, nVersion: 1, iLayerType: C.PFD_MAIN_PLANE, dwFlags: C.PFD_DRAW_TO_WINDOW | C.PFD_SUPPORT_OPENGL | C.PFD_DOUBLEBUFFER, iPixelType: C.PFD_TYPE_RGBA, cColorBits: C.BYTE(bitsPerPixel), cDepthBits: C.BYTE(settings.DepthBits), cStencilBits: C.BYTE(settings.StencilBits), } if bitsPerPixel == 32 { descriptor.cAlphaBits = 8 } // Get the pixel format that best matches our requirements return C.ChoosePixelFormat(hdc, &descriptor) }