This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License
QuadXY .2 2.
algart.frag
34
#version 330 compatibility
uniform bool uniform vec4 uniform int uniform float in vec2
uScreen; uColor; uMod; uSide;
This method is known as Connett Circles
in vec2
vX, vY; vST;
vec3
Rainbow( float t ) {…}
void main( ) {
} }
vec2 xy;
if( uScreen )
xy = uSide * gl_FragCoord.xy; else
xy = 200. * uSide * vST;
float z = dot( xy, xy ); // z = x^2 + y^2 int c = int( z );
if( ( c % uMod ) != 0 ) {
//discard;
gl_FragColor = vec4( uColor.rgb, 1. ); }
else {
float t = float( c % 360 ) / 359.; vec3 rgb = Rainbow( t ); gl_FragColor = vec4( rgb, 1. );
Algorithmic Art
Vertex algart.vert
Fragment algart.frag
Program AlgArt \
Mike Bailey mjb@cs.oregonstate.edu
out float vX, vY; out vec2 vST;
algart.pptx
mjb – December 17, 2020
mjb – December 17, 2020
12
34
mjb – December 17, 2020
mjb – December 17, 2020
1
algart.glib
2
##OpenGL GLIB
Ortho -1. 1. -1. 1.
LookAt 001 000 010
algart.vert
void main( ) {
}
uScreen
#version 330 compatibility
vST = gl_MultiTexCoord0.st;
vX = gl_Vertex.x;
vY = gl_Vertex.y;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
12/22/2020
1
5
mjb – December 17, 2020
5
12/22/2020
2