Skip to content

Instantly share code, notes, and snippets.

@nikp123
Last active July 28, 2021 16:51
Show Gist options
  • Save nikp123/21ebb38f86f56a151318055bb02e4d55 to your computer and use it in GitHub Desktop.
Save nikp123/21ebb38f86f56a151318055bb02e4d55 to your computer and use it in GitHub Desktop.
// input vertex
attribute vec4 pos;
// foreground color
uniform vec4 color;
// screen width and height
uniform vec2 u_resolution;
// projection matrix precalculated by XAVA
uniform mat4 projectionMatrix;
// output color used by the fragment shader
varying vec4 v_color;
const float pi = 3.141592653589793;
void main() {
vec4 mpos = pos*projectionMatrix;
mpos.y += 1.0;
mpos.y /= 2.0*1.41;
mpos.x += 1.0;
mpos.x /= 2.0;
float angle = pi*(mpos.x*2.0);
mpos.x = cos(angle)*mpos.y-sin(angle)*mpos.y;
mpos.y = sin(angle)*mpos.y+cos(angle)*mpos.y;
gl_Position = mpos;
v_color = color;
}
@make-42
Copy link

make-42 commented Jul 28, 2021

i just found this...
I'm fucking retarded and disappointed in myself...

@nikp123
Copy link
Author

nikp123 commented Jul 28, 2021

well we all miss the obvious things dont we

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment