Is it possible to have a dynamic array in a GLSL shader? For instance, what if I have something like this in my GLSL Shader:
uniform int size;
uniform SceneLights lights[size];
void main()
{
for(int i = 0; i < size; i++) {
/* Do Some Calculation */
}
}
And this would be my C++ file:
for (GLuint i = 0; i < pointLights.size(); i++) {
glUniform3f(glGetUniformLocation(shader, ("pointLights[" + std::to_string(i) + "].position").c_str()), lights[i].someValue);
}
I would like to do this because I have a file with the positions of all the light sources in my scene (this may vary for each scene) so I would like to have a dynamic array which will allow me to send different numbers of lights to my shader.