Friday, 15 March 2013

ios - GPUImage two-pass filter - second frag shader never runs? -



ios - GPUImage two-pass filter - second frag shader never runs? -

it's impression (and reply this question seems confirm it) can subclass gpuimagetwopassfilter run 2 fragment shaders in succession on image maintain code , such confined single class. however, in experimentation, doesn't appear sec fragment shader ever compiled, much less executed; illustration below builds , runs without complaint. resulting image looks same if first fragment shader run in single-shader class.

what going wrong here? doesn't help examples can find in gpuimage code base of operations subclass gpuimagetwopassfilter using same fragment shader programme each pass (as in gpuimagegaussianblurfilter).

#import "bftwopasstest.h" nsstring *const kbftwopasstestfirstfragmentshaderstring = shader_string ( varying highp vec2 texturecoordinate; uniform sampler2d inputimagetexture; void main() { lowp vec4 texturecolor = texture2d(inputimagetexture, texturecoordinate); gl_fragcolor = vec4(1.0, texturecolor.g, texturecolor.b, 1.0); } ); nsstring *const kbftwopasstestsecondfragmentshaderstring = shader_string ( varying highp vec2 texturecoordinate; uniform sampler2d inputimagetexture; void main() { should obvious syntax error. } ); @implementation bftwopasstest - (id)init { self = [self initwithfirststagefragmentshaderfromstring:kbftwopasstestfirstfragmentshaderstring secondstagefragmentshaderfromstring:kbftwopasstestsecondfragmentshaderstring]; if (self) { } homecoming self; } @end

oops, there bug on line 55 of gpuimagetwopassfilter.m. next line:

if (!(self = [self initwithfirststagevertexshaderfromstring:kgpuimagevertexshaderstring firststagefragmentshaderfromstring:firststagefragmentshaderstring secondstagevertexshaderfromstring:kgpuimagevertexshaderstring secondstagefragmentshaderfromstring:firststagefragmentshaderstring]))

should have been

if (!(self = [self initwithfirststagevertexshaderfromstring:kgpuimagevertexshaderstring firststagefragmentshaderfromstring:firststagefragmentshaderstring secondstagevertexshaderfromstring:kgpuimagevertexshaderstring secondstagefragmentshaderfromstring:secondstagefragmentshaderstring]))

thanks pointing out, should fixed in repository now. however, in future may suggest posting specific framework issues github issues page project instead of here?

ios opengl-es glsl gpuimage

No comments:

Post a Comment