我想用
filter.arrayValue = array[80];
在我的.swift控制器中将数组[80]输入到GPUImage过滤器。
有人能举例说明如何实现这个目标吗?
以下是如何将CGFloat传递给(texelWidth in)GPUImage过滤器。
in .h
CGFloat texelWidthUniform;
@property(nonatomic, readwrite) CGFloat leftEyeParameter;
in .m
@synthesize texelWidth = _texelWidth;
- (id)initWithFragmentShaderFromString:(NSString *)fragmentShaderString;
{
.....
texelWidthUniform = [filterProgram uniformIndex:@"texelWidth"];
....
return self;
}
- (void)setTexelWidth:(CGFloat)newValue;
{
hasOverriddenImageSizeFactor = YES;
_texelWidth = newValue;
[self setFloat:_texelWidth forUniform:texelWidthUniform program:filterProgram];
}