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

@ -137,6 +137,7 @@ void GeoLines::set_thresholded(bool thresholded)
void GeoLines::Initialize()
{
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<void*>(1 * sizeof(GLint)));
gl.glEnableVertexAttribArray(6);
// aDisplayed
gl30.glVertexAttribI1i(7, 1);
p->dirty_ = true;
}

View file

@ -162,6 +162,7 @@ void PlacefileIcons::set_thresholded(bool thresholded)
void PlacefileIcons::Initialize()
{
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<void*>(1 * sizeof(GLint)));
gl.glEnableVertexAttribArray(6);
// aDisplayed
gl30.glVertexAttribI1i(7, 1);
p->dirty_ = true;
}

View file

@ -140,6 +140,7 @@ void PlacefileImages::set_thresholded(bool thresholded)
void PlacefileImages::Initialize()
{
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<void*>(1 * sizeof(GLint)));
gl.glEnableVertexAttribArray(6);
// aDisplayed
gl30.glVertexAttribI1i(7, 1);
p->dirty_ = true;
}

View file

@ -132,6 +132,7 @@ void PlacefileLines::set_thresholded(bool thresholded)
void PlacefileLines::Initialize()
{
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<void*>(1 * sizeof(GLint)));
gl.glEnableVertexAttribArray(6);
// aDisplayed
gl30.glVertexAttribI1i(7, 1);
p->dirty_ = true;
}

View file

@ -32,6 +32,7 @@ public:
GetShaderKey(std::initializer_list<std::pair<GLenum, std::string>> shaders);
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<std::pair<GLenum, std::string>> shaders)
{

View file

@ -3,6 +3,8 @@
#include <scwx/qt/gl/gl.hpp>
#include <scwx/qt/gl/shader_program.hpp>
#include <QOpenGLFunctions_3_0>
namespace scwx
{
namespace qt
@ -23,6 +25,7 @@ public:
GlContext& operator=(GlContext&&) noexcept;
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;

View file

@ -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 {