Archived

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

pag

terrain and vertex array stuff...

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