I have this struct array in GLSL.

struct Test {
    vec2 value1;
    vec3 value2;
    float value3;
uniform Test u_test[5];

How can I modify the elements of this array one at a time?

I know that the location of individual objects in an element in the array can be accessed using glGetUniformLocation(program, "u_test[0].value1") but I'd like to upload an entire instance of Test at once.


It is not possible to set the value of a struct as a whole, since there is no location for it.

All of my lookups returned -1. The values of a struct have to be set individually.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.