MCPcopy Create free account
hub / github.com/SFML/SFML / checkSettings

Method checkSettings

src/SFML/Window/GlContext.cpp:1046–1071  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

1044
1045////////////////////////////////////////////////////////////
1046void GlContext::checkSettings(const ContextSettings& requestedSettings) const
1047{
1048 // Perform checks to inform the user if they are getting a context they might not have expected
1049 const int version = static_cast<int>(m_settings.majorVersion * 10u + m_settings.minorVersion);
1050 const int requestedVersion = static_cast<int>(requestedSettings.majorVersion * 10u + requestedSettings.minorVersion);
1051
1052 if ((m_settings.attributeFlags != requestedSettings.attributeFlags) || (version < requestedVersion) ||
1053 (m_settings.stencilBits < requestedSettings.stencilBits) ||
1054 (m_settings.antiAliasingLevel < requestedSettings.antiAliasingLevel) ||
1055 (m_settings.depthBits < requestedSettings.depthBits) || (!m_settings.sRgbCapable && requestedSettings.sRgbCapable))
1056 {
1057 err() << "Warning: The created OpenGL context does not fully meet the settings that were requested" << '\n'
1058 << "Requested: version = " << requestedSettings.majorVersion << "." << requestedSettings.minorVersion
1059 << " ; depth bits = " << requestedSettings.depthBits << " ; stencil bits = " << requestedSettings.stencilBits
1060 << " ; AA level = " << requestedSettings.antiAliasingLevel << std::boolalpha
1061 << " ; core = " << ((requestedSettings.attributeFlags & ContextSettings::Core) != 0)
1062 << " ; debug = " << ((requestedSettings.attributeFlags & ContextSettings::Debug) != 0)
1063 << " ; sRGB = " << requestedSettings.sRgbCapable << std::noboolalpha << '\n'
1064 << "Created: version = " << m_settings.majorVersion << "." << m_settings.minorVersion
1065 << " ; depth bits = " << m_settings.depthBits << " ; stencil bits = " << m_settings.stencilBits
1066 << " ; AA level = " << m_settings.antiAliasingLevel << std::boolalpha
1067 << " ; core = " << ((m_settings.attributeFlags & ContextSettings::Core) != 0)
1068 << " ; debug = " << ((m_settings.attributeFlags & ContextSettings::Debug) != 0)
1069 << " ; sRGB = " << m_settings.sRgbCapable << std::noboolalpha << std::endl;
1070 }
1071}
1072
1073} // namespace sf::priv

Callers 1

createMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected