diff --git a/OSBindings/Qt/scantargetwidget.cpp b/OSBindings/Qt/scantargetwidget.cpp index d1582a8f9..1975d8a4a 100644 --- a/OSBindings/Qt/scantargetwidget.cpp +++ b/OSBindings/Qt/scantargetwidget.cpp @@ -20,7 +20,7 @@ void ScanTargetWidget::initializeGL() { void ScanTargetWidget::paintGL() { glClear(GL_COLOR_BUFFER_BIT); - if(scanTarget) { + if(isConnected) { vsyncPredictor.begin_redraw(); scanTarget->update(width(), height()); scanTarget->draw(width(), height()); @@ -47,6 +47,7 @@ void ScanTargetWidget::resizeGL(int w, int h) { Outputs::Display::OpenGL::ScanTarget *ScanTargetWidget::getScanTarget() { makeCurrent(); if(!scanTarget) { + isConnected = true; scanTarget = std::make_unique(defaultFramebufferObject()); } return scanTarget.get(); diff --git a/OSBindings/Qt/scantargetwidget.h b/OSBindings/Qt/scantargetwidget.h index 36b328101..e8b569df0 100644 --- a/OSBindings/Qt/scantargetwidget.h +++ b/OSBindings/Qt/scantargetwidget.h @@ -24,6 +24,7 @@ class ScanTargetWidget : public QOpenGLWidget // can't be done at creation time. std::unique_ptr scanTarget; Time::VSyncPredictor vsyncPredictor; + bool isConnected = false; private slots: void vsync();