Mac Retian and OpenGL

42 views
Skip to first unread message

Zhipeng Shi

unread,
Jan 12, 2026, 12:06:01 AMJan 12
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,
Jan 12, 2026, 10:27:30 AMJan 12
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/

Zhipeng Shi

unread,
Jan 14, 2026, 11:49:47 PMJan 14
to wx-users
Dear VZ,

    I am building my projects with wxWidget3.3.1. But It built with some errors.  I think this is caused by the differences between the APIs of wxWidgets 3.3.1 and wxWidgets 3.2.9. I'm currently fixing this issue and will let you know the result later.
    Thank you very much!

Best Regards
Shi

Reply all
Reply to author
Forward
0 new messages