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.
-
-
I'm using Objective-C++ so I can get practice w/ C++, since I use Swift at work. I think Swift examples would be easy enough to follow. (?)
-
Obj-C also makes it easier to follow along in your book. I tried already in Swift, but it was a little tricky... and then I got busy.
-
So far I've found some documentation about layer hosting, which sounds like it might be a key step I'm missing https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreAnimation_guide/SettingUpLayerObjects/SettingUpLayerObjects.html …
-
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!)
- 2 more replies
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.