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()
|
void HardwareRenderer::initializeGL()
|
||||||
{
|
{
|
||||||
|
m_context->makeCurrent(this);
|
||||||
initializeOpenGLFunctions();
|
initializeOpenGLFunctions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@ void HardwareRenderer::onBlit(const std::unique_ptr<uint8_t>* img, int x, int y,
|
|||||||
|
|
||||||
void HardwareRenderer::resizeEvent(QResizeEvent *event) {
|
void HardwareRenderer::resizeEvent(QResizeEvent *event) {
|
||||||
onResize(width(), height());
|
onResize(width(), height());
|
||||||
|
|
||||||
QOpenGLWindow::resizeEvent(event);
|
QOpenGLWindow::resizeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ class HardwareRenderer : public QOpenGLWindow, protected QOpenGLFunctions, publi
|
|||||||
private:
|
private:
|
||||||
bool wayland = false;
|
bool wayland = false;
|
||||||
QWidget* parentWidget{nullptr};
|
QWidget* parentWidget{nullptr};
|
||||||
|
QOpenGLContext* m_context;
|
||||||
public:
|
public:
|
||||||
void resizeGL(int w, int h) override;
|
void resizeGL(int w, int h) override;
|
||||||
void initializeGL() override;
|
void initializeGL() override;
|
||||||
@@ -34,6 +35,9 @@ public:
|
|||||||
setMinimumSize(QSize(16, 16));
|
setMinimumSize(QSize(16, 16));
|
||||||
setFlags(Qt::FramelessWindowHint);
|
setFlags(Qt::FramelessWindowHint);
|
||||||
parentWidget = parent;
|
parentWidget = parent;
|
||||||
|
|
||||||
|
m_context = new QOpenGLContext();
|
||||||
|
m_context->create();
|
||||||
}
|
}
|
||||||
~HardwareRenderer()
|
~HardwareRenderer()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user