Hello,
i statred to learn opengl, from superbible 6th edition(version 4.3), and, i have a troubles with a drawing things. I am learning from opengl tutorials on internet, too. lets say, i have a very simple vertex shader, :
#version 430 core
in vec4 position;
uniform mat4 mv_matrix;
uniform mat4 proj_matrix;
uniform mat4 model_matrix;
void main(void)
{
gl_Position = proj_matrix * mv_matrix * model_matrix * position;
}
and in my render func. :
vmath::mat4 model_matrix = vmath::translate(0.0f, 0.0f, -0.3f);
vmath::mat4 mv_matrix = vmath::translate(0.0f, 0.0f, -6.0f) *
vmath::translate( r, 0.0f, 0.0f);
glUniformMatrix4fv(mv_location, 1, GL_FALSE, mv_matrix);
glUniformMatrix4fv(model_location, 1, GL_FALSE, model_matrix);
glDrawArrays(GL_TRIANGLES, 0, 36);
(here i am not using a lookat matrix, but it doesnt matter)now, i can draw only one cube. My question is, how to draw more cubes, with that i will can set their position by model matrix. will i need more shaders? or what? Probably it is a very easy thing, but i cant find the solution(remember, pls, that i want to set their position, because i can draw more cubes if i will call my render func more times, but how to set their position?).