Jump to content
  • Advertisement
Sign in to follow this  
MrRage

OpenGL glDrawElements

This topic is 5084 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

This is kind of a basic question but is glDrawElements the best OpenGL method for drawing an object that might consist of several thousand polygons? I might have been doing it wrong but I found that I had to maintain a very large array that usually held the same point 3 time (because of the different normal information at this point). Some of my objects with a 1000 polygons bloated to several thousand polygons in the rendering stage. I could probably average out the Normals and only store that information for that one single point but from what I remember there were problems with that. I’m rusty so this is kind of a basic question to get me on my way.

Share this post


Link to post
Share on other sites
Advertisement
Ok I’m sure you are suppose to use glDrawElements...

But what’s confusing me is if I have a vertex with 3 different normals then that means I can’t reuse that vertex, I’ll have to maintain 3 copies of that vertex with there unique normals. I’ve seen vertex arrays get really large because of this and I would like to know if there’s a simpler way of going about this.

Share this post


Link to post
Share on other sites
no, i'm afriad thats the only way of going about it, each set of data has to be unique per vertex and passed to the gpu like that as groups of data. a bit of extra space required in memory means a much easier and faster gpu design [smile]

btw, you might want to try glDrawRangeElements(), its a tad faster [smile]

Share this post


Link to post
Share on other sites
Thanks Phantom, wouldn’t think that a larger file would be a better gpu design but its nice to be know that there isn't another solution.

Share this post


Link to post
Share on other sites
well, the only other way would be to index multiple bits of data at different points, which would increase the complexity of the GPUs design and require more infomation to be pushed over the bus in the long run, where as a normal model wont end up with a huge proproption of the verts duplicated.

It also mucks around with post-T&L cache stuff as you dont get the benifit, plus its adviseable to pack you vertex data into blocks of at least 32bytes in size (which is the min AGP transfer size), which you couldnt do if you were reusing bits of the infomation around the place, instead it would have to fetch from various memory locations and it would stall horribly as things were streamed across.

All in all, belive it or not, duplicating is the best solution currently, maybe that'll change later, who knows [smile]

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!