uniform float Polar; uniform float K; uniform float TransX; uniform float TransY; varying vec4 Color; void main( void ) { Color = gl_Color; vec2 pos = ( gl_ModelViewMatrix * gl_Vertex ).xy; pos += vec2( TransX, TransY ); float r = length( pos ); vec4 pos2 = vec4( 0., 0., -5., 1. ); if( Polar != 0. ) { pos2.xy = pos / ( r + K ); } else { pos2.xy = pos * inversesqrt( pos*pos + K*K ); } gl_Position = gl_ProjectionMatrix * pos2; }