What is wrong with my code? (rotation)


I am trying to port tutorial #11 from ogldev to use glm, but something is not okay.

Original code:

Pipeline p;
p.Scale(sinf(Scale * 0.1f), sinf(Scale * 0.1f), sinf(Scale * 0.1f));
p.WorldPos(sinf(Scale), 0.0f, 0.0f);
p.Rotate(sinf(Scale) * 90.0f, sinf(Scale) * 90.0f, sinf(Scale) * 90.0f);

glUniformMatrix4fv(gWorldLocation, 1, GL_TRUE, (const GLfloat*)p.GetWorldTrans()); 

My attempt to port it:

glm::mat4 scale = glm::scale(glm::mat4(1.0f), glm::vec3(sinf(i * 0.1f)));
glm::mat4 translate = glm::translate(glm::mat4(1.0f), glm::vec3(sinf(i), 0.0f, 0.0f));
glm::mat4 rotate = glm::rotate(glm::mat4(1.0f), sinf(i) * 90.0f, glm::vec3(1.0f, 1.0f, 1.0f));

glm::mat4 model = translate * rotate * scale;

glUniformMatrix4fv(hWorld, 1, GL_FALSE, glm::value_ptr(model));

But something I must be doing wrong.

The original tutorial can be downloaded from here http://ogldev.atspace.co.uk/ogldev-source.zip
But mine is not working the same as the original. If someone can fixit or give me a hint. My project:

Ok guys, I did not take into consideration the order of the vertices that it must be counter clockwise. I fixed it now, but sometimes my pyramid looks like if a piece was bitten off:

How could I fix that?
I tried depth buffers but it did not work.

Found the problem: vertices of the triangles were not in clock wise order. kabaam!