Drawing a few polygons that move- VBO's, VA's, Dl's?

Started by
5 comments, last by Ademan555 18 years, 10 months ago
If i just draw a few polygons on the screen that move around and rotate, should I do VBO's or VA's? And I'm assuming DL's won't work with moving poly's (polys are static, but I use opengl state calls to move them, transforms and rotates) What would be fastest
Black Sky A Star Control 2/Elite like game
Advertisement
That all depends on the hardware, drivers, and how many poly's you will be drawing. DL's or VBO's would be your best bet though.
If at first you don't succeed, redefine success.
Well im probably going to be doing around 50 to 2000 polys on the screen. Most will be particles.

Hardware wise, it's a game, so im putting minimum requires ments at a geforce 1 or ati card.

I also might be using the stencil buffer to draw only parts of some polygons.

And just to clarify, if im storing my my polygon locations in a STL class/struct, I can use DL's?

Also what data structure is the most compatible?

Right now im drawing everything in immediate mode, and with such few polys it's pretty fast. But Basicly im looking for something to give older/slower systems a speed boost, as immediate mode is just to slow anyways.
Black Sky A Star Control 2/Elite like game
For that number of particles I'd say you'll probably be fine with regular vertex arrays. Do that first and see what the performance is like.

However you can still build a display list and use glTranslate/Rotate etc. before you call it. The snag being that you can't get any kind of animation as the polys are fixed in relation to each other.
Don't discount immediate mode. If you submit, say, less than 40 vertices at a time before changing state, immediate mode may work just fine.

You can use display lists even when you move them. If you only record the vertex data, not the transforms, then you can set up the transforms separately, and call the display list to issue the data.

If you're doing lots of particles, though, you really want to be writing them all into one big streaming VBO per material; that's going to be the fastest way to get the geometry to the GPU, assuming you have hardware transform.
enum Bool { True, False, FileNotFound };
I understand supposedly that on average, Lists and VBOs are about the same speedwise, or somewhat close. Lists have the advantage that they can also include state changes, which tend to be costly, and vertices. A trick is that any state that isn't actually changed inside the list then uses the state as is when you call the list, so if you have a quad, just the verts in the list, you can change it's color while using the same list. The disadvantage is that the verts can't change relative to each other. If you have a static model, it is great, but if the model does any animation, you out of luck. VBOs/VAs have the main advantage to me in that they use dynamic data. For just straight VAs, the real advantage is just batch sending of vertices to th GPU in one function call. VBOs I think put the verts into GPU memory before usage(something like that) so they are faster. This isn't too much of an issue, but VBOs are used in an extension to OpenGL, so older cards(read really old) don't have it, but most anything nowere or recent does. The best way is just to use the best tool for the job. A List won't help too much for a particle system due to that the particles are animated position wise, so you'd have the List of only one quad or point, so obviously VAs are a better choice for that.


Hrm, ive got a question, you reccomend streaming VBOs. I was thinking that when i designed my particle system. But, is it possible/likely that internally, vertex arrays ARE streaming VBOs? (on newer cards that is). Or do you think that theres still an advantage to using a streaming vbo over a va? (Im currently using VAs, although premature optimization is the root of all evil, the transition would be so painless i wouldnt mind, what do you think?)

thanks
-Dan
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."

This topic is closed to new replies.

Advertisement