Assuming I only want to render quads and can reuse my mesh, I would like to be able to, in a single draw call, render many instances.
I would like to achieve this with a texture buffer object by placing transformation matrices into the buffer.
I understand how to setup a texture buffer object in C++, but am confused on how to grab my transformations from this in GLSL.
uniform samplerBuffer sampler;
...
... = texelFetch( sampler, index );
In the above code (in a vertex shader) I'm not sure how the samplerBuffer keyword works (and have had a lot of trouble finding documentation). I would like to know which index in the texture buffer a given vertex is associated with, this way a transformation lookup can occur. How can I do this, and what would the GLSL syntax look like?
It can be assumed that the transformation matrices are 4x4 matrices. I was hoping to be able to keep the OpenGL version requirements in the 2.XX range.
Edit: So I found this: http://www.opengl.org/registry/specs/ARB/draw_instanced.txt. I can deal with a 3.0 limitation. However I'm getting confused when looking up examples of how to use this. Using GLEW, I suppose I would call glDrawElementsInstanced, but some places on the internet are saying this requires OpenGL version 3.3 or later. How can I take advantage of the 3.0 requirement I linked?