Directx9 Index Buffers & Multiple Streams
Im trying to write up a 3DS Loader, which has an 开发者_C百科OpenGL rendering implementation for use in my generic rendering system.
The problem here is I have vertices indexed to one array, and texture coordinates indexed to another. I dont want to generate a new set of indexes and original vertices by checking each vertexes combination of coordinates and texture coordinates, so how do I specify the two arrays in buffers in directx optimally?
What I'd like is to have 3 vertex buffers, one for vertices, one for texture coordinates, and one for vertex normals. Then I would have index buffers for all three. I don't know how I would do this.
I'm working in directx9 and C++
The thing is as far as the graphics card is concerned if 2 vertices have the same position and different tex coordinates (or different any vertex element) then they are different vertices. They will be stored on the card with the position/tex coord duplicated whatever you do under OpenGL (The driver will just expand the vertices implicitly). DirectX forces you to do this.
Multiple Streams are slightly different but expand to the same thing. ie you only have one index value into both streams.
So, optimally, you need to expand both lists into one big list and set up the, single list of, indices appropriately.
精彩评论