Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MTKView delegate stops responding to - (void)drawInMTKView:(nonnull MTKView *)view calls

I have an MTKView in a window managed by a window controller. When I first instantiate the window controller and window, the MTKView calls my delegate's two calls and drawInMTKView is called at the preferred rate:

- (void)drawInMTKView:(nonnull MTKView *)view
- (void)mtkView:(nonnull MTKView *)view drawableSizeWillChange:(CGSize)size

If close the window (not release the window just hide), when I re-open the window, the drawableSizeWillChange call is still invoked when I resize the MTKView, but the drawInMTKView is no longer called. The MTKView runs in its default mode with its own displaylink. As drawInMTKView is not called, it leaves be to believe that there is something wrong with the private displayLink variable in the MTKView.

I'm running Xcode 9.4.1 on OSX Mojave, recent 2017 MacBook Pro

like image 635
blackirishman Avatar asked Mar 18 '26 23:03

blackirishman


1 Answers

I created my own CVDisplayLink callback and didn't use the one provided by MTKView to get around the possible issue with MTKView.

like image 66
blackirishman Avatar answered Mar 20 '26 13:03

blackirishman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!