I'm trying to draw element from a texture atlas with OpenGL ES 2.
Currently, I'm drawing my elements using something like that in the shader: uniform mat4 uCamera;
uniform mat4 uModel;
attribute vec4 aPosition;
attribute vec4 aColor;
attribute vec2 aTextCoord;
uniform vec2 offset;
uniform vec2 scale;
varying lowp vec4 vColor;
varying lowp vec2 vUV;
void main()
{
vUV = offset + aTextCoord * scale;
gl_Position = (uCamera * uModel) * aPosition;
vColor = aColor;
}
For each elements to draw I send his offset and scale to the shader. The problem with this method: I can't rotate the element but it's not a problem for now.
I would like to know, what is better for performance:
- Send uniforms like that for each element on every frames
- Update quad geometry (uvs) for each element
Thanks!