home/ atoms/ glsl-shadertoy-uniform-names-incompatible

Shadertoy uniform names (`iTime`, `iResolution`, etc.) are undefined in glslViewer and must be replaced

Shadertoy shaders use uniform names that do not exist in glslViewer: iTimeu_time, iResolutionu_resolution, iMouseu_mouse, iChannel0u_tex0, and entry point mainImage(fragColor, fragCoord)main() writing gl_FragColor from gl_FragCoord. Pasting a Shadertoy shader unmodified into glslViewer produces compile errors on every undefined uniform. The full porting table is in cheatsheet.md §2.1.

Examples

Shadertoy: void mainImage(out vec4 c, vec2 fc){ c = vec4(iTime,0,0,1); } glslViewer: void main(){ gl_FragColor = vec4(u_time,0,0,1); }

Assessment

Port this Shadertoy snippet to glslViewer: gl_FragColor = vec4(iTime*0.1, iMouse.x/iResolution.x, 0.5, 1.0);

“Shadertoy names don't exist.** `iTime`, `iResolution`, `iMouse`, `iChannel0`, `mainImage`, `fragCoord` → all undefined here. glslViewer uses `u_time`, `u_resolution`, `u_mouse`, `u_tex0`, `main()`, `gl_FragCoord`.”
context/ · L1-instruments/glsl/gotchas.md · chunk 1