* Fix rare crash when switching renderers

* Abandon QPainter in hardware renderers in favour of OpenGL
* Disable VSync in the application globally
This commit is contained in:
Cacodemon345
2021-12-25 15:34:00 +06:00
parent 9291f23461
commit 07af487acb
5 changed files with 31 additions and 3 deletions

View File

@@ -3,6 +3,10 @@
#include <QOpenGLFunctions>
#include <QOpenGLWidget>
#include <QOpenGLWindow>
#include <QOpenGLTexture>
#include <QOpenGLShader>
#include <QOpenGLShaderProgram>
#include <QOpenGLTextureBlitter>
#include <QPainter>
#include <QEvent>
#include <QKeyEvent>
@@ -25,6 +29,9 @@ private:
bool wayland = false;
QWidget* parentWidget{nullptr};
QOpenGLContext* m_context;
QOpenGLTexture* m_texture;
QOpenGLShaderProgram* m_prog;
QOpenGLTextureBlitter* m_blt;
public:
void resizeGL(int w, int h) override;
void initializeGL() override;
@@ -41,7 +48,8 @@ public:
}
~HardwareRenderer()
{
makeCurrent();
m_context->makeCurrent(this);
if (m_blt) m_blt->destroy();
}
enum class RenderType {