How to show background bitmap on 2D

When looking at the uv-coordinates and the vertex coordinates, one can see that they do not fit together:

0.0f,0.0f,-1.0f,               0.0f, 0.0f,
with,0.0f,-1.0f,               0.0f, 1.0f,     <-- vertex: change in x, uv: change in y
with,heigh,-1.0f,              1.0f, 1.0f,
0.0f,heigh,-1.0f               1.0f, 0.0f

In addition, you tell OpenGL in this line:

GLES20.glVertexAttribPointer(mTextureCoordinateHandle, 3, GLES20.GL_FLOAT, false, 0,
uvBuffer);                                             ^

that you have 3 uv-coordinates per vertex, but you only have 2.

Leave a Comment