diff --git a/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp b/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp index 0f9dd191..e415d24e 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp @@ -136,7 +136,8 @@ void GeoLines::set_thresholded(bool thresholded) void GeoLines::Initialize() { - gl::OpenGLFunctions& gl = p->context_->gl(); + gl::OpenGLFunctions& gl = p->context_->gl(); + auto& gl30 = p->context_->gl30(); p->shaderProgram_ = p->context_->GetShaderProgram( {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, @@ -215,6 +216,9 @@ void GeoLines::Initialize() reinterpret_cast(1 * sizeof(GLint))); gl.glEnableVertexAttribArray(6); + // aDisplayed + gl30.glVertexAttribI1i(7, 1); + p->dirty_ = true; } 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 d343acf3..abc852f8 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp @@ -161,7 +161,8 @@ void PlacefileIcons::set_thresholded(bool thresholded) void PlacefileIcons::Initialize() { - gl::OpenGLFunctions& gl = p->context_->gl(); + gl::OpenGLFunctions& gl = p->context_->gl(); + auto& gl30 = p->context_->gl30(); p->shaderProgram_ = p->context_->GetShaderProgram( {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, @@ -251,6 +252,9 @@ void PlacefileIcons::Initialize() reinterpret_cast(1 * sizeof(GLint))); gl.glEnableVertexAttribArray(6); + // aDisplayed + gl30.glVertexAttribI1i(7, 1); + 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 a1fbe032..aafaef8d 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_images.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_images.cpp @@ -139,7 +139,8 @@ void PlacefileImages::set_thresholded(bool thresholded) void PlacefileImages::Initialize() { - gl::OpenGLFunctions& gl = p->context_->gl(); + gl::OpenGLFunctions& gl = p->context_->gl(); + auto& gl30 = p->context_->gl30(); p->shaderProgram_ = p->context_->GetShaderProgram( {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, @@ -220,6 +221,9 @@ void PlacefileImages::Initialize() reinterpret_cast(1 * sizeof(GLint))); gl.glEnableVertexAttribArray(6); + // aDisplayed + gl30.glVertexAttribI1i(7, 1); + 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 ced0a41a..8fdce9f1 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_lines.cpp @@ -131,7 +131,8 @@ void PlacefileLines::set_thresholded(bool thresholded) void PlacefileLines::Initialize() { - gl::OpenGLFunctions& gl = p->context_->gl(); + gl::OpenGLFunctions& gl = p->context_->gl(); + auto& gl30 = p->context_->gl30(); p->shaderProgram_ = p->context_->GetShaderProgram( {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, @@ -209,6 +210,9 @@ void PlacefileLines::Initialize() reinterpret_cast(1 * sizeof(GLint))); gl.glEnableVertexAttribArray(6); + // aDisplayed + gl30.glVertexAttribI1i(7, 1); + 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 592d12cb..813225e1 100644 --- a/scwx-qt/source/scwx/qt/gl/gl_context.cpp +++ b/scwx-qt/source/scwx/qt/gl/gl_context.cpp @@ -31,7 +31,8 @@ public: static std::size_t GetShaderKey(std::initializer_list> shaders); - gl::OpenGLFunctions gl_; + gl::OpenGLFunctions gl_; + QOpenGLFunctions_3_0 gl30_; bool glInitialized_ {false}; @@ -56,6 +57,11 @@ gl::OpenGLFunctions& GlContext::gl() return p->gl_; } +QOpenGLFunctions_3_0& GlContext::gl30() +{ + return p->gl30_; +} + std::uint64_t GlContext::texture_buffer_count() const { return p->textureBufferCount_; @@ -68,6 +74,9 @@ void GlContext::Impl::InitializeGL() return; } + gl_.initializeOpenGLFunctions(); + gl30_.initializeOpenGLFunctions(); + gl_.glGenTextures(1, &textureAtlas_); glInitialized_ = true; @@ -122,6 +131,11 @@ GLuint GlContext::GetTextureAtlas() return p->textureAtlas_; } +void GlContext::Initialize() +{ + p->InitializeGL(); +} + std::size_t GlContext::Impl::GetShaderKey( std::initializer_list> shaders) { diff --git a/scwx-qt/source/scwx/qt/gl/gl_context.hpp b/scwx-qt/source/scwx/qt/gl/gl_context.hpp index b09ff403..1ba74fb8 100644 --- a/scwx-qt/source/scwx/qt/gl/gl_context.hpp +++ b/scwx-qt/source/scwx/qt/gl/gl_context.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace scwx { namespace qt @@ -22,7 +24,8 @@ public: GlContext(GlContext&&) noexcept; GlContext& operator=(GlContext&&) noexcept; - gl::OpenGLFunctions& gl(); + gl::OpenGLFunctions& gl(); + QOpenGLFunctions_3_0& gl30(); std::uint64_t texture_buffer_count() const; @@ -34,6 +37,8 @@ public: GLuint GetTextureAtlas(); + void Initialize(); + private: class Impl; diff --git a/scwx-qt/source/scwx/qt/map/map_widget.cpp b/scwx-qt/source/scwx/qt/map/map_widget.cpp index 9737b86e..5d9be73f 100644 --- a/scwx-qt/source/scwx/qt/map/map_widget.cpp +++ b/scwx-qt/source/scwx/qt/map/map_widget.cpp @@ -1325,7 +1325,7 @@ void MapWidget::initializeGL() logger_->debug("initializeGL()"); makeCurrent(); - p->context_->gl().initializeOpenGLFunctions(); + p->context_->Initialize(); // Lock ImGui font atlas prior to new ImGui frame std::shared_lock imguiFontAtlasLock {