Rendering multiply VBOs

Hi!
Before I have switched to VBOs I was using immediate mode and Display lists. Since both ways are either depreciated or slow I decided to start using VBOs. Now I got a little problem, which is not really related to VBOs but more to drawing in 3D room.

I have done quite a bit of research and figured out that you got basically 2 coord. systems in OpenGL, a static one, and one which you are able to move around etc.
However, I somehow could not figure out how to do render loops for a single object (entity, w/e you wanna call it). I tried it the following way:

//1.)
//Render loop for a single entity
glPushMatrix();
glTranslatef(x-pos-of-my-entity,y,z);
glPopMatrix();

//2.)
//Main render loop:
glDrawArrays( ...);

Yes, this way does not really work. The objects only get drawn a single time and disappear afterwards. Also, I am not exactly sure (or: I highly doubt) if moving the coord. system for every render loop is really smart.

My question: How to do efficient render loops for several objects/entities ?

Thanks in advance!

glDrawArrays uses the current matrix for everything it renders. Your current matrix code therefore does nothing.

I have done a little mistake.

The line would of course be

glTranslatef(x-pos-of-my-entity,y,z);

So what you said is, that the code should look like following?:

glPushMatrix();
glTranslatef(x-pos-of-my-entity,y,z);
glDrawArrays();
glPopMatrix();

This is what I would use for the rendering loop of a single object or what?

Yes, that’s the only way to get a different matrix for each object without OpenGL 3+. The best solution is instancing, but you need a custom shader, manual matrix calculations, something to hold the matrix data (a UBO or TBO) and a OpenGL 3 capable graphics card for…