如何在没有GPUImageFilterGroup的情况下使用GPUImageLookupFilter? [英] How to use GPUImageLookupFilter without GPUImageFilterGroup?

查看:1045
本文介绍了如何在没有GPUImageFilterGroup的情况下使用GPUImageLookupFilter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对理解GPUImage有疑问。
具体来说,我无法弄清楚如何使用GPUImageLookupFilter。我在GPUImageAmatorkaFilter中有几个用法示例。
但是在GPUImageFilterGroup中使用的LookupFilter我还没有理解。
我想知道我是否可以单独使用LookupFilter。

I have a problem with understanding GPUImage. Specifically, I can't figure out how to use GPUImageLookupFilter. I have several examples of usage in GPUImageAmatorkaFilter for example. But LookupFilter used there within GPUImageFilterGroup which I didn't understood yet either. I wonder whether I can use LookupFilter alone.

我试过这个:

GPUImageLookupFilter *lookup = [[GPUImageLookupFilter alloc] init];

UIImage *image = [UIImage imageNamed:@"amatorka.png"];
GPUImagePicture *lookupImageSource = [[GPUImagePicture alloc] initWithImage:image];    
[lookupImageSource addTarget: lookup atTextureLocation: 1];
[lookupImageSource processImage];

GPUImagePicture *inputImg = [[GPUImagePicture alloc] initWithImage:inputImage];
[inputImg addTarget:lookup atTextureLocation: 1];
[inputImg processImage];

UIImage *quickFilteredImage = [lookup imageFromCurrentlyProcessedOutput];

但它不起作用,它崩溃如下:

But it doesn't work, it crashes like this:

Assertion failure in -[GPUImageLookupFilter createFilterFBOofSize:], PathToSource/GPUImageFilter.m:369
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Incomplete filter FBO: 36054'

我绝对需要初始化其他东西,但.......
那么,任何人都可以帮我制作这一小段代码吗?
提前致谢。

I definitely need to initialize something else, but ... . So, can anyone help me to make this small piece of code work? Thanks in advance.

推荐答案

感谢Brad Larson回答:

Thanks to Brad Larson for answering:


首先,您将两个图像添加到纹理位置1,因此一个覆盖另一个。您需要将输入图像添加到纹理位置0并将模式添加到位置1,我相信。

For one thing, you're adding both of your images to texture location 1, so one is overriding the other. You need to add your input image to texture location 0 and lookup pattern to location 1, I believe.

这篇关于如何在没有GPUImageFilterGroup的情况下使用GPUImageLookupFilter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆