Hello guys, im making a new 3D game, i made a floor model, but it dowsnt draw the fourth triangle.
Here is the source: http://EvoGame.codeplex.com
Here is the model:
vertecies.Add(new VertexPositionNormalTexture(new Vector3(-0.5f, -0.5f, 0.5f), Vector3.Up, new Vector2(0, 1)));
vertecies.Add(new VertexPositionNormalTexture(new Vector3(-0.5f, -0.5f, -0.5f), Vector3.Up, new Vector2(0, 0)));
vertecies.Add(new VertexPositionNormalTexture(new Vector3(0.5f, -0.5f, 0.5f), Vector3.Up, new Vector2(1, 0)));
vertecies.Add(new VertexPositionNormalTexture(new Vector3(0.5f, -0.5f, -0.5f), Vector3.Up, new Vector2(1, 0)));
vertecies.Add(new VertexPositionNormalTexture(new Vector3(0.5f, -0.5f, 0.5f), Vector3.Up, new Vector2(1, 1)));
vertecies.Add(new VertexPositionNormalTexture(new Vector3(-0.5f, -0.5f, 0.5f), Vector3.Up, new Vector2(0, 1)));
Thanks,
Andrei
I cant get my floor model to work properly
Ok since you are declaring your vertices manual I suppose you do the same with the indices. I don't know why you need six vertices to make a floor or which vertices are used for the fourth triangle but my first guess is that its happening because of the cullmode. Write:
GraphicsDevice.RasterizerState = RasterizerState.CullNone;
If the triangle shows up you have to declare it with the negated draworder.
GraphicsDevice.RasterizerState = RasterizerState.CullNone;
If the triangle shows up you have to declare it with the negated draworder.
You masked your problem by adding another triangle, actually.
If I sit down and plot out the points you indicate in world space, I get two overlapping triangles with a missing chunk. And I can see why your third triangle "fixed" it.
[attachment=11247:explain.jpg]
If you don't want to use indexed drawing (which would let you use just 4 vertices) then you just need to change the position vector of your last (6th) vertex in the initial list to
(-0.5, -0.5, -0.5) and texture coords to (0,0) (so that it'll show up next to vertex "2").
If I sit down and plot out the points you indicate in world space, I get two overlapping triangles with a missing chunk. And I can see why your third triangle "fixed" it.
[attachment=11247:explain.jpg]
If you don't want to use indexed drawing (which would let you use just 4 vertices) then you just need to change the position vector of your last (6th) vertex in the initial list to
(-0.5, -0.5, -0.5) and texture coords to (0,0) (so that it'll show up next to vertex "2").
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement