Add GetOpenGLScaleFactor() to abstract OpenGL coordinates scaling
The fix for OpenGL coordinates when using high DPI in b134589cbb
(Fix
OpenGL samples when using HiDPI displays, 2019-08-06) did fix it for GTK
3 and macOS, but broke it for MSW and other platforms not using pixel
scaling, as window coordinates are the same as OpenGL ones there, while
GetContentScaleFactor() can still return values > 1 even on these
platforms.
Provide new GetOpenGLScaleFactor() function abstracting this platform
difference and use it in all OpenGL samples to make them work correctly
in high DPI under all platforms.
Closes https://github.com/wxWidgets/wxWidgets/pull/1944
Closes #17391.
This commit is contained in:
@@ -306,7 +306,7 @@ void TestGLCanvas::ResetProjectionMode()
|
||||
// or more than one wxGLContext in the application.
|
||||
SetCurrent(*m_glRC);
|
||||
|
||||
const wxSize ClientSize = GetClientSize() * GetContentScaleFactor();
|
||||
const wxSize ClientSize = GetClientSize() * GetOpenGLScaleFactor();
|
||||
|
||||
// It's up to the application code to update the OpenGL viewport settings.
|
||||
// In order to avoid extensive context switching, consider doing this in
|
||||
|
Reference in New Issue
Block a user