home/ atoms/ glsl-undeclared-uniform-error

GLSL uniforms must be declared before use; only glslViewer-provided names are available without declaration

Using a uniform variable in a GLSL shader without declaring it with uniform <type> <name>; causes an undeclared-identifier compile error. Additionally, only the uniforms that glslViewer actually provides are available: u_resolution, u_time, u_mouse, u_date, u_tex*, and u_camera*. Using names from other environments (Shadertoy, P5, custom) requires adding the corresponding declaration and ensuring glslViewer actually passes the value. The canonical list is in L1-instruments/glsl/names/uniforms.txt.

Examples

u_beat — undeclared error unless glslViewer provides it. u_time is available once declared as uniform float u_time;.

Assessment

List three uniforms that glslViewer provides and explain what must be done in the shader file before any of them can be used.

“Undeclared uniform** | using a uniform you didn't declare, or a name glslViewer doesn't provide | `ERROR: … undeclared identifier 'u_xxx'`”
context/ · L5-debug/glsl.md · chunk 1