secret
Created

Shader

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
#version 400
 
in vec2 position;
in vec2 inputTexCoord;
 
out vec2 texCoord;
 
uniform mat4 orthoMatrix;
 
 
 
mat4 rotation = mat4(
vec4(0,-1,0,0),
vec4(1,0,0,0),
vec4(0,0,1,0),
vec4(0,0,0,1));
 
mat4 translateOrigin = mat4(
vec4(1,0,0,0),
vec4(0,1,0,1),
vec4(0,0,1,0),
vec4(0,0,0,1));
 
 
 
void main()
{
gl_Position = orthoMatrix * vec4(position,1,1);
//Setup the original Position Matrix
mat4 translateOriginal = mat4(
vec4(1,0,0,gl_Position.x), //Doubt this here is correct
vec4(0,1,0,gl_Position.y),
vec4(0,0,1,1),
vec4(0,0,0,1));
 
//Move to origin
gl_Position = translateOrigin * gl_Position;
//Rotate
gl_Position = rotation * gl_Position;
//Restore position
gl_Position = translateOriginal * gl_Position;
 
//Output Tex
texCoord = inputTexCoord;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.