Fix OpenGL display scaling on high DPI (#1011)

* Fix OpenGL display scaling on high DPI

* Scale the OSD too

* Fix indent
This commit is contained in:
Nadia Holmquist Pedersen
2021-02-22 18:17:48 +01:00
committed by GitHub
parent 532dc57025
commit 97643586fa
4 changed files with 11 additions and 5 deletions

View File

@ -59,6 +59,7 @@ std::deque<Item> ItemQueue;
QOpenGLShaderProgram* Shader;
GLint uScreenSize, uOSDPos, uOSDSize;
GLfloat uScaleFactor;
GLuint OSDVertexArray;
GLuint OSDVertexBuffer;
@ -86,6 +87,7 @@ bool Init(QOpenGLFunctions_3_2_Core* f)
uScreenSize = Shader->uniformLocation("uScreenSize");
uOSDPos = Shader->uniformLocation("uOSDPos");
uOSDSize = Shader->uniformLocation("uOSDSize");
uScaleFactor = Shader->uniformLocation("uScaleFactor");
float vertices[6*2] =
{
@ -430,6 +432,7 @@ void DrawGL(QOpenGLFunctions_3_2_Core* f, float w, float h)
Shader->bind();
f->glUniform2f(uScreenSize, w, h);
f->glUniform1f(uScaleFactor, mainWindow->devicePixelRatioF());
f->glBindBuffer(GL_ARRAY_BUFFER, OSDVertexBuffer);
f->glBindVertexArray(OSDVertexArray);