From e51fd8b77b9450e6ff99475a852420a61f970b69 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Sun, 22 Jun 2025 22:31:14 -0500 Subject: [PATCH] macOS does not populate the the OpenGL 3.0 compatibility functions --- scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp | 7 +++++++ scwx-qt/source/scwx/qt/gl/draw/placefile_images.cpp | 7 +++++++ scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp | 7 +++++++ scwx-qt/source/scwx/qt/gl/gl_context.cpp | 2 ++ scwx-qt/source/scwx/qt/gl/gl_context.hpp | 3 +++ 5 files changed, 26 insertions(+) diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp index b321e149..c86007f9 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp @@ -162,7 +162,10 @@ void PlacefileIcons::set_thresholded(bool thresholded) void PlacefileIcons::Initialize() { gl::OpenGLFunctions& gl = p->context_->gl(); + +#if !defined(__APPLE__) auto& gl30 = p->context_->gl30(); +#endif p->shaderProgram_ = p->context_->GetShaderProgram( {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, @@ -253,7 +256,11 @@ void PlacefileIcons::Initialize() gl.glEnableVertexAttribArray(6); // aDisplayed +#if !defined(__APPLE__) gl30.glVertexAttribI1i(7, 1); +#else + glVertexAttribI1i(7, 1); +#endif p->dirty_ = true; } diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_images.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_images.cpp index aafaef8d..d7dddf68 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_images.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_images.cpp @@ -140,7 +140,10 @@ void PlacefileImages::set_thresholded(bool thresholded) void PlacefileImages::Initialize() { gl::OpenGLFunctions& gl = p->context_->gl(); + +#if !defined(__APPLE__) auto& gl30 = p->context_->gl30(); +#endif p->shaderProgram_ = p->context_->GetShaderProgram( {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, @@ -222,7 +225,11 @@ void PlacefileImages::Initialize() gl.glEnableVertexAttribArray(6); // aDisplayed +#if !defined(__APPLE__) gl30.glVertexAttribI1i(7, 1); +#else + glVertexAttribI1i(7, 1); +#endif p->dirty_ = true; } diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp index 6ec2750a..d9c49085 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp @@ -128,7 +128,10 @@ void PlacefileLines::set_thresholded(bool thresholded) void PlacefileLines::Initialize() { gl::OpenGLFunctions& gl = p->context_->gl(); + +#if !defined(__APPLE__) auto& gl30 = p->context_->gl30(); +#endif p->shaderProgram_ = p->context_->GetShaderProgram( {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, @@ -207,7 +210,11 @@ void PlacefileLines::Initialize() gl.glEnableVertexAttribArray(6); // aDisplayed +#if !defined(__APPLE__) gl30.glVertexAttribI1i(7, 1); +#else + glVertexAttribI1i(7, 1); +#endif p->dirty_ = true; } diff --git a/scwx-qt/source/scwx/qt/gl/gl_context.cpp b/scwx-qt/source/scwx/qt/gl/gl_context.cpp index 9fd6bd85..b2cbbde3 100644 --- a/scwx-qt/source/scwx/qt/gl/gl_context.cpp +++ b/scwx-qt/source/scwx/qt/gl/gl_context.cpp @@ -56,10 +56,12 @@ gl::OpenGLFunctions& GlContext::gl() return *p->gl_; } +#if !defined(__APPLE__) QOpenGLFunctions_3_0& GlContext::gl30() { return *p->gl30_; } +#endif std::uint64_t GlContext::texture_buffer_count() const { diff --git a/scwx-qt/source/scwx/qt/gl/gl_context.hpp b/scwx-qt/source/scwx/qt/gl/gl_context.hpp index b4a6a866..b506fca1 100644 --- a/scwx-qt/source/scwx/qt/gl/gl_context.hpp +++ b/scwx-qt/source/scwx/qt/gl/gl_context.hpp @@ -25,7 +25,10 @@ public: GlContext& operator=(GlContext&&) noexcept; gl::OpenGLFunctions& gl(); + +#if !defined(__APPLE__) QOpenGLFunctions_3_0& gl30(); +#endif std::uint64_t texture_buffer_count() const;