Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

pag

terrain and vertex array stuff...

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

I'm trying to store the vertices in an array so that I later can easily send them to openGL with a simple for loop or later of course with a vertex list. And this is done using triangle strips. However after alot of trying and failuers this seems impossible, at least the way I want it done. The thing thats not working is that every second row the triangles get turned around, that is facing the wrong direction. The output looks like this: This is what I get:
o-----o-----o-----o-----o
| \   | \   | \   | \   |
|  \  |  \  |  \  |  \  |
|   \ |   \ |   \ |   \ |
o-----o-----o-----o-----o
|   / |   / |   / |   / |
|  /  |  /  |  /  |  /  |
| /   | /   | /   | /   |
o-----o-----o-----o-----o
| \   | \   | \   | \   |
|  \  |  \  |  \  |  \  |
|   \ |   \ |   \ |   \ |
o-----o-----o-----o-----o
   
And this doesn't look right to me even though it works, however I've not tried this with textures yet. Perhaps arranging the vertices so that you easily can render them with a simple loop is impossible with triangle strips? Oh, and the simple loop I use to render this is:
glBegin(GL_TRIANGLE_STRIP);
 for(int c=0; c
Any help, ideas is very much appreciated!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
if it works, go with it. even though it doesnt look right now it will once you''ve been doing it for a while

james

Share this post


Link to post
Share on other sites
A common trick is to insert degenerated triangles ( = zero area triangles) at the end of each row. They are invisible, and simply used to make the strip connection between the individual rows.

Share this post


Link to post
Share on other sites

  • 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!