3 index buffers

后端 未结 2 1596
灰色年华
灰色年华 2021-01-01 23:58

So, in both D3D and OpenGL there\'s ability to draw from an index buffer.

The OBJ file format however does something weird. It specifies a bunch of vertices like:

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-02 00:43

    What you really want to be doing (speaking from the D3D side of the fence, I don't know OpenGL sorry) is loading the OBJ in to an array of custom vertex format--that way you have a struct with the index, vertex, normal and tex coord in it and you can just render it using one DrawIndexedPrimtive.

    Am I misunderstanding your problem definition here? I think you need to give a little more detail--you shouldn't need multiple index buffers to render a single OBJ file (unless you are deliberately batching it). If that is the case, that you are deliberately batching it, then you should take a look at the arguments to DrawIndexedPrimitive which allow you to specify an offset in to the VB to use.

提交回复
热议问题