App: Warn on OpenGL too old (#9272)
* App: Warn on OpenGL too old Based on original code from PR #9164 * GUI: Switch to DlgCheckableMessageBox for openGL warning
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
#include "CommandPy.h"
|
||||
#include "Control.h"
|
||||
#include "PreferencePages/DlgSettingsCacheDirectory.h"
|
||||
#include "DlgCheckableMessageBox.h"
|
||||
#include "DocumentPy.h"
|
||||
#include "DocumentRecovery.h"
|
||||
#include "EditorView.h"
|
||||
@@ -2192,6 +2193,25 @@ void Application::runApplication()
|
||||
|
||||
int major = context.format().majorVersion();
|
||||
int minor = context.format().minorVersion();
|
||||
|
||||
#ifdef NDEBUG
|
||||
// In release mode, issue a warning to users that their version of OpenGL is
|
||||
// potentially going to cause problems
|
||||
if (major < 2) {
|
||||
auto message =
|
||||
QObject::tr("This system is running OpenGL %1.%2. "
|
||||
"FreeCAD requires OpenGL 2.0 or above. "
|
||||
"Please upgrade your graphics driver and/or card as required.")
|
||||
.arg(major)
|
||||
.arg(minor)
|
||||
+ QStringLiteral("\n");
|
||||
Base::Console().Warning(message.toStdString().c_str());
|
||||
Dialog::DlgCheckableMessageBox::showMessage(
|
||||
Gui::GUISingleApplication::applicationName() + QStringLiteral(" - ")
|
||||
+ QObject::tr("Invalid OpenGL Version"),
|
||||
message);
|
||||
}
|
||||
#endif
|
||||
const char* glVersion = reinterpret_cast<const char*>(glGetString(GL_VERSION));
|
||||
Base::Console().Log("OpenGL version is: %d.%d (%s)\n", major, minor, glVersion);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user