mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:10:04 +00:00
Updates for OpenGL 4.1 Core on macOS
This commit is contained in:
parent
a5a96eb7c4
commit
ccd27980a2
2 changed files with 19 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ namespace gl
|
||||||
{
|
{
|
||||||
|
|
||||||
static const std::string logPrefix_ = "scwx::qt::gl::gl_context";
|
static const std::string logPrefix_ = "scwx::qt::gl::gl_context";
|
||||||
|
static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||||
|
|
||||||
class GlContext::Impl
|
class GlContext::Impl
|
||||||
{
|
{
|
||||||
|
|
@ -84,6 +85,13 @@ void GlContext::Impl::InitializeGL()
|
||||||
gl_->initializeOpenGLFunctions();
|
gl_->initializeOpenGLFunctions();
|
||||||
gl30_->initializeOpenGLFunctions();
|
gl30_->initializeOpenGLFunctions();
|
||||||
|
|
||||||
|
logger_->info("OpenGL Version: {}",
|
||||||
|
reinterpret_cast<const char*>(gl_->glGetString(GL_VERSION)));
|
||||||
|
logger_->info("OpenGL Vendor: {}",
|
||||||
|
reinterpret_cast<const char*>(gl_->glGetString(GL_VENDOR)));
|
||||||
|
logger_->info("OpenGL Renderer: {}",
|
||||||
|
reinterpret_cast<const char*>(gl_->glGetString(GL_RENDERER)));
|
||||||
|
|
||||||
gl_->glGenTextures(1, &textureAtlas_);
|
gl_->glGenTextures(1, &textureAtlas_);
|
||||||
|
|
||||||
glInitialized_ = true;
|
glInitialized_ = true;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QStyleHints>
|
#include <QStyleHints>
|
||||||
|
#include <QSurfaceFormat>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
|
@ -62,6 +63,16 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
|
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);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
QCoreApplication::setApplicationName("Supercell Wx");
|
QCoreApplication::setApplicationName("Supercell Wx");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue