Draw a 2D Image using OpenGL ES 2.0 Draw a 2D Image using OpenGL ES 2.0 android android

Draw a 2D Image using OpenGL ES 2.0


"v_TexCoordinate = a_TexCoordinate" +

should have been

"v_TexCoordinate = a_TexCoordinate;" +

Apparently I forgot a semi-colon, now I realize just how much I rely on my IDE's to tell me when I mess up stupid things haha.


There is a mistake with variable vColor naming (or using) in fragmentShaderCode. Here your variable has name vColor:

uniform vec4 vColor;

and in this line it has name v_Color

gl_FragColor = (v_Color * texture2D(u_Texture, v_TexCoordinate));


Try with following Texture coordinates:

final float[] cubeTextureCoordinateData = {
0.5,-0.5, 0.5,0.5, -0.5,0.5, -0.5,-0.5 };

Its working. Thank you very much.