I tryed to use the texture buffer object extension but unsuccessfully...
It seams to be a great opportunity for massing instancing. Even if a uniform array could be large it remains limited but I also very interested on efficiency between texture buffer object and uniform buffer.
Have you succesfully used this extension? The specification for this extension isn't an example of good one to me. Part of this feature is defined in GL_EXT_gpu_shader4... I can't feature out any reason.
What I currently have is something like that:
In my vertex shader:
#extension GL_EXT_texture_buffer_object : enable
...
uniform samplerBuffer SamplerBuffer;
...
vec4 Displacement = texelFetchBuffer(SamplerBuffer, gl_InstanceID);
Compiled just fine.
In the C++ side I have :
float InstancePosition[InstanceMax];
...
glActiveTexture(GL_TEXTURE0 + 1);
glGenBuffers(1, &TextureBufferObject);
glBindBuffer(GL_TEXTURE_BUFFER_EXT, TextureBufferObject);
glBufferData(GL_TEXTURE_BUFFER_EXT, sizeof(InstancePosition), InstancePosition, GL_STATIC_DRAW);
glGenTextures(1, &_TextureBufferInstances);
glBindTexture(GL_TEXTURE_BUFFER_EXT, TextureBufferInstances);
glTexBufferEXT(GL_TEXTURE_BUFFER_EXT, GL_RGBA, TextureBufferObject);
And finally my draw call function is:
glDrawArraysInstancedEXT(GL_TRIANGLES, 0, 6, InstanceMax);
(I just saw thank to an error that I have a warning: (6) : warning C7508: extension GL_EXT_texture_buffer_object not supported. I tryed it on both vertex and fragment shader and I have the same warning...)