Jump to content
• Advertisement

Public Group

# culling and index buffers

This topic is 2787 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 have a list of vertex coord (x,y,z)
from 0 to 15
now i must create a vertex buffer and index buffer from a list of indices and create triangles.
Is different modify as the list of vertices as say the indexes(change the order in the vertices list) and create an index buffer sequential 0 1 2 3 4 5
and leave the vertices list as it is and modify the index buffer for example 2 1 0 5 4 3 for the culling?
Because i have to show only ccw triangles.
Thanks

#### Share this post

##### Share on other sites
Advertisement

Hello.
I have a list of vertex coord (x,y,z)
from 0 to 15
now i must create a vertex buffer and index buffer from a list of indices and create triangles.
Is different modify as the list of vertices as say the indexes(change the order in the vertices list) and create an index buffer sequential 0 1 2 3 4 5
and leave the vertices list as it is and modify the index buffer for example 2 1 0 5 4 3 for the culling?
Because i have to show only ccw triangles.
Thanks

Yes that is the purpose of an index buffer indeed, it stores the indices that are used by the GPU to retrieve the vertex data out of the vertex buffer. So if point 1,2,3,4 describe a rectangle you would need to create an index buffer of length 6 to describe two triangles, 1,2,4 and 4,3,2. The ordering of these indecis should be specified in the ordering off culling.

#### Share this post

##### Share on other sites
thanks, but if i have a vertex buffer with the points: 1,2,4,4,3,2 and an index buffer that have 1,2,3,4,5,6 i draw the two triangles but the cull is correct?
very thanks.

#### Share this post

##### Share on other sites

thanks, but if i have a vertex buffer with the points: 1,2,4,4,3,2 and an index buffer that have 1,2,3,4,5,6 i draw the two triangles but the cull is correct?
very thanks.

Yes but the vertex buffer in that case should only contain 4 verts (1,2,3,4) and not 6 and the index buffer should be 0,1,3,3,2,1; it's better to have bigger index buffers than vertex buffers. The data in index buffers for individual elements is smaller then the data size for vertex buffers, overall it means you upload less data to the GPU and that is what you want. Index buffers exist so that we don't have to create duplicate vertices in our vertex buffers.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
• Advertisement

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633769
• Total Posts
3013758
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!