mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-23 20:29:42 +00:00
Decouples scan target drawing and lifetime.
This commit is contained in:
parent
b052ca5ca2
commit
e297d4cced
@ -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<Outputs::Display::OpenGL::ScanTarget>(defaultFramebufferObject());
|
||||
}
|
||||
return scanTarget.get();
|
||||
|
@ -24,6 +24,7 @@ class ScanTargetWidget : public QOpenGLWidget
|
||||
// can't be done at creation time.
|
||||
std::unique_ptr<Outputs::Display::OpenGL::ScanTarget> scanTarget;
|
||||
Time::VSyncPredictor vsyncPredictor;
|
||||
bool isConnected = false;
|
||||
|
||||
private slots:
|
||||
void vsync();
|
||||
|
Loading…
Reference in New Issue
Block a user