OpenGL not rendering on macOS Mojave

I disassembled Apple's frameworks and found out that they have changed how OpenGL rendering works on Mojave. It seems that even if you disable layered backing by setting NSView's wantsLayer to NO, NSView still creates and attaches a layer to your view on Mojave. Resizing the window before rendering to it works because that usually results in a call to [NSOpenGLContext update]. Calling the update twice works, because in the first frame NSView has no layer attached to it and the update method does nothing but on the second frame, the layer is there and [NSOpenGLContext update] actually initializes the framebuffer.

So the solution is to call the [NSOpenGLContext update] manually whenever the layer of the NSView is set, like this:

@interface OpenGLView: ViewMacOS
{
    NSOpenGLContext* _openGLContext;
}
@end

@implementation OpenGLView

-(void)setLayer:(CALayer*)layer
{
    [super setLayer:layer];

    [_openGLContext update];
}

@end

I tested it and it works both on Mojave and on older versions of macOS ([NSView setLayer:] is not being called on macOS 10.13 and older versions). Here is the complete commit I made for the Ouzel engine: https://github.com/elnormous/ouzel/commit/7e708636189d970bad6b013ecd5375cfe693f3f3