[fixed]MacOS 10.15 only rendering to quarter of window

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
bridgeco
Posts: 13
Joined: Fri Mar 19, 2004 8:19 pm
Location: London
Contact:

[fixed]MacOS 10.15 only rendering to quarter of window

Post by bridgeco »

Following the release of MacOS Catalina, I had a problem where the Irrlicht was only rendering to the lower left quarter of the window. The same problem appeared at the same time for a number of other 3d engines (see https://github.com/panda3d/panda3d/issues/794 which also links to the same problem in SDL and Godot).

The problem is related to the scaling applied on 'HiDPI' screens. Prior to Catalina (10.15), MacOS by applied scaling by default to OpenGL applications so applications did not need to be HiDPI aware, but this default changed in 10.15.

To avoid the problem, you need to set setWantsBestResolutionOpenGLSurface:NO for the OpenGL context.

Following the approach taken in the other engines, in CIrrDeviceOSX.mm, the fix is to change the lines

Code: Select all

 
                if (Window)
                    [(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context setView:[Window contentView]];
                else
                    [(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context setView:(NSView*)CreationParams.WindowId];
 
to

Code: Select all

 
                if (Window) {
                    [[Window contentView] setWantsBestResolutionOpenGLSurface:NO];
                    [(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context setView:[Window contentView]];
                } else {
                    [(NSView*)CreationParams.WindowId setWantsBestResolutionOpenGLSurface:NO];
                    [(NSOpenGLContext*)ContextManager->getContext().OpenGLOSX.Context setView:(NSView*)CreationParams.WindowId];
                }
 
Theoretically, it might be better to re-code everything that handles dimensions to be HiDPI aware, but that's certainly not something I know enough to do!
-------------------------------------
Bridge Command

a 3d ship simulator for navigation training
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: [fixed]MacOS 10.15 only rendering to quarter of window

Post by CuteAlien »

Yeah, also not going to re-code. But applied this to svn trunk [r6132], thanks!
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply