Commit 840d36d7 authored by Jan Möbius's avatar Jan Möbius

No longer accept NoProfile and try to get a suitable format instead.

parent 31d3efbc
......@@ -538,16 +538,10 @@ bool verifySpecificContextFormat(QSurfaceFormat format, QSurfaceFormat* resultin
auto curVersionInt = curVersion.first * 10 + curVersion.second;
// Qt Docs say: Whenever "NoProfile" is returned, either the GL version is < 3.2 or (GL >= 3.2) it is actually a core profile
// Thus we set the following guidelines:
// We set the following guidelines:
// 1. Whenever the actually received GL version is < than the requested one, the context is not the one requested
// 2. If the requested version is >= 3.2 and Compat, only Compat is allowed (as NoProfile is considered core)
// 3. If the requested version is >= 3.2 and Core or NoProfile is requested, Compat is not allowed
// For >= 3.2, treat Core and NoProfile equally
bool reqCoreOrNoProfile = format.profile() == QSurfaceFormat::NoProfile || format.profile() == QSurfaceFormat::CoreProfile;
bool curCoreOrNoProfile = resultFormat.profile() == QSurfaceFormat::NoProfile || resultFormat.profile() == QSurfaceFormat::CoreProfile;
// 2. If the received profile is not the requested one, the context is not the one requested
if(curVersionInt < 32 && resultFormat.profile() == QSurfaceFormat::CoreProfile)
{
......@@ -558,7 +552,7 @@ bool verifySpecificContextFormat(QSurfaceFormat format, QSurfaceFormat* resultin
// Check whether the conditions above are met.
// If not, print some error to the console
if(curVersionInt < reqVersionInt ||
(reqVersionInt >= 32 && reqCoreOrNoProfile != curCoreOrNoProfile))
format.profile()!= resultFormat.profile() )
{
std::cout << "[OpenGL context] Requested: "
<< format.version().first << "." << format.version().second << " (" << reqProfileString << ")"
......@@ -570,10 +564,6 @@ bool verifySpecificContextFormat(QSurfaceFormat format, QSurfaceFormat* resultin
std::cout << "[OpenGL context] Successfully created OpenGL context with version " << curVersion.first << "."
<< curVersion.second << " (" << curProfileString << ")." << std::endl;
if(resultFormat.profile() == QSurfaceFormat::NoProfile || curVersionInt < 32)
{
std::cout << "[OpenGL context] Note that 'NoProfile' is fine for OpenGL version < 3.2 as core profile was introduced in 3.2" << std::endl;
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment