Bind two or more drawings

I am drawing 2D shapes to my OpenGL Window using glBegin() glEnd(). That is simple enough to do but what I’d like to do is bind them together somehow so that when I move one drawing it moves all drawings binded to it. Can any help me with this please.

Best solution (in my opinion) would be if you do this yourself by changing the vertex data in your application.
However, there is also the way to translate the modelview matrix.

Before you start rendering anything to the screen you can call:


glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(x, y, z);

This would move all primitives together by x, y and z.

I not know if I should have mentioned in my original post but I’m drawing 2D shapes to the screen. Does that make a differences because I’m not using a z axis

z can still be used, even in 2D, as a way of depth-testing.
But even if you dont use it, it doesnt matter. Just put a 0 to the z coordinate.

Do you have any links to turorials showing how to do this because I’m new to OpenGL and I’m not quite sure what I have to do