PDA

View Full Version : Q: Best course of action? Rendering options



09-20-2003, 09:49 AM
Situation: I have an application that calls for a ~15x~15 grid of 3D models. The models are rotated in place (in fixed increments of ~45 degrees), but do not move from their grid position. The grid will move around. There will likely be less than ten different models, each being used several times over. The models are static, and probably less than 40 polygons each. Think of a chess board, each square being from a small set of models.

So how best to display all this? I want to support as many different platforms as possible (minimum spec of OpenGL 1.1) - alternative code paths are *okay*, but I'd rather waste run-time performance than coding time, unless the benefits are worth it.

As I see it my options are:

1. Brute force without transformations. Render all vertices in their correct places.

2. Brute force with transformations. Render models at origin and rotate them then translate them to the required position.

3. Display lists with transformations. Use a DL for each model, rotated and translated as before.

4. Display lists with trans*lations*. To save on push/pop calls, make DLs for each possible rotation of each model.

5. Vertex arrays with transformations. Yadda, yadda.

6. Brute force vertex arrays. Each frame, calculate all vertex coordinates and block-copy them into an array; then draw it all at once.

7. VBOs with transformations. Higher requirements, and probably not worth the time for the performance gain in my situation?

zeckensack
09-21-2003, 05:19 AM
1, 4, 6 sound like a waste of memory without any tangible gains to be had.

2 seems to refer to immediate mode, which should be avoided.

Display lists will do the trick and will be the easiest thing to use here, with pretty optimum performance.

But IMO that won't be necessary. Vertex bandwidth won't be your bottleneck, and even if it were, STATIC_DRAW VBOs can do the same and they are more flexible.

I suggest writing solution #5, verify it works, and then migrate it over to #7.

09-21-2003, 01:42 PM
Hi zeckensack, thanks for your response!


1, 4, 6 sound like a waste of memory without any tangible gains to be had.
Okay, yep, I see that.


2 seems to refer to immediate mode, which should be avoided.
Ah, now what do you refer to as "immediate mode"? I guess that would be code doing every little thing with a seperate GL call, instead of batching things up, storing data server-side etc.


(...) I suggest writing solution #5, verify it works, and then migrate it over to #7.
Okay, that sounds great! There's just so many ways to do things these days I'm just never sure what I should and shouldn't be using... http://www.opengl.org/discussion_boards/ubb/rolleyes.gif

Thank you for your recommendations.

zeckensack
09-21-2003, 02:05 PM
Yeah, immediate mode is the term we use around here for stuff like


glBegin(GL_TRIANGLES);
glColor4ub(255,0,0,255);
glVertex3f(0.0f,0.0f,0.0f);
glColor...
glVertex...
etc
glEnd();Coincidentally, I was just involved in the 'migration' part, with interleaved vs seperate vertex arrays thrown in. Maybe this is interesting or helpful to you: http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/010462.html

09-22-2003, 01:08 AM
Coincidentally, I was just involved in the 'migration' part, with interleaved vs seperate vertex arrays thrown in. Maybe this is interesting or helpful to you: http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/010462.html

Hi zeckensack,

Yes, that's brilliant - really helpful stuff. Thanks!