OpenGL ES 2.0 - vec2 array

I have a program GLSL shader

using my iPhone app (this is a very simple shader). I'm trying to declare an array vec2

, but I'm having a lot of problems. My shader is wrapped in a thrid party library, so unfortunately I can't get any real information about the actual syntax error.

My code (not working) for declaring a vec2 array:

highp vec2 steps[5] = vec2[](
                            vec2(   0.0015625,  0.00208333333333),
                            vec2(    0.003125,  0.00416666666667),
                            vec2(     0.00625,  0.00833333333333),
                            vec2(      0.0125,  0.0166666666667),
                            vec2(       0.025,  0.0333333333333)
                            );

      

Does anyone know how to create an array of vec2

datatypes in OpenGLES 2.0?

+3


source to share


2 answers


highp vec2 steps[5] = {
                            vec2(   0.0015625,  0.00208333333333),
                            vec2(    0.003125,  0.00416666666667),
                            vec2(     0.00625,  0.00833333333333),
                            vec2(      0.0125,  0.0166666666667),
                            vec2(       0.025,  0.0333333333333)
                            };

      



+3


source


I think it is possible to create it, but I am not sure if it can be initialized at the time of declaration. According to the OpenGL ES specification, http://www.khronos.org/files/opengles_shading_language.pdf



There is no mechanism for initializing arrays during declaration from in a shader.

+2


source







All Articles