///////////////////////////////////////////////////////
| 458 | |
| 459 | //////////////////////////////////////////////////////////// |
| 460 | void WglContext::setDevicePixelFormat(unsigned int bitsPerPixel) |
| 461 | { |
| 462 | const int bestFormat = selectBestPixelFormat(m_deviceContext, bitsPerPixel, m_settings); |
| 463 | |
| 464 | if (bestFormat == 0) |
| 465 | { |
| 466 | err() << "Failed to find a suitable pixel format for device context: " << getErrorString(GetLastError()) << '\n' |
| 467 | << "Cannot create OpenGL context" << std::endl; |
| 468 | return; |
| 469 | } |
| 470 | |
| 471 | // Extract the depth and stencil bits from the chosen format |
| 472 | PIXELFORMATDESCRIPTOR actualFormat; |
| 473 | actualFormat.nSize = sizeof(actualFormat); |
| 474 | actualFormat.nVersion = 1; |
| 475 | DescribePixelFormat(m_deviceContext, bestFormat, sizeof(actualFormat), &actualFormat); |
| 476 | |
| 477 | // Set the chosen pixel format |
| 478 | if (SetPixelFormat(m_deviceContext, bestFormat, &actualFormat) == FALSE) |
| 479 | { |
| 480 | err() << "Failed to set pixel format for device context: " << getErrorString(GetLastError()) << '\n' |
| 481 | << "Cannot create OpenGL context" << std::endl; |
| 482 | return; |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | |
| 487 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected