默认情况下,GLSL变量是什么值?

发布于 2025-02-10 20:12:51 字数 187 浏览 0 评论 0原文

我知道在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

再浓的妆也掩不了殇 2025-02-17 20:12:51

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文