默认情况下,GLSL变量是什么值?
我知道在C和C ++中,默认情况下这些变量是未直接化的。另一方面,在Java中,默认情况下它们将其初始化为0或NULL。
GLSL中相应的默认初始化是什么? 具体来说,当我们创建以下变量时,默认值是多少?
int val;
vec4 arr [20];
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];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于统一变量始终初始化为0/false。
const
- 标记变量不能非专业化。所有其他非初始化的变量要么从外部资源(UBOS等)获取其内容,要么具有未定义的值。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.