Sign in to follow this  
ViperG

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

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this