Shader is executed in the GPU which are tiny microprocessors running in parallel at the same time. That’s why it can be fast.
Each thread in the GPU is blind and memoryless. (impossible to know the previous state)
The final pixel color is assigned to the reserved global variable gl_FragColor.
vec3 + float can be used to construct vec4: vec4(vec3(1.0,0.0,1.0),1.0);
uniform: bridges between the CPU and the GPU
Some of the built-in uniforms
uniform vec2 u_resolution; // Canvas size (width,height)
uniform vec2 u_mouse; // mouse position in screen pixels
uniform float u_time; // Time in seconds since load
Uniform are variables that globally applies to every pixel whereas Varying are different from pixel to pixel (or thread to thread)
Bottom is 0 in Y coordinate.
floating point suffix is not supported? 0.0f isn’t 1.0 double?
below7. Try commenting out line 6? -> line 6 doesn’t exist
ofRect is deprecated.
For now, I decided to use openFrameworks in Pd (using the Ofelia external) to load/run shader code.
#make20 #20daysITP