简体   繁体   中英

Last vertex in vertex buffer not being set

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: 在此处输入图片说明

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: 在此处输入图片说明

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM