Mac Retian and OpenGL

17 views
Skip to first unread message

Zhipeng Shi

unread,
12:06 AM (18 hours ago) 12:06 AM
to wx-users
Hi,
    I'm using wxGLCanvas to render OpenGL on a Retina display of a Mac. During rendering, I have to use glViewport(0, 0, GetContentScaleFactor() * width, GetContentScaleFactor() * height) to achieve full-screen rendering, instead of rendering only in the bottom-left quarter of the area.
    However, when I want to use pick to select a certain rendering unit, wxGetMousePosition() returns physical coordinates. If I multiply all physical coordinates by GetContentScaleFactor(), the coordinates are incorrect again in some PopupMenu() scenarios. Is there a relatively simple way in wxWidgets to handle all of this? 
    My Mac version is 26.2, and the wxWidgets version is 3.2.9.
    Thank you very much!

Best Regards
Shi

Vadim Zeitlin

unread,
10:27 AM (7 hours ago) 10:27 AM
to wx-u...@googlegroups.com
On Sun, 11 Jan 2026 21:06:00 -0800 (PST) Zhipeng Shi wrote:

ZS> I'm using wxGLCanvas to render OpenGL on a Retina display of a Mac.
ZS> During rendering, I have to use glViewport(0, 0, GetContentScaleFactor() *
ZS> width, GetContentScaleFactor() * height) to achieve full-screen rendering,
ZS> instead of rendering only in the bottom-left quarter of the area.

This is correct, glViewport() requires physical pixels, while wxWidgets
API works (with some exceptions) with logical pixels.

ZS> However, when I want to use pick to select a certain rendering unit,
ZS> wxGetMousePosition() returns physical coordinates.

This looks like a bug, it should return logical coordinates.

ZS> My Mac version is 26.2, and the wxWidgets version is 3.2.9.

Please check if wxGetMousePosition() works correctly with 3.3.1. If it
does, we may need to backport some fix from 3.3 into 3.2. And if it
doesn't, we still need to fix this.

Thanks,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/
Reply all
Reply to author
Forward
0 new messages