Meaning of one command in the function of OpenGL

Dear All,
I am working on the ex about opengl, I was told to use glutSolidCube to write a function to generate boxes with different dimensions, i wanna know why the answer needs to do some sort of translation about y axis in 0.5 (as indicated by the “?”).

Thanks for all your help!

It doesn’t have to. It may be an example. I would change it to:

void box(float x, float y, float z, float l=1.0, float w=1.0, float h=1.0)
{
glPushMatrix();

glScalef(l,w,h);
glTranslatef(x, y, z);
glutSolidCube(1);

glPopMatrix();
}

It doesn’t have to. It may be an example. I would change it to:

That does the transformations in the wrong order. The XYZ position is supposed to be a world-space position, yes? Then it goes on the left (before) the scale.

That means I can ignore the 0.5 translation or?

And is my thinking follow the order from the bottom of the program? i.e. Actually I first draw a solid cube, and do the translation and finally scale the cube with different dimension?