'texture2D' : No matching overloaded function found OpenGL ES2 Android (JAVA) -
i working on project, , project had walk through book called "opengl es 2 android: quick start guide". when got texturing, got error of:
'texture2d' : no matching overloaded function found when compile shader. shader code:
// fragment shader precision mediump float; uniform sampler2d u_textureunit; varying vec4 v_texturecoordinates; void main() { gl_fragcolor = texture2d(u_textureunit, v_texturecoordinates); } // vertex shader uniform mat4 u_matrix; attribute vec4 a_position; attribute vec4 a_texturecoordinates; varying vec4 v_texturecoordinates; void main() { gl_position = u_matrix * a_position; v_texturecoordinates = a_texturecoordinates; } i tried same shaders project , same code in book still gives me same error when compile shader, , viewport on android device blank, clear color set shown.
varying vec4 v_texturecoordinates; ^^^^
there 2 texture2d() overloads in es 2.0:
vec4 texture2d(sampler2d sampler, vec2 coord) vec4 texture2d(sampler2d sampler, vec2 coord, float bias) ...neither of take vec4 coord.
slice off lastly 2 vector components of v_texturecoordinates using swizzle:
gl_fragcolor = texture2d(u_textureunit, v_texturecoordinates.xy ); java android opengl-es texture2d
No comments:
Post a Comment