3 index buffers

后端 未结 2 1566
灰色年华
灰色年华 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.

    0 讨论(0)
  • 2021-01-02 00:54

    OBJ was not designed to map to OpenGL or DirectX.

    Everything you said is true, and no, it's not possible to use per-attribute indices.

    You have to convert the OBJ representation to something that only uses a single index per vertex (possibly duplicating some vertex data along the way).

    0 讨论(0)
提交回复
热议问题