I am trying to pass an array of point lights from an object class to the vertex shader in OpenGL ES 2.0 on Android.
The point lights are stored as a float[]
array and the shader would ideally read the floats as a vec4[]
array.
The float[] can be passed to the vertex shader by calling glUniform4fv(...floatArray, 0)
and is declared in the vertex shader as uniform vec4 u_PointLights[990]
but this is extremely slow.
I'm trying to get the floats into GPU memory; first thought was a VBO but after binding the data and passing it to the shader, I can only read a single vec4 and not an array (i.e. cannot declare attribute vec4[] a_PointLights
).
What is the best way to get second vec4[]
into the shader?
Thanks,
Richard
glUniform4fv
? Once per frame? – Tommy