Need help with rendering several models

Hello Everybody.
I’m actually trying to render a scene containing several models. Each model has his own modelview matrix, so I cannot just specify one modelview matrix and use it for all the geometry, it will lead to undesired results.
Now the problem is that I simply do not now what is the procedure of rendering several models with different modeling transformations. Should I specify the geometry several times and call drawTriangles several times before swapping the buffers?
Thank you,
sorry for the silly question.

Yes of course.

I suppose you are using the Fixed function pipeline. If you need better performance, it may be an advantage to use your own shaders with vertex buffers.

That way, you define the geometry and download it to the graphic card only once, then only have to update the model+view matrix between every draw() call.

Thank you for the answer.

Actually yes, I am using shaders with quite big models.
I guess I will need to figure out what’s the maximum capacity of a vertex array befure uploading all the data to the card…

Thanks!

Just a notice: I have a similar situation, with big models and lots of data. At first, I was greedy and defined the data of the type GL_BYTE instead of GL_FLOAT. While it saved GPU memory, it is not the “native format”, and there was a performance penalty. I suppose the penalty will vary for different graphic cards.

Using indexed drawing (with glDrawElements) can allow you to use fewer vertices. With some luck, every vertex is used 6 times in a mesh. It also speeds up rendering, as the graphic card will use the cache and only execute the fragment shader once.

[quite] It also speeds up rendering, as the graphic card will use the cache and only execute the fragment shader once. [/QUOTE]

I think you mean “it can caches already processed vertices so it doesn’t have to run the vertex shader again”. :slight_smile:

heinz: How big are we talking here?