I want to render more than one mesh with each one having its own transformation. Using this tutorial to begin with I have modified few things like added a new model:
Model anotherModel( "path_to_obj_file" );
and after the "ourModel.Draw( shader )" I have added :
glm::mat4 view = camera.GetViewMatrix( );
glUniformMatrix4fv( glGetUniformLocation( shader.Program, "projection" ), 1, GL_FALSE, glm::value_ptr( projection ) );
glUniformMatrix4fv( glGetUniformLocation( shader.Program, "view" ), 1, GL_FALSE, glm::value_ptr( view ) );
glm::mat4 model2;
model2 = glm::translate( model2, glm::vec3( 0.0f, 0.0, 0.0f ) ); // Translate it down a bit so it's at the center of the scene
model2 = glm::scale( model2, glm::vec3( 0.1, 0.1, 0.1 ) ); // It's a bit too big for our scene, so scale it down
model2 = glm::rotate(model2, (float)0.0, glm::vec3(1.0f, 1.0f, 1.0f));
glUniformMatrix4fv( glGetUniformLocation( shader.Program, "model2" ), 1, GL_FALSE, glm::value_ptr( model2 ) );
and finally :
anotherModel.Draw( shader );
However I am not getting the result of individual transformation for both models.Only the first transformation persists although "anotherModel" is getting rendered.