The examples below focus on how ISF source code translates to Vuo node characteristics, with minimal GLSL code. (For examples with more interesting GLSL code, see the ISF website.) After each ISF source listing is the Vuo node that it creates.
/*{ "LABEL":"Make Red Image" }*/ void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); }
/*{ "ISFVSN":"2.0", "TYPE":"IMAGE", "LABEL":"Make Opaque Color Image", "INPUTS":[ { "NAME":"fill", "LABEL":"Fill Color", "TYPE":"color", "DEFAULT": { "r":0.0, "g":0.0, "b":1.0, "a":1.0 } }, { "TYPE":"size" } ], "OUTPUTS":[ { "NAME":"colorImage", "TYPE":"image" } ] }*/ void main() { gl_FragColor = vec4(fill.rgb, 1.0); }
/*{ "LABEL":"Replace Red Channel", "INPUTS":[ { "NAME":"inputImage", "TYPE":"image" }, { "NAME":"red", "TYPE":"float", "MIN":0.1, "MAX":0.9, "DEFAULT":0.5 } ] }*/ void main() { gl_FragColor = vec4(red, IMG_THIS_NORM_PIXEL(inputImage).gba); }
/*{ "LABEL":"Blend Image Components", "INPUTS":[ { "NAME":"image1", "TYPE":"image" }, { "NAME":"image2", "TYPE":"image" }, { "NAME":"blendType", "TYPE":"long", "VALUES":[0, 1], "LABELS":["Darker Component", "Lighter Component"] } ] }*/ void main() { vec4 color1 = IMG_THIS_NORM_PIXEL(image1); vec4 color2 = IMG_THIS_NORM_PIXEL(image2); gl_FragColor = (1 - blendType) * min(color1, color2) + blendType * max(color1, color2); }