Sign in to follow this  
qbic

Mixing triangles and quads?

Recommended Posts

qbic    162
I have a model, that consist of both triangles and quads, so currently when rendering the model, i have to check every polygon if it's a triangle or a quad. Thereby i have to call one glBegin() and one glEnd() for each polygon i render. What i wonder is if that is bad for the performace, and if it is, how much? I've been thinking about triangulate the model when it loads so i only need one glBegin() and glEnd() for the whole model.

Share this post


Link to post
Share on other sites
Sneftel    1788
glBegin() and glEnd() is always horribly inefficient, except when you're building a display list. Of course, mixing triangles and quads in the display list will often make the display list horribly inefficient, too! So you've got all the "this is a bad idea" bases covered.

First of all, if you have triangles and quads, just convert everything into triangles. Second, stop using glBegin() and glEnd(), and start using vertex arrays and/or VBOs.

Share this post


Link to post
Share on other sites
Darragh    308
If you don't want to delve into using VAs / VBOs just yet, another thing you could do is to create two separate display lists- one for your tris, and one for your quads. Batching similar primitives together might help improve your performance.

But yeah, if you're in it for speed then go learn how to use VAs / VBOs - they're not difficult to pick up at all. I got something around a tenfold increase in performance- just by changing my rendering from immediate mode to using VBOs.

Share this post


Link to post
Share on other sites
qbic    162
I have read up on vertex arrays, and they look fairly simple.
So i will convert all quads to triangles and use thoose.

Thanks very much for the replies!

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