mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Adds redraw logic.
If you sit around and constantly reeize the window, you can now see that a machine is running.
This commit is contained in:
parent
fdc234ed3b
commit
a681576d6c
@ -1,15 +1,23 @@
|
||||
#include "scantargetwidget.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QOpenGLContext>
|
||||
|
||||
ScanTargetWidget::ScanTargetWidget(QWidget *parent) : QOpenGLWidget(parent) {}
|
||||
ScanTargetWidget::~ScanTargetWidget() {}
|
||||
|
||||
void ScanTargetWidget::initializeGL() {
|
||||
scanTarget = std::make_unique<Outputs::Display::OpenGL::ScanTarget>(defaultFramebufferObject());
|
||||
glClearColor(0.5, 0.5, 1.0, 1.0);
|
||||
|
||||
qDebug() << "share context: " << bool(context()->shareGroup());
|
||||
}
|
||||
|
||||
void ScanTargetWidget::paintGL() {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
if(scanTarget) {
|
||||
scanTarget->update(width(), height());
|
||||
scanTarget->draw(width(), height());
|
||||
}
|
||||
}
|
||||
|
||||
void ScanTargetWidget::resizeGL(int w, int h) {
|
||||
@ -17,5 +25,9 @@ void ScanTargetWidget::resizeGL(int w, int h) {
|
||||
}
|
||||
|
||||
Outputs::Display::OpenGL::ScanTarget *ScanTargetWidget::getScanTarget() {
|
||||
makeCurrent();
|
||||
if(!scanTarget) {
|
||||
scanTarget = std::make_unique<Outputs::Display::OpenGL::ScanTarget>(defaultFramebufferObject());
|
||||
}
|
||||
return scanTarget.get();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user