#### Archived

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

# order to create vertices in a vertex buffer for a terrain?

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

## Recommended Posts

what order to i create the vertices? each terrain cell has two triangles, like this:
1          2
+----------+
| \        |
|    \     |
|      \   |
|        \ |
+----------+
4          3

right now, i''m doing for triangle one, 1, 3, 4. and triangle two is 1, 4, 3. even though i''m getting a solid square on top, there is still one triangle on the bottom. obviously this is not good, 1/3rd of my terrain will never be seen while this is there. i can''t figure out why its there either, especially if the top is solid, how its possible to have a third on teh bottom. so what order are you supposed to create vertices in?

##### Share on other sites
Sounds like you are using something like a triangle fan or a tri-strip when you are rendering your vertices. A triangle fan takes three initial points for the first triangle, then for every extra point you put down, you get a new triangle (in a fan-type shape!) where every triangle shares the centre point (the first point in the vertex buffer). The tri strip is similar except that they don''t all share the same centre point - it resuses the last edge created and then every extra point creates a new triangle of the last triangles last edge.

For a quick fix I suggest rendering as a tri list at first. You will later want to move towards either the tri-list or the tri-fan as they reuse vertices (and so are more efficient)

Rory.

##### Share on other sites
it is a tri list, i just need to know what order to create vertices so they don''t get backface culled.

##### Share on other sites
That depends on how you have set the culling. You can set the culling to clockwise or counter-clockwise. clockwise culls back faces with clockwise ordered verts, counter-clockwise does the reverse. So make sure that you specify the verts in the correct order! By default the culling is set to counter clockwise. If you are seeing tris that aren''t being rendered then reverse the order you specify them in the vertex buffer.

Rory.

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013646
×