An open source iOS framework for GPU-based image and video processing
BSD 3-Clause "New" or "Revised" License
20.24k
stars
4.61k
forks
source link
GPUImageTwoInputFilter Shows Black Screen in realtime camera #2339
Closed
masterraj91 closed 8 years ago
import "GPUImageTwoInputFilter.h"
@interface GPUImageIFilter : GPUImageTwoInputFilter{
}
@end
// // GPUImageIFilter.m
import "GPUImageIFilter.h"
if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
NSString *const kGPUImageIFragmentShaderString = SHADER_STRING ( precision lowp float;
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture; uniform sampler2D inputImageTexture2;
void main() { vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb; texel = vec3(dot(vec3(0.3, 0.6, 0.1), texel)); texel = vec3(texture2D(inputImageTexture2, vec2(texel.r, .16666)).r); gl_FragColor = vec4(texel, 1.0); } );
else
NSString *const kGPUImageIFragmentShaderString = SHADER_STRING ( varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture; uniform sampler2D inputImageTexture2;
void main() { vec3 texel = texture2D(inputImageTexture, textureCoordinate).rgb; texel = vec3(dot(vec3(0.3, 0.6, 0.1), texel)); texel = vec3(texture2D(inputImageTexture2, vec2(texel.r, .16666)).r); gl_FragColor = vec4(texel, 1.0); } );
endif
@implementation GPUImageIFilter
(id)init; { if (!(self = [super initWithFragmentShaderFromString:kGPUImageIFragmentShaderString])) { return nil; }
return self; }
@end