#### Archived

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

# Question about vertexes ordering [nearly newbie]

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

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.

• ### Forum Statistics

• Total Topics
628402
• Total Posts
2982471

• 9
• 10
• 9
• 19
• 24