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

@@ -565,8 +565,9 @@ void MyGLCanvas::OnSize(wxSizeEvent& event)
SetCurrent(*m_oglContext);
// It's up to the application code to update the OpenGL viewport settings.
m_winHeight = event.GetSize().y;
m_oglManager->SetViewport(0, 0, event.GetSize().x, m_winHeight);
const wxSize size = event.GetSize() * GetContentScaleFactor();
m_winHeight = size.y;
m_oglManager->SetViewport(0, 0, size.x, m_winHeight);
// Generate paint event without erasing the background.
Refresh(false);