Im making a really simple 3d walkaround in OpenGL right now, and am having some problems.

I have 3 classes:

Face
Block
Map

A face is simple one face of a block. A block is what it says it is. A map is, (for the moment at least), a 20x20 matrix of blocks.

Now, here is what I am doing. My face class and block class work perfectly, but I am having problems with the map class. It loads in the map fine, but it does not display it correctly. I will show you the map class (its pretty short...just something simple for now) and then explain it:

Code:
```struct MAP3D_DTP
{
BLOCK_DTP *myBlock[20][20];

MAP3D_DTP ( )
{
for(int x = 0; x < 20; x++)
{
for(int y = 0; y < 20; y++)
{
myBlock[x][y] = new BLOCK_DTP;
}
}
}

void LoadMap ( char *filename )
{

for(int x = 0; !myLoadMap.eof() && x < 20; x++)
{
for(int y = 0; !myLoadMap.eof() && y < 20; y++)
{
}
}
}

void DisplayMap ( void )
{
for(int x = 0; x < 20; x++)
{
for(int y = 0; y < 20; y++)
{
myBlock[x][y]->DisplayFaces();
glTranslatef(1.0f, 0.0f, 0.0f);
}
glTranslatef(-20.0f, 0.0f, 1.0f);
}
}

};```

As you can see, the map is stored in a 20x20 matrix of blocks. It loads the map perfectly, but does not display it correctly. You can tell by looking at the display function, that it is supposed to display a block, use glTranslatef() to move over a space, display another, etc. until we have displayed 20 blocks. It then uses glTranslatef() to go back 20 spaces on the x-axis, but move 1 space up on the z-axis and start displaying the next row of blocks, and does this until 20 rows of blocks have been displayed.

However, for some reason it is displaying all of the blocks in the same place. I dont know why. Anybody have an idea? Thanx.

2. use the variables from the for loops to translate to the right spot

void DisplayMap ( void )
{
for(int x = 0; x < 20; x++)
{
for(int y = 0; y < 20; y++)
{
glTranslatef(x, y, 0.0f);
myBlock[x][y]->DisplayFaces();
}
}
}

3. Wouldn't it be better to do this..

Code:
```void DisplayMap ( void )
{
for(int x = 0; x < 20; x++)
{
for(int y = 0; y < 20; y++)
{
glPushMatrix();
glTranslatef(x, y, 0.0f);
myBlock[x][y]->DisplayFaces();
glPopMatrix();
}
}
}```
So as not to disturb the matrix (I forget which one, MODELVIEW?), after the routine is done.

4. what the heck do push and pop matrix do?

5. It pushes a copy of the current matrix on the stack. So you push the copy, do whatever transformations you want, and then pop the matrix to get back to the original one. I don't know if you are doing compound transformations (by the sounds of it, your not ).

6. using the code all of you gave me all of the blocks are still drawn in one place..

even if they were drawn in different places, the map would still be wrong because you guys forgot a principle thing about glTranslatef(). It moves from where we last were, not from (0,0,0) every time.