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