glGetActiveUniformsiv: find uniformIndices[] when Uniform Block Object contains an array of Struct Objects? [closed]

StackOverflow https://stackoverflow.com/questions/9004931

  •  14-11-2019
  •  | 
  •  

Question

For example,

struct A{
   GLint a1;
   GLint a2;
   GLint a3;
};

Uniform X{
    A a[8];
}x;

GLchar* uniformNames[]={"x.a"};
GLuint uniformIndices[1]={0};

Now,

glGetUniformIndices(programID, 1, &uniformNames, &uniformIndices);

-- doesn't return uniformIndices[]? I think I am making an obvious mistake which I am not able to figure out. Please help me out.

Was it helpful?

Solution

I think I got where I was going wrong, to get the indices the names had to be of the form, x.a[0], x.a[1] and so on.

However, I am not able to get the UNIFORM_ARRAY_STRIDE, if the case is something like this:

uniform X{
   A a;
}x[8];

How do I find the array strides in this case? Because I am not able to populate data for all the instances of X. Please help me with that. Thanks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top