Do you know of any resources for learning how to set up a Metal-backed drawing context on macOS/Cocoa? All I see are iOS or use MetalKit.
You want to be layer-backed. It's sufficient to override makeBackingLayer in your NSView subclass to return an instance of CAMetalLayer.
-
-
Is this in addition to the override of layerClass, and the metalLayer getter? I've tried various combinations, but drawRect no longer called
-
Apologies for my severely out-of-practice ObjC, but here's what I've got, which doesn't seem to work:https://gist.github.com/mebmichael/4ddfa78f89a7c27fe71808712c24cf17 …
-
Though now that I look at it, it doesn't run in your sample code either, so I suppose I'll try moving forward w/ the tutorials :) Thanks!
-
(drawRect, that is. I thought it wasn't working because it wasn't being called. Sorry for so many messages!)
-
No problem. This wound up being a bit more involved than I recall, and I learned a few things! Here's a sample: https://gist.github.com/warrenm/6a6f9f3419fce1f9b43015344f56401b …
-
Oh my gosh, you're awesome! Thanks so much!!
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.