Skip to content

Instantly share code, notes, and snippets.

@CastIrony
Created July 6, 2012 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CastIrony/3063099 to your computer and use it in GitHub Desktop.
Save CastIrony/3063099 to your computer and use it in GitHub Desktop.
varying highp vec2 textureCoordinate;
uniform sampler2D inputImageTexture;
#define M_PI 3.1415926535897932384626433832795
void main()
{
highp vec2 centered = textureCoordinate - vec2(0.5, 0.5);
highp float angle = atan(centered.y, centered.x) / (M_PI * 2.0) + 0.5;
highp float mag = length(centered) * 2.0;
gl_FragColor = texture2D(inputImageTexture, vec2(angle, mag));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment