How do I draw more then 1 model using MPV and OpenGL 3.3?

I’m doing the tutorials from
On tutorial 4 it asked to do 2 models to show at the sime time on window. It said that just need to do the same thing that is done with the cube.
So I’ve maintain the shadders and the “MP” from “MPV” and did another triangle, just by typing:

mat4 triangle_Model = mat4(1.0f);
    mat4 triangle_MPV = Projection * View * triangle_Model;
    GLuint triangle_MatrixID = glGetUniformLocation(programID, "MPV");
    glUniformMatrix4fv(triangle_MatrixID, 1, GL_FALSE, &triangle_MPV[0][0]);
//ProgamID is the same of the cube. I've tried to separate; but, still, doesn't worked

static const GLfloat triangle_buffer_data[] = {
        -2.0f, -3.0f, 1.0f,
         2.0f, -3.0f, 1.0f,
         0.0f,  3.0f,-1.0f

    GLuint triangle_vertexbuffer;
    glGenBuffers(1, &triangle_vertexbuffer);
    glBindBuffer(GL_ARRAY_BUFFER, triangle_vertexbuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(triangle_buffer_data), triangle_buffer_data, GL_STATIC_DRAW);

and at the main loop:

        glBindBuffer(GL_ARRAY_BUFFER, triangle_vertexbuffer);

        glUniformMatrix4fv(triangle_MatrixID, 1 ,GL_FALSE, &triangle_MPV[0][0]);

But the triangle doesn’t appear. I’ve disabled the cube to see if it works, changed camera and everything.
Can anyone help-me, please?

PS1: same shadders as the tutorial ones.
PS2: Sorry for my english, I’m from Brazil and speaks portuguese (we do not speak “brazilian” or spanish as some people from outside that I spook thought xD)

by the way, full code is here:
ht tp:// pastebin . com/e6zWrnKM
Sorry, the forum won’t allow me to post a full link.

Please use [noparse]




[/noparse] tags around source code. Preserves the indentation and makes it much more readable.

How do I draw more then 1 model using MPV and OpenGL 3.3?

If you’re using the same shader and you’ve already populated the MVP uniform, you can just re-launch it. Repopulating it with the same value won’t hurt, but will just waste cycles.

It worked with one model, right?