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:
committed by
Vadim Zeitlin
parent
0ff713c945
commit
b134589cbb
@@ -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);
|
||||
|
Reference in New Issue
Block a user