# Applying transformations to all objects in scene

Hi all,

So I got this school assignment which is due tomorrow and I managed to complete 50% of it but cannot do the oher half no matter what I try. Here is a short explanation:

I have to make a tetris “W” form with GL_TRIANGLES. The tetris W is the tetris block made up of 5 smaller cubes that looks like the letter W.

So I made one out of cubes… but the way I did it is pretty shoddy code probably, I basically made my entire Vertex array contain the vertices of all 5 cubes that make up the W form (resulting in a really long vertex array).

Then next, my job was to multiply/rotate this “W” form along a 5radius circle on 5 equal points. I did this too, here is the code for it:

``````void CMyApp::Render()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glUseProgram(m_programID);

glMatrixMode(GL_PROJECTION);

m_matWorld = glm::mat4(1.0f);

glUniformMatrix4fv(m_loc_view, 1, GL_FALSE, &(m_matView[0][0]));
glUniformMatrix4fv(m_loc_proj, 1, GL_FALSE, &(m_matProj[0][0]));

glBindVertexArray(m_vaoID);

for (int i = 0; i < 5; i++) {
m_matWorld = glm::rotate<float>(360 / 5.0*i, 0, 1, 0)*glm::translate<float>(5, 0, 0); //here i rotate the original W form 5 times equally along the circle. it works fine
glUniformMatrix4fv(m_loc_world, 1, GL_FALSE, &(m_matWorld[0][0]));
glDrawArrays(GL_TRIANGLES, 0, 180);
}
glBindVertexArray(0);
glUseProgram( 0 );
}
``````

The result of this code is attached below.

Now what I have to do is take that ENTIRE SCENE (so all five of those W forms) and move it along a parabolas equation which is y = 0.02x^3 + 0.04x^2

But the problem is, if I do any transformation whatsoever it will apply only to the first “W” form because m_matWorld is still set to that first one.

I read about LoadMatrix, PopMatrix, PushMatrix, and have tried experimenting with all of those but have completely failed. No matter what I do all of my transformations apply only to the first W form and not the entire scene with all 5 objects in it.