Jump to content
  • Advertisement
Sign in to follow this  
AvengingRage

GL Primitives, texturing, and speed

This topic is 3725 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, this is is more of a theoretical question than anything to do with something I'm currently trying to code, but I will definitely be taking the answer into consideration in the future. OK, first off, how big of a difference is there in drawing time between things like triangles, triangle strips and fans, quads, etc. What I mean is, I know I can draw any quad as a combination of triangles, but is drawing 2 triangles faster than drawing a single quad? I assume the triangle strips and fans are faster than triangle lists as well since it doesn't have to read in as many points into memory. Also, how would one use triangle strips and fans with texturing? Since you have to specify a texture coordinate for each point, using a strip or fan would seem to indicate that you'd need to put in TWO coordinates for each vertex. Also what if you want to use multiple textures within the same strip or fan, is that possible? I hope my questions are clear, if not please ask and I will try to clarify. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Quads will be internally split into two triangles, so the drawing speed should be identical. Be careful because in some situations the automatic conversion can yield unexpected results (particularly with texture coord interpolation) so you might prefer to do this step manually.

Yup, strips and fans let you specify geometry without sending as many points. Graphics cards also have a post-transform cache which reuses vertices rather than transforming them each time which saves calculations. Since the vertices are shared that means the texture coords are shared too - usually this isn't a problem as they represent a continuous surface. If you want different texture coords you'll have to add extra vertices or split things up into separate strips. You can't change texture in the middle of a strip or fan either, so you have to split them up then too. Alternatively you can pack multiple textures into one bigger texture (like a sprite sheet or texture atlas) so you don't have to break up your strips.

Fans are pretty much useless since most geometry isn't fan-like. Strips are used much less now - it's usually preferable to use index geometry which gives you the same speed advantages without the awkward step of trying to strip-ify your model data.

Share this post


Link to post
Share on other sites
Thanks for the reply!

Unfortunately the program I have in mind would need to change textures for every quad so looks like strips and fans are out. Oh well, there won't be enough to matter in this case, but its good to know for the future. Thanks again.

Share this post


Link to post
Share on other sites
Changing texture every quad is going to kill your performance if you're not careful. You should look into using a texture atlas or sprite sheet so you can reduce the number of times you have to switch texture and so draw more stuff at once.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!