|
This thread on OpenGL.org discussed the problem of modeling package multiple vertex index streams (texture vertices versus position vertices) and what to do about it when you want to render with OpenGL (or Direct3D). Here's some untested code I wrote which purports to generate a stream of vertices which is drawable with a single index. Note that it does not do anything special to try and improve the vertex cache on modern cards or anything like that, but the idea works well enough anyway: |
Please note that this code is un-tested, but ought to work with minimal adjustment! I'm also placing this code in the public domain, so no license worries (as if it's big enough to worry about anyway :-) |
|
You can make this code smarter so it's not N squared complexity, but typically you'll only run this code when exporting a model from some modeler, so performance isn't critical. |