#version 330

layout( location = 0 ) in vec3 InVertex;

uniform mat4 uViewMatrix;
uniform mat4 uProjectionMatrix;
uniform samplerBuffer uMatrixBuffer;

void main()
{
	mat4 modelMatrix = mat4(texelFetch(uMatrixBuffer, gl_InstanceID + 0), 
							texelFetch(uMatrixBuffer, gl_InstanceID + 1), 
							texelFetch(uMatrixBuffer, gl_InstanceID + 2), 
							texelFetch(uMatrixBuffer, gl_InstanceID + 3));
							
	gl_Position = uProjectionMatrix * uViewMatrix * modelMatrix * vec4( InVertex, 1.0 );
}