Last vertex in vertex buffer not being set

73 views Asked by At

I'm attempting to render a sphere in Direct11 using SharpDX. I have correctly read in the OBJ model, created the vertex buffers, and set the buffers on the context for rendering.

My problem is that everything rendering perfectly EXCEPT the very last vertex, which is rendered as if it were at 0, 0, 0. Below is a screen shot of this: enter image description here

I have checked the vectors that get used when creating the buffers and there is no missing data in there, I even changed the last element in the array like this:

vertexBufferArray[vertexBufferArray.Length - 1].X = 1.0f;

and had no result. Whereas if I change the second to last element like this:

vertexBufferArray[vertexBufferArray.Length - 2].X = 1.0f;

I get this result: enter image description here

The vertex count that I am passing to the render call is correct because if I pass it VertexCount - 1, I don't get the last triangle at all, and if I pass it VertexCount + 100, nothing changes at all.

Any ideas?

1

There are 1 answers

0
Joseph Little On BEST ANSWER

As usual I end up fixing the problem 10 mins after I make a big post about it.

The problem was my Input Assembler, my input elements for POSITION and NORMAL were of Format.R32G32B32A32_Float, when they should have been Format.R32G32B32_Float since I was giving my vertices in as Vector3s.