Post

Replies

Boosts

Views

Activity

Reply to Rendering WKWebView Into a MTLTexture
For your idea 1, I was struggling quite a bit but eventually got it working. I had to use a local MTLTexture to verify it's working. Here is the snippet: wbView.takeSnapshot(with: configuration, completionHandler: { (snapshotImage: UIImage?, error: Error?) in if error != nil { return } guard let snapshotImage = snapshotImage else { return } guard let cgImage = snapshotImage.cgImage else { return } let device = myRenderer.getDevice() let textureLoader = MTKTextureLoader(device: device) guard let texture = try? textureLoader.newTexture(cgImage: cgImage) else { return } // Do something with `texture`... })
Feb ’24