mirror of
https://github.com/TomHarte/CLK.git
synced 2025-07-23 16:24:17 +00:00
Decouples scan target drawing and lifetime.
This commit is contained in:
@@ -20,7 +20,7 @@ void ScanTargetWidget::initializeGL() {
|
|||||||
|
|
||||||
void ScanTargetWidget::paintGL() {
|
void ScanTargetWidget::paintGL() {
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
if(scanTarget) {
|
if(isConnected) {
|
||||||
vsyncPredictor.begin_redraw();
|
vsyncPredictor.begin_redraw();
|
||||||
scanTarget->update(width(), height());
|
scanTarget->update(width(), height());
|
||||||
scanTarget->draw(width(), height());
|
scanTarget->draw(width(), height());
|
||||||
@@ -47,6 +47,7 @@ void ScanTargetWidget::resizeGL(int w, int h) {
|
|||||||
Outputs::Display::OpenGL::ScanTarget *ScanTargetWidget::getScanTarget() {
|
Outputs::Display::OpenGL::ScanTarget *ScanTargetWidget::getScanTarget() {
|
||||||
makeCurrent();
|
makeCurrent();
|
||||||
if(!scanTarget) {
|
if(!scanTarget) {
|
||||||
|
isConnected = true;
|
||||||
scanTarget = std::make_unique<Outputs::Display::OpenGL::ScanTarget>(defaultFramebufferObject());
|
scanTarget = std::make_unique<Outputs::Display::OpenGL::ScanTarget>(defaultFramebufferObject());
|
||||||
}
|
}
|
||||||
return scanTarget.get();
|
return scanTarget.get();
|
||||||
|
@@ -24,6 +24,7 @@ class ScanTargetWidget : public QOpenGLWidget
|
|||||||
// can't be done at creation time.
|
// can't be done at creation time.
|
||||||
std::unique_ptr<Outputs::Display::OpenGL::ScanTarget> scanTarget;
|
std::unique_ptr<Outputs::Display::OpenGL::ScanTarget> scanTarget;
|
||||||
Time::VSyncPredictor vsyncPredictor;
|
Time::VSyncPredictor vsyncPredictor;
|
||||||
|
bool isConnected = false;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void vsync();
|
void vsync();
|
||||||
|
Reference in New Issue
Block a user