Search code examples
iosobjective-ciphonegpuimage

Assertion failure in -[GPUImageFilter initWithVertexShaderFromString:]


Got error as follow

*** Assertion failure in -[GPUImageFilter initWithVertexShaderFromString:fragmentShaderFromString:], /Users/XYZ/Downloads/GPUImage-master/framework/Source/GPUImageFilter.m:94

I have already set as per mention in https://github.com/BradLarson/GPUImage after setting framework path and all other thing wrote following code for testing but getting above error.

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];

please help me to solve this...


Solution

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

    your link "CustomShader" is wrong. Do you have CustomShader.fsh in your project?