opengl-es-2.0 - opengl es 2.0 - How to declare a function that returns an array in glsl es (version 100) - answerstu - answerstu.com answerstu

1 Answer

  1. Kenneth- Reply

    2019-11-14

    I found a way to work around this limitation. You can return an array by modifying the passed in array by reference. Here is a sample fragment shader:

    void GetArray(inout vec4 array[1])
    {
        array[0] = vec4(.5,.2,.1,1.0);
    } 
    
    void main()
    {
        vec4 test[1];
        GetArray(test);
        gl_FragColor = test[0];
    }
    

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>