Closed mnfro closed 4 years ago
@mnfro Hi.
In camera(_ camera: BBMetalCamera, didOutput texture: MTLTexture)
function, if we use the old filter in the filter chain (from camera to metal view), the camera or metal view freezes. Because filteredImage(with:)
function adds more image source to the old filter, changing the old filter chain. We should create a new filter in camera(_ camera: BBMetalCamera, didOutput texture: MTLTexture)
func camera(_ camera: BBMetalCamera, didOutput texture: MTLTexture) {
let newFilter = ... // base on the collection view selection; same filter class as `currentFilter ` in the filter chain
let filteredImage = newFilter.filteredImage(with: texture.bb_image!) ?? texture.bb_image!
...
}
@Silence-GitHub thank you! Now everything works quite good. I'll close the issue.
Hi, I've encountered issues while using your framework. I'm pretty sure I'm missing something.
Let's say that I have several LUT filters which can be selected by the user. I init both the metalView and the metalCamera in
viewDidLoad()
:as written above, initially no filter is applied.
Now the user selects a filter from a "menu view" (which actually it is a collectionView):
Until now everything works pretty good, the LUT filter is finely rendered in the metalView. Notice that currentFilter is a variable that holds the current filter that has been selected by the user.
Next step is to take a photo and save it in the Photo Library:
aaand now something breaks. Indeed, while the photo is filtered correctly and saved with the LUT filter applied, the metalCamera/metalView freezes showing the last photo captured. The only thing to get things start working again is to select another filter from the collectionView.
So, I'm supposing that I'm doing something wrong, maybe I'm adding / removing consumers in a very bad way. May I ask you some help? :)