I was working on a project, and for this project I had to go through a book called "OpenGL ES 2 for Android: A Quick Start Guide." So when I got to texturing, I got an error:
'texture2D' : No matching overloaded function found
When I compile the 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 the same shaders for my project and for the same code as in the book, but it still gives me the same error when I compile the shader and the viewport on the Android device is empty, only the clear color I set.
source
share