2
我与GLSL着色器的实验,但我得到一个有趣的错误,当我尝试从纹理获取数据来尝试一个简单的对比度增强算法。GLSL“的Texture2D”:没有匹配的重载函数发现的OpenGL ES2在iPhone
'texture2D' : no matching overloaded function found
它发生在这个代码里,“final”是vec4变量来保存正在处理的颜色。这里的想法是将像素的颜色从周围推进(实验性的想法)。我会在有错误的代码中标记该行。
highp vec4 tex = texture2D(tex,vec2(texcoord.x+1.0,texcoord.y));
highp float total = tex.r + tex.g + tex.b;
tex = texture2D(tex,vec2(texcoord.x-1.0,texcoord.y)); <----This one as well as the next similar lines
total += tex.r + tex.g + tex.b;
tex = texture2D(tex,vec2(texcoord.x,texcoord.y+1.0));
total += tex.r + tex.g + tex.b;
tex = texture2D(tex,vec2(texcoord.x,texcoord.y-1.0));
total += tex.r + tex.g + tex.b;
highp float di = 12.0;
highp vec4 close_av = total/di;
final = (final - close_av)*1.3+close_av;
为什么不行呢?谢谢。
谢谢。下次累的时候我不会问问题。清醒时很容易发现这些错误。 :) – 2011-01-29 16:14:27