uniform float Blend; uniform float OffsetS; uniform float OffsetT; varying vec4 Color; varying float LightIntensity; void main() { const float TWOPI = 2.*3.141592653589; // original model coords (sphere): vec4 vertex0 = gl_Vertex; vec3 norm0 = gl_Normal; // circle coords: gl_TexCoord[0] = gl_MultiTexCoord0; float s = gl_TexCoord[0].s; float t = gl_TexCoord[0].t; float radius = 1.-t; float theta = TWOPI*s; vec4 circle = vec4( radius*cos(theta), radius*sin(theta), 0., 1. ); vec3 circlenorm = vec3( 0., 0., 1. ); gl_TexCoord[0].st += vec2( OffsetS, OffsetT ); // blend: vec4 theVertex = mix( vertex0, circle, Blend ); vec3 theNormal = normalize( mix( norm0, circlenorm, Blend ) ); // do the lighting: vec3 tnorm = normalize( vec3( gl_NormalMatrix * theNormal ) ); vec3 LightPos = vec3( 5., 10., 10. ); vec3 ECposition = vec3( gl_ModelViewMatrix * theVertex ); LightIntensity = 1.5 * abs( dot( normalize(LightPos - ECposition), tnorm ) ); if( LightIntensity < 0.2 ) LightIntensity = 0.2; Color = gl_Color; gl_Position = gl_ModelViewProjectionMatrix * theVertex; }