Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Question about order of VertexPositionTexture array

$
0
0

@Terran wrote:

I am new to monogame, so this question may be dumb...

class CodedCube:DrawableGameComponent
{

VertexPositionTexture[] floorVerts;
......

public override void Initialize()
{
floorVerts = new VertexPositionTexture[3];

        floorVerts[0].Position = new Vector3(-1, -1, 0);
        floorVerts[1].Position = new Vector3(0, 1, 0);
        floorVerts[2].Position = new Vector3(1, -1, 0);

....
}

.....
}

I successfully draw a triangle with code above by following a tutorial, however, if I switch the order of vertex position, like this:

        floorVerts[0].Position = new Vector3(0, 1, 0);  <- this was floorVerts[1]
        floorVerts[1].Position = new Vector3(-1, -1, 0); <- this was floorVerts[0]
        floorVerts[2].Position = new Vector3(1, -1, 0);

the triangle will not be drawn(or it is drawn but the camera cannot catch it? I tried to change the camera to several different position, but it does not work).

so I wonder about is there a specific order for vertices array? What is rule of the order?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles