#### Archived

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

# Question about vertexes ordering [nearly newbie]

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

## Recommended Posts

Hi at all.. I''ve a simple question..... If I read the vertexes of a cube, I get this data:
-4,-4,-4
4,-4,4
-4,-4,4
4,-4,-4
-4,4,-4
4,4,4
4,4,-4
-4,4,4
-4,-4,-4
4,4,-4
4,-4,-4
-4,4,-4
4,-4,4
4,4,-4
4,-4,4
-4,4,4
-4,-4,4
4,4,4
-4,-4,4
-4,4,-4
4,-4,-4
4,4,4
-4,-4,-4
-4,4,4

How do I read these?? Each three vertexes I get a triangle? i.e (-4,-4,-4) plus (4,-4,4) plus (-4,-4,4) is the first triangle... (4,-4,-4) plus (-4,4,-4) plus (4,4,4) is the secon triangle ecc ecc? I must do a collision system versus triangle, but I am not sure that data above are that that I think. Bye...

##### Share on other sites
quote:

How do I read these??
Each three vertexes I get a triangle?
i.e (-4,-4,-4) plus (4,-4,4) plus (-4,-4,4) is the first triangle... (4,-4,-4) plus (-4,4,-4) plus (4,4,4) is the secon triangle ecc ecc?

For a non-indexed triangle list. Yes . That''s the way the vertices in a non-indexed primitive will be layed out.

Usually the vertices represent the clockwise direction around the polygon so you can determine which way the polygon is facing from that (it''s how backface culling works).

For "indexed" primitives, you also have a list of indices, where each index tells you the location to fetch a vertex within the list of vertices. So with indexed primitives, a triangle is reprsented by 3 consecutive *indices*.

The advantage of indexed primitives is you can reuse any vertex value that gets used more than once, for example in your data, "-4,-4,-4" is used 3 times. With an indexed primitive you only need to store it once so less memory is used and less transformation & lighting work is required.

You''ll find details of these concepts in most 3D graphics textbooks and information about how it relates to D3D in the D3D documentation:

DirectX Graphics ->
Programming Guide ->
Getting Started with Direct3D ->
Devices ->
Device-Supported Primitive Types

DirectX Graphics ->
Programming Guide ->
Getting Started with Direct3D ->
Object Geometry

etc

--
Simon O''Connor
ex -Creative Asylum
Programmer &
Microsoft MVP

##### Share on other sites
Thank you Simon... it''s a useful explanation =)
I''ll try to use a index.

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
14
5. 5

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

• Total Topics
633743
• Total Posts
3013643
×