Qt: Attempt to reduce flickering

This commit is contained in:
Vicki Pfau 2022-10-11 19:08:50 -07:00
parent 903f792731
commit ff772fce9d
2 changed files with 10 additions and 2 deletions

View File

@ -55,6 +55,14 @@ uint qHash(const QSurfaceFormat& format, uint seed) {
return qHash(representation, seed);
}
mGLWidget::mGLWidget(QWidget* parent)
: QOpenGLWidget(parent)
{
setUpdateBehavior(QOpenGLWidget::PartialUpdate);
connect(&m_refresh, &QTimer::timeout, this, static_cast<void (QWidget::*)()>(&QWidget::update));
}
void mGLWidget::initializeGL() {
m_vao = std::make_unique<QOpenGLVertexArrayObject>();
m_vao->create();
@ -84,8 +92,6 @@ void mGLWidget::initializeGL() {
m_vaoDone = false;
m_tex = 0;
connect(&m_refresh, &QTimer::timeout, this, static_cast<void (QWidget::*)()>(&QWidget::update));
}
bool mGLWidget::finalizeVAO() {

View File

@ -50,6 +50,8 @@ class mGLWidget : public QOpenGLWidget {
Q_OBJECT
public:
mGLWidget(QWidget* parent = nullptr);
void setTex(GLuint tex) { m_tex = tex; }
void setVBO(GLuint vbo) { m_vbo = vbo; }
bool finalizeVAO();