qt: create opengl context on hardware renderer
Prevent OpenGLES renderer crashing on windows
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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()
|
||||
{
|
||||
|
Reference in New Issue
Block a user