macOS does not populate the the OpenGL 3.0 compatibility functions

This commit is contained in:
Dan Paulat 2025-06-22 22:31:14 -05:00
parent ec06cc62e1
commit e51fd8b77b
5 changed files with 26 additions and 0 deletions

View file

@ -162,7 +162,10 @@ void PlacefileIcons::set_thresholded(bool thresholded)
void PlacefileIcons::Initialize() void PlacefileIcons::Initialize()
{ {
gl::OpenGLFunctions& gl = p->context_->gl(); gl::OpenGLFunctions& gl = p->context_->gl();
#if !defined(__APPLE__)
auto& gl30 = p->context_->gl30(); auto& gl30 = p->context_->gl30();
#endif
p->shaderProgram_ = p->context_->GetShaderProgram( p->shaderProgram_ = p->context_->GetShaderProgram(
{{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"},
@ -253,7 +256,11 @@ void PlacefileIcons::Initialize()
gl.glEnableVertexAttribArray(6); gl.glEnableVertexAttribArray(6);
// aDisplayed // aDisplayed
#if !defined(__APPLE__)
gl30.glVertexAttribI1i(7, 1); gl30.glVertexAttribI1i(7, 1);
#else
glVertexAttribI1i(7, 1);
#endif
p->dirty_ = true; p->dirty_ = true;
} }

View file

@ -140,7 +140,10 @@ void PlacefileImages::set_thresholded(bool thresholded)
void PlacefileImages::Initialize() void PlacefileImages::Initialize()
{ {
gl::OpenGLFunctions& gl = p->context_->gl(); gl::OpenGLFunctions& gl = p->context_->gl();
#if !defined(__APPLE__)
auto& gl30 = p->context_->gl30(); auto& gl30 = p->context_->gl30();
#endif
p->shaderProgram_ = p->context_->GetShaderProgram( p->shaderProgram_ = p->context_->GetShaderProgram(
{{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"},
@ -222,7 +225,11 @@ void PlacefileImages::Initialize()
gl.glEnableVertexAttribArray(6); gl.glEnableVertexAttribArray(6);
// aDisplayed // aDisplayed
#if !defined(__APPLE__)
gl30.glVertexAttribI1i(7, 1); gl30.glVertexAttribI1i(7, 1);
#else
glVertexAttribI1i(7, 1);
#endif
p->dirty_ = true; p->dirty_ = true;
} }

View file

@ -128,7 +128,10 @@ void PlacefileLines::set_thresholded(bool thresholded)
void PlacefileLines::Initialize() void PlacefileLines::Initialize()
{ {
gl::OpenGLFunctions& gl = p->context_->gl(); gl::OpenGLFunctions& gl = p->context_->gl();
#if !defined(__APPLE__)
auto& gl30 = p->context_->gl30(); auto& gl30 = p->context_->gl30();
#endif
p->shaderProgram_ = p->context_->GetShaderProgram( p->shaderProgram_ = p->context_->GetShaderProgram(
{{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"},
@ -207,7 +210,11 @@ void PlacefileLines::Initialize()
gl.glEnableVertexAttribArray(6); gl.glEnableVertexAttribArray(6);
// aDisplayed // aDisplayed
#if !defined(__APPLE__)
gl30.glVertexAttribI1i(7, 1); gl30.glVertexAttribI1i(7, 1);
#else
glVertexAttribI1i(7, 1);
#endif
p->dirty_ = true; p->dirty_ = true;
} }

View file

@ -56,10 +56,12 @@ gl::OpenGLFunctions& GlContext::gl()
return *p->gl_; return *p->gl_;
} }
#if !defined(__APPLE__)
QOpenGLFunctions_3_0& GlContext::gl30() QOpenGLFunctions_3_0& GlContext::gl30()
{ {
return *p->gl30_; return *p->gl30_;
} }
#endif
std::uint64_t GlContext::texture_buffer_count() const std::uint64_t GlContext::texture_buffer_count() const
{ {

View file

@ -25,7 +25,10 @@ public:
GlContext& operator=(GlContext&&) noexcept; GlContext& operator=(GlContext&&) noexcept;
gl::OpenGLFunctions& gl(); gl::OpenGLFunctions& gl();
#if !defined(__APPLE__)
QOpenGLFunctions_3_0& gl30(); QOpenGLFunctions_3_0& gl30();
#endif
std::uint64_t texture_buffer_count() const; std::uint64_t texture_buffer_count() const;