Skip to content

Instantly share code, notes, and snippets.

@pera
Created March 12, 2012 22:40
Show Gist options
  • Save pera/2025159 to your computer and use it in GitHub Desktop.
Save pera/2025159 to your computer and use it in GitHub Desktop.
rainbow :3
float s = gl_TexCoord[0].s;
//sine
gl_FragColor.rgb = clamp(vec3(cos(s*pi*2)+0.5,cos(s*pi*2-pi*(2.0/3.0))+0.5,cos(s*pi*2+pi*(2.0/3))+0.5),0,1)*gl_TexCoord[0].t;
//linear
gl_FragColor.rgb = clamp(vec3(abs(6*s-3)-1,2-abs(6*s-2),2-abs(6*s-4)),0,1)*gl_TexCoord[0].t;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment