Fix OpenGL samples when using HiDPI displays

OpenGL seems to operate using physical pixels, so we need to factor in the
scale factor when setting the GL viewport.

Closes #17391.

Closes https://github.com/wxWidgets/wxWidgets/pull/1470
This commit is contained in:
Scott Talbert
2019-08-06 23:42:41 -04:00
committed by Vadim Zeitlin
parent 0ff713c945
commit b134589cbb
4 changed files with 9 additions and 8 deletions

View File

@@ -280,7 +280,8 @@ void TestGLCanvas::OnSize(wxSizeEvent& event)
// This is OK here only because there is only one canvas that uses the
// context. See the cube sample for that case that multiple canvases are
// made current with one context.
glViewport(0, 0, event.GetSize().x, event.GetSize().y);
const wxSize size = event.GetSize() * GetContentScaleFactor();
glViewport(0, 0, size.x, size.y);
}
void TestGLCanvas::OnChar(wxKeyEvent& event)