Document that wxGLCanvas now uses physical pixels

Instruct people to use GetContentScaleFactor() to convert between
logical coordinates used by wxWindow and physical ones used by
wxGLCanvas.

See https://github.com/wxWidgets/wxWidgets/pull/1485
This commit is contained in:
Vadim Zeitlin
2019-10-08 02:18:32 +02:00
parent f5d02e6808
commit 9102da27ec
2 changed files with 14 additions and 0 deletions

View File

@@ -748,6 +748,15 @@ enum
context to the canvas, and then finally call SwapBuffers() to swap the
buffers of the OpenGL canvas and thus show your current output.
Please note that wxGLContext always uses physical pixels, even on the
platforms where wxWindow uses logical pixels, affected by the coordinate
scaling, on high DPI displays. Thus, if you want to set the OpenGL view
port to the size of entire window, you must multiply the result returned by
wxWindow::GetClientSize() by wxWindow::GetContentScaleFactor() before
passing it to @c glViewport(). Same considerations apply to other OpenGL
functions and other coordinates, notably those retrieved from wxMouseEvent
in the event handlers.
Notice that versions of wxWidgets previous to 2.9 used to implicitly create a
wxGLContext inside wxGLCanvas itself. This is still supported in the
current version but is deprecated now and will be removed in the future,