Merge pull request #3 from Pwootage/cmake

Fix HiDPI on macOS (and possibly others?)
This commit is contained in:
Jack Andersen 2019-06-03 17:52:32 -10:00 committed by GitHub
commit 92723598fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -49,7 +49,8 @@ void CBasicViewport::initializeGL()
void CBasicViewport::paintGL() void CBasicViewport::paintGL()
{ {
// Prep render // Prep render
glViewport(0, 0, width(), height()); float scale = devicePixelRatioF();
glViewport(0, 0, (int)((float)width() * scale), (int)((float)height() * scale));
glLineWidth(1.f); glLineWidth(1.f);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
mViewInfo.ViewFrustum = mCamera.FrustumPlanes(); mViewInfo.ViewFrustum = mCamera.FrustumPlanes();
@ -67,7 +68,8 @@ void CBasicViewport::paintGL()
void CBasicViewport::resizeGL(int Width, int Height) void CBasicViewport::resizeGL(int Width, int Height)
{ {
mCamera.SetAspectRatio((float) Width / Height); mCamera.SetAspectRatio((float) Width / Height);
glViewport(0, 0, Width, Height); float scale = devicePixelRatioF();
glViewport(0, 0, (int)((float)Width * scale), (int)((float)Height * scale));
OnResize(); OnResize();
} }