本文介绍了如何在GLSL(OpenGL ES 2.0)中定义常量数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想存储每个片段计算所需的权重数组。
I just want to store an array of weights that needs to every fragment calculation.
这个:
float weights[5] = float[5](3.4, 4.2, 5.0, 5.2, 1.1);
抛出这个:
ERROR: 0:30: ']' : syntax error syntax error
ERROR: 0:30: ';' : syntax error syntax error
推荐答案
来自,段落 4.1.9数组
(p.24):
From the OpenGL ES SL 1.0 spec, paragraph 4.1.9 Arrays
(p. 24):
请注意,故意遗漏。根据,OpenGL ES 2的OpenGL ES SL版本基于。同一段(第20页)包含:
Note that this has been intentionally left out. According to this post, the OpenGL ES SL version for OpenGL ES 2 is based on OpenGL SL 1.2. The same paragraph (p. 20) contains:
float a[5] = float[5](3.4, 4.2, 5.0, 5.2, 1.1);
float a[5] = float[](3.4, 4.2, 5.0, 5.2, 1.1); // same thing
这篇关于如何在GLSL(OpenGL ES 2.0)中定义常量数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!