Use the const keyword before the variable declaration to make that variable immutable, which means that it cannot be modified. All basic types, except samplers can be declared as constants. Accessing and using a constant value is slightly faster than using a uniform. Constants must be initialized at their declaration.
const vec2 a = vec2(0.0, 1.0);
vec2 b;
a = b; // invalid
b = a; // valid
Constants cannot be modified and additionally cannot have hints, but multiple of them (if they have the same type) can be declared in a single expression e.g
so … yes you can … the error must be somewhere else
ah … i see what you mean.
No, idont think so. Variables initialized with const are still variables. But switch case only accept true constants. This would require a preprocessor.
You have to switch to if else statments(wich are slower) or use the bare integers.