I want to render 2D images. To do this I scale and transform everything into position with the centre being where I want it. I need to rotate the 2D coordinates around the centre but when I do this it is as if there was some x coordinate involved since the images are flattened out strangely. Here is the code:
attribute vec4 vPosition;
attribute vec2 a_texCoord;
varying vec2 v_texCoord;
uniform vec2 scale;
uniform vec2 trans;
uniform float move_down;
void main(){
gl_Position = vPosition;
gl_Position.x *= scale.x;
gl_Position.y *= scale.y;
gl_Position.x += trans.x;
gl_Position.y += trans.y - move_down;
gl_Position.x *= 2.0;
gl_Position.y *= 2.0;
gl_Position.x -= 1.0;
gl_Position.y -= 1.0;
gl_Position.x *= 0.2; //For visual testing only
gl_Position.y *= 0.2; //Same
gl_Position.x = cos(1.0)*gl_Position.x - sin(1.0)*gl_Position.y;
gl_Position.y = sin(1.0)*gl_Position.x + cos(1.0)*gl_Position.y;
v_texCoord = a_texCoord;
}
Here is the image without the rotation lines…

And here is the image with the rotation at 1.0 radians…

Clearly there is an issue, since it should be a simple 2D rotation. If I do 90 degrees the image disappears completely.
Done with OpenGL-ES 2 for Android.
I appreciate any answers to this.
Edit: I also tried this with the same problem:
mat4 RotationMatrix = mat4( cos(1.0), -sin(1.0), 0.0, 0.0,
sin(1.0), cos(1.0), 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0 );
gl_Position *= RotationMatrix;
I was multiplying the matrix after the vector… Wrong way around. The Matrix works when it is done as: