无法在WebGL 1.0中声明数组
我正在尝试将着色器从GLSL 300 ES移植到GLSL 100,因此它可以在更多的设备上使用。我有一个数组,它在GLSL 300 ES上效果很好,但是在GLSL 100上,它不起作用。 为了测试我的其他着色器的其他问题,还是阵列的问题,我在最小的着色器中添加了一个简单的数组。
#version 100
attribute vec2 Pos;
void main()
{
float[2] test;
gl_Position = vec4(Pos,0,0);
}
当此着色器被编译时,WebGL给了我这个错误:
错误:0:6:'一流阵列':不支持
I'm trying to port a shader from glsl 300 es to glsl 100, so it works on more devices. I have an array, it works completly fine on glsl 300 es, but on glsl 100 it just does not work.
To test if it's an issue with the rest of my shader, or an issue with the array I added a simple array to the most minimal shader.
#version 100
attribute vec2 Pos;
void main()
{
float[2] test;
gl_Position = vec4(Pos,0,0);
}
When this shader is compiled webgl gives me this error:
ERROR: 0:6: 'first-class array' : not supported
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正确的语法为
另请参见数据类型(GLSL) - 数组
The correct syntax is
float[2] test;
See also Data Type (GLSL) - Array