Hi.

Instanced arrays can be used to provide per-instance data to a shader via something that looks like a vertex attribute (according to https://www.opengl.org/wiki/Vertex_S...stanced_arrays). Is there a way to do the same thing but providing data to uniforms?

What I mean is, say I have a program such as:

Code :
uniform mat4 m_model;
uniform mat4 m_view;
uniform mat4 m_projection;
in vec4 v_position;
 
void main()
{
  gl_Position = m_projection * m_view * m_model * v_position;
}

... and I want to allocate a buffer object of matrices and, for each instance i, supply the ith matrix in the buffer object to the m_model uniform. Is this possible?

I'm trying to modify an existing engine to add instanced drawing and would rather not have to modify shaders to accomodate it (so don't want to be passing in GLSL arrays as uniforms and indexing into them, or by adding new vertex attributes).