Reputation:
I know that in c and c++, the variables are uninitialized by default. On the other hand in java they are initialized to 0 or null by default.
What is the corresponding default initialization in GLSL? Specifically, what are the default values when we create the following variables?
int val;
vec4 arr[20];
Upvotes: 3
Views: 1846
Reputation: 473212
It depends on the storage qualifier of the variable in question. uniform
variables are always initialized to 0/false. const
-qualified variables cannot be uninitialized. All other uninitialized variables either get their contents from external resources (UBOs and the like) or have undefined values.
Upvotes: 7