Updates for OpenGL 4.1 Core on macOS

This commit is contained in:
Dan Paulat 2025-06-14 22:35:34 -05:00
parent a5a96eb7c4
commit ccd27980a2
2 changed files with 19 additions and 0 deletions

View file

@ -28,6 +28,7 @@
#include <QApplication>
#include <QStandardPaths>
#include <QStyleHints>
#include <QSurfaceFormat>
#include <QTranslator>
#include <QPalette>
#include <QStyle>
@ -62,6 +63,16 @@ int main(int argc, char* argv[])
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
#if defined(__APPLE__)
// For macOS, we must choose between OpenGL 4.1 Core and OpenGL 2.1
// Compatibility. OpenGL 2.1 does not meet requirements for shaders used by
// Supercell Wx.
QSurfaceFormat surfaceFormat = QSurfaceFormat::defaultFormat();
surfaceFormat.setVersion(4, 1);
surfaceFormat.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
QSurfaceFormat::setDefaultFormat(surfaceFormat);
#endif
QApplication a(argc, argv);
QCoreApplication::setApplicationName("Supercell Wx");