Ok. So I am not instance rendering and this is my code
It am attempting to pass a 4 * 4 matrix called transformation_matrix to OpenGL as a vertex attribute
glEnableVertexAttribArray(2);
glEnableVertexAttribArray(3);
glEnableVertexAttribArray(4);
glEnableVertexAttribArray(5);
glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, sizeof(transformation_matrix), 0);
glVertexAttribPointer(3, 4, GL_FLOAT, GL_FALSE, sizeof(transformation_matrix), (void *)(sizeof(float) * 4));
glVertexAttribPointer(4, 4, GL_FLOAT, GL_FALSE, sizeof(transformation_matrix), (void *)(sizeof(float) * 8));
glVertexAttribPointer(5, 4, GL_FLOAT, GL_FALSE, sizeof(transformation_matrix), (void *)(sizeof(float) * 12));
I know I can send it as a uniform but this is an exercise.
However this does not show anything on the screen–it’s blank. However once I add
glVertexAttribDivisor(2, 1);
glVertexAttribDivisor(3, 1);
glVertexAttribDivisor(4, 1);
glVertexAttribDivisor(5, 1);
then all is well. I am confused. Why do we need attrib divisors if there is no instancing going on? Will OpenGL only allow you to send a matrix this way if you it assumes you are instancing via glVertexAttribDivisor? Otherwise does it assume you would only send it as a unifrom?
I have not called glDrawArrays or glDrawElements in their instanced variations yet I still am required to use glVertexAttribDivisor?
Thanks