Fix HiDPI on macOS (and possibly others?)

This commit is contained in:
Pwootage 2019-06-03 21:40:20 -06:00
parent b4df45aecc
commit 694c0b0765
No known key found for this signature in database
GPG Key ID: D19D0257D6F9C064
1 changed files with 4 additions and 2 deletions

View File

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