I have one texture atlas of which I select the "non-animated textures", I put all vertex and UV coordinates in two array:
vertices = new float[] {
// background
0.0f, 1920f, 0.0f,
0.0f, 0.0f, 0.0f,
1080f, 0.0f, 0.0f,
1080f, 1920f, 0.0f,
// character
240f, 760.0f, 0.0f,
240f, 14.0f, 0.0f,
770f, 14.0f, 0.0f,
770f, 760.0f, 0.0f,
// object (Will be transformed)
360f, 800f, 0.0f,
360f, 600.0f, 0.0f,
500f, 600.0f, 0.0f,
500f, 800f, 0.0f,
};
uv = new float[] {
// background
0.50f, 0.25f,
0.50f, 0.75f,
1.0f, 0.75f,
1.0f, 0.25f,
// character
0.0f, 0.25f,
0.0f, 0.75f,
0.25f, 0.75f,
0.25f, 0.25f,
// object
0.0f, 0.75f,
0.0f, 1.0f,
0.25f, 1.0f,
0.25f, 0.75f
};
My vertex shader:
uniform mat4 matrix;
attribute vec4 vPosition;
attribute vec2 a_texCoord;
varying vec2 v_texCoord;
void main() {
gl_Position = matrix * vPosition;
v_texCoord = a_texCoord;
}
And my fragment shader:
precision mediump float;
varying vec2 v_texCoord;
uniform sampler2D a_texture;
void main() {
gl_FragColor = texture2D(a_texture, v_texCoord);
}
I don't know how to animate just a part of the arrangements, also I try to create one more texture but when I run the app I only see the last texture.