const float PI = 3.14159265; varying vec4 Color; void main( void ) { Color = gl_Color; vec4 pos = gl_ModelViewMatrix * gl_Vertex; float lenxy = length( pos.xy ); if( lenxy != 0.0 ) { float phi = atan( lenxy, -pos.z ); float r_over_len = ( phi / (PI/2.) ) / lenxy; pos.xy = pos.xy * r_over_len; } gl_Position = gl_ProjectionMatrix * pos; }