BradLarson / GPUImage3

GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal.
BSD 3-Clause "New" or "Revised" License
2.68k stars 334 forks source link

How to initialize renderView by code? #16

Closed YuStephen closed 5 years ago

YuStephen commented 5 years ago

Hi BradLarson, i am trying to init a renderView by code like let device = MTLCreateSystemDefaultDevice() renderView = RenderView.init(frame: self.view.bounds, device: device)but it doesn't work, doesn't show the camera. Can u help me? THX

BradLarson commented 5 years ago

Ah, I think we forgot something there. The RenderView should be using the sharedMetalRenderingDevice.device Metal device, but it allows you to override that. For now, I've committed a change that will override any input device, so you should be able to provide nil for a device and not worry about it.

Otherwise, you can use sharedMetalRenderingDevice.device for that parameter to make sure it uses the same device as the rest of the framework.