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:
@@ -78,6 +78,11 @@ Changes in behaviour not resulting in compilation errors
|
||||
previous behaviour in wxMSW, when these events were always generated in this
|
||||
case. Please add wxTE_PROCESS_ENTER style if you relied on the old behaviour.
|
||||
|
||||
- wxGLCanvas now uses physical pixels on high DPI displays under platforms
|
||||
where they're different from logical ones (wxGTK3, wxOSX). Multiply logical
|
||||
coordinates, e.g. returned by wxWindow::GetSize() by GetContentScaleFactor()
|
||||
before using them with OpenGL functions.
|
||||
|
||||
|
||||
Changes in behaviour which may result in build errors
|
||||
-----------------------------------------------------
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user