Jump to content
  • Advertisement
Sign in to follow this  
Twist wish

Drawing a terrain with Indexed VBO or what?

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

Hello! I've implemented a terrain made with many, many triangle strips and a vertex buffer object. The terrain is the tipical square with all the triangles being friendly:) To draw it I call glDrawArrays( GL_TRIANGLE_STRIP, , ); some times. I have all the points triplicated(moreless) in the arrays(vertex,texture coords and colors). It works but I'm not sure if it's a good way ( sure not :( ) I hope someone can enlight me about how I can do this without so many calls and some directions to don't have to use replicated data. I read something about DrawElements, but I'm not sure how to use it with this. Thanks and as always forgive my english.

Share this post


Link to post
Share on other sites
Advertisement
You should use an array to keep the vertex data with no duplicates and build an index list for every face. Then call glDrawElements instead of glDrawArray

Share this post


Link to post
Share on other sites
Quote:
Original post by b3rs3rk
You should use an array to keep the vertex data with no duplicates and build an index list for every face. Then call glDrawElements instead of glDrawArray


Thanks.I supposed I must have a look in some implementations.

But now the question is:

I use many triangle strips to draw the terrain.There's any way to concadenate some of them using some linking triangles?(I've heard something about degenerate triangles but I don't know if it's something only to use with LOD's or no) And if this method exists would I gain some perfomance in OpenGL?

Share this post


Link to post
Share on other sites
If you dont want to deal with LOD then your terrain is going to be static. Knowing this, it is probably best to use a display list. My experience has shown that using a strips with a display list is MUCH faster than an indexed array with glDrawElements.

Render your terrain using triangle strips for each row and pop it all into a list. If your terrain is huge you could just split it into a bunch of smaller quadrants using a quadtree or an octree and then clip out some of the quadrants that you dont need at render-time.

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!