The only thing with this is that the object is now not positioned on the screen where I am asking it to be anymore.
I have two sprites that is aligned with each other (one above the other).
So, the second one should be located at sprite1.x & sprite1.y+256 but, after applying the shader to the second sprite it is located at roughly sprite1.x-200 give or take.
// Simple passthrough vertex shader
attribute vec3 in_Position; // (x,y,z)
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
attribute vec4 in_Colour; // (r,g,b,a)
attribute vec2 in_TextureCoord; // (u,v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
// Create a transform that will skew our texture coords
mat4 trans = mat4( 1.0, tan(xSkew), 0.0, 0.0,
tan(ySkew), 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * trans * object_space_pos;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
If you could shed an eye over my code that would be awesome
Do I need to multiply the negative tan(xSkew) with the original x position to compensate? Or have I just muliplied something the wrong way?
Screenshot of what is happening
Edited by lonewolff, 09 April 2014 - 12:12 AM.