Default geo_texture2d displayed parameter to true when not used

This commit is contained in:
Dan Paulat 2024-04-21 00:20:00 -05:00
parent f4bc2572d2
commit 15beb9436d
7 changed files with 42 additions and 7 deletions

View file

@ -136,7 +136,8 @@ void GeoLines::set_thresholded(bool thresholded)
void GeoLines::Initialize() 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( p->shaderProgram_ = p->context_->GetShaderProgram(
{{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"},
@ -215,6 +216,9 @@ void GeoLines::Initialize()
reinterpret_cast<void*>(1 * sizeof(GLint))); reinterpret_cast<void*>(1 * sizeof(GLint)));
gl.glEnableVertexAttribArray(6); gl.glEnableVertexAttribArray(6);
// aDisplayed
gl30.glVertexAttribI1i(7, 1);
p->dirty_ = true; p->dirty_ = true;
} }

View file

@ -161,7 +161,8 @@ void PlacefileIcons::set_thresholded(bool thresholded)
void PlacefileIcons::Initialize() 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( p->shaderProgram_ = p->context_->GetShaderProgram(
{{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"},
@ -251,6 +252,9 @@ void PlacefileIcons::Initialize()
reinterpret_cast<void*>(1 * sizeof(GLint))); reinterpret_cast<void*>(1 * sizeof(GLint)));
gl.glEnableVertexAttribArray(6); gl.glEnableVertexAttribArray(6);
// aDisplayed
gl30.glVertexAttribI1i(7, 1);
p->dirty_ = true; p->dirty_ = true;
} }

View file

@ -139,7 +139,8 @@ void PlacefileImages::set_thresholded(bool thresholded)
void PlacefileImages::Initialize() 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( p->shaderProgram_ = p->context_->GetShaderProgram(
{{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"},
@ -220,6 +221,9 @@ void PlacefileImages::Initialize()
reinterpret_cast<void*>(1 * sizeof(GLint))); reinterpret_cast<void*>(1 * sizeof(GLint)));
gl.glEnableVertexAttribArray(6); gl.glEnableVertexAttribArray(6);
// aDisplayed
gl30.glVertexAttribI1i(7, 1);
p->dirty_ = true; p->dirty_ = true;
} }

View file

@ -131,7 +131,8 @@ void PlacefileLines::set_thresholded(bool thresholded)
void PlacefileLines::Initialize() 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( p->shaderProgram_ = p->context_->GetShaderProgram(
{{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"}, {{GL_VERTEX_SHADER, ":/gl/geo_texture2d.vert"},
@ -209,6 +210,9 @@ void PlacefileLines::Initialize()
reinterpret_cast<void*>(1 * sizeof(GLint))); reinterpret_cast<void*>(1 * sizeof(GLint)));
gl.glEnableVertexAttribArray(6); gl.glEnableVertexAttribArray(6);
// aDisplayed
gl30.glVertexAttribI1i(7, 1);
p->dirty_ = true; p->dirty_ = true;
} }

View file

@ -31,7 +31,8 @@ public:
static std::size_t static std::size_t
GetShaderKey(std::initializer_list<std::pair<GLenum, std::string>> shaders); GetShaderKey(std::initializer_list<std::pair<GLenum, std::string>> shaders);
gl::OpenGLFunctions gl_; gl::OpenGLFunctions gl_;
QOpenGLFunctions_3_0 gl30_;
bool glInitialized_ {false}; bool glInitialized_ {false};
@ -56,6 +57,11 @@ gl::OpenGLFunctions& GlContext::gl()
return p->gl_; return p->gl_;
} }
QOpenGLFunctions_3_0& GlContext::gl30()
{
return p->gl30_;
}
std::uint64_t GlContext::texture_buffer_count() const std::uint64_t GlContext::texture_buffer_count() const
{ {
return p->textureBufferCount_; return p->textureBufferCount_;
@ -68,6 +74,9 @@ void GlContext::Impl::InitializeGL()
return; return;
} }
gl_.initializeOpenGLFunctions();
gl30_.initializeOpenGLFunctions();
gl_.glGenTextures(1, &textureAtlas_); gl_.glGenTextures(1, &textureAtlas_);
glInitialized_ = true; glInitialized_ = true;
@ -122,6 +131,11 @@ GLuint GlContext::GetTextureAtlas()
return p->textureAtlas_; return p->textureAtlas_;
} }
void GlContext::Initialize()
{
p->InitializeGL();
}
std::size_t GlContext::Impl::GetShaderKey( std::size_t GlContext::Impl::GetShaderKey(
std::initializer_list<std::pair<GLenum, std::string>> shaders) std::initializer_list<std::pair<GLenum, std::string>> shaders)
{ {

View file

@ -3,6 +3,8 @@
#include <scwx/qt/gl/gl.hpp> #include <scwx/qt/gl/gl.hpp>
#include <scwx/qt/gl/shader_program.hpp> #include <scwx/qt/gl/shader_program.hpp>
#include <QOpenGLFunctions_3_0>
namespace scwx namespace scwx
{ {
namespace qt namespace qt
@ -22,7 +24,8 @@ public:
GlContext(GlContext&&) noexcept; GlContext(GlContext&&) noexcept;
GlContext& operator=(GlContext&&) noexcept; GlContext& operator=(GlContext&&) noexcept;
gl::OpenGLFunctions& gl(); gl::OpenGLFunctions& gl();
QOpenGLFunctions_3_0& gl30();
std::uint64_t texture_buffer_count() const; std::uint64_t texture_buffer_count() const;
@ -34,6 +37,8 @@ public:
GLuint GetTextureAtlas(); GLuint GetTextureAtlas();
void Initialize();
private: private:
class Impl; class Impl;

View file

@ -1325,7 +1325,7 @@ void MapWidget::initializeGL()
logger_->debug("initializeGL()"); logger_->debug("initializeGL()");
makeCurrent(); makeCurrent();
p->context_->gl().initializeOpenGLFunctions(); p->context_->Initialize();
// Lock ImGui font atlas prior to new ImGui frame // Lock ImGui font atlas prior to new ImGui frame
std::shared_lock imguiFontAtlasLock { std::shared_lock imguiFontAtlasLock {