qt: create opengl context on hardware renderer

Prevent OpenGLES renderer crashing on windows
This commit is contained in:
ts-korhonen
2021-12-23 20:31:51 +02:00
parent 4002149d4d
commit b3876ee934
2 changed files with 6 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ void HardwareRenderer::resizeGL(int w, int h)
void HardwareRenderer::initializeGL()
{
m_context->makeCurrent(this);
initializeOpenGLFunctions();
}
@@ -44,6 +45,7 @@ void HardwareRenderer::onBlit(const std::unique_ptr<uint8_t>* img, int x, int y,
void HardwareRenderer::resizeEvent(QResizeEvent *event) {
onResize(width(), height());
QOpenGLWindow::resizeEvent(event);
}

View File

@@ -24,6 +24,7 @@ class HardwareRenderer : public QOpenGLWindow, protected QOpenGLFunctions, publi
private:
bool wayland = false;
QWidget* parentWidget{nullptr};
QOpenGLContext* m_context;
public:
void resizeGL(int w, int h) override;
void initializeGL() override;
@@ -34,6 +35,9 @@ public:
setMinimumSize(QSize(16, 16));
setFlags(Qt::FramelessWindowHint);
parentWidget = parent;
m_context = new QOpenGLContext();
m_context->create();
}
~HardwareRenderer()
{