Qt: Fix VAO reinitialization

This commit is contained in:
Vicki Pfau 2022-06-16 15:38:38 -07:00
parent fa910fc629
commit 07221181ea
2 changed files with 8 additions and 0 deletions

View File

@ -82,6 +82,8 @@ void mGLWidget::initializeGL() {
m_program->setUniformValue("tex", 0);
m_positionLocation = m_program->attributeLocation("position");
m_vaoDone = false;
connect(&m_refresh, &QTimer::timeout, this, static_cast<void (QWidget::*)()>(&QWidget::update));
}
@ -98,6 +100,10 @@ void mGLWidget::finalizeVAO() {
}
}
void mGLWidget::reset() {
m_vaoDone = false;
}
void mGLWidget::paintGL() {
if (!m_vaoDone) {
finalizeVAO();
@ -210,6 +216,7 @@ void DisplayGL::startDrawing(std::shared_ptr<CoreController> controller) {
}
} else {
show();
m_gl->reset();
}
}

View File

@ -53,6 +53,7 @@ public:
void setTex(GLuint tex) { m_tex = tex; }
void setVBO(GLuint vbo) { m_vbo = vbo; }
void finalizeVAO();
void reset();
protected:
void initializeGL() override;