Last active
January 19, 2017 08:15
-
-
Save suzumura-ss/5885266 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform sampler2D tex; | |
float M_2PI = 6.283185307179586; | |
float SQRT2 = 1.4142135623730951; | |
void main() | |
{ | |
float x = (gl_TexCoord[0].x - 0.5); | |
float y = (gl_TexCoord[0].y - 0.5); | |
float r = sqrt(x*x+y*y); | |
float s = atan(y, x)/M_2PI; | |
if (y<0.0) { | |
s = s + 1.0; | |
} | |
s = (1.75-s); | |
if (s>1.0) { s = s - 1.0; } | |
gl_FragColor = texture2D(tex, vec2(s, r*SQRT2)); | |
// gl_FragColor = texture2D(tex, vec2(s, 1.0 - r*SQRT2)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment