断言失败 - [GPUImageFilter initWithVertexShaderFromString:]

时间:2015-04-27 11:06:51

标签: ios objective-c iphone gpuimage

如下所示出现错误

  

***断言失败 - [GPUImageFilter initWithVertexShaderFromString:fragmentShaderFromString:],   /Users/XYZ/Downloads/GPUImage-master/framework/Source/GPUImageFilter.m:94

在设置框架路径之后,我已经在https://github.com/BradLarson/GPUImage中按照提及进行了设置,并且所有其他内容都编写了以下代码以进行测试但是出现了错误。

GPUImageVideoCamera *videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;

GPUImageFilter *customFilter = [[GPUImageFilter alloc] initWithFragmentShaderFromFile:@"CustomShader"];
GPUImageView *filteredVideoView = [[GPUImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, viewWidth, viewHeight)];

// Add the view somewhere so it's visible

[videoCamera addTarget:customFilter];
[customFilter addTarget:filteredVideoView];

[videoCamera startCameraCapture];

请帮我解决这个问题......

1 个答案:

答案 0 :(得分:0)

NSAssert(NO, @"Filter shader link failed");

您的链接“CustomShader”错误。你的项目中有CustomShader.fsh吗?