[MDX] Generate a mesh from a vertex buffer?

Started by
3 comments, last by Moe 17 years, 7 months ago
Hey everyone... Lately I have been starting to play around with Managed DirectX. I have dug through a few tutorials and now have my Direct3D initialization code so that it handles different resolutions, multisample types, and fullscreen or windowed mode. I think I am about ready to do some actual rendering. So here is the question: Is it possible to load in mesh data into a vertex buffer (say, from a .txt file) and put it into a Mesh? (By Mesh, I mean the same classes that the .x files use). The reason I ask is that there seems to be a lot of good functionality for Meshes, such as functions like NormalizeNormals, and the ability to work with Optimized Meshes and Progressive Meshes. It would be a bit of a shame to simply ingore this functionality of the Mesh class and code a bunch of it myself if there was a simple way to load in a Mesh using data from one or more vertex buffers.
Advertisement
isn't there some sort of example of this in the DirctX SDK??
say:

{SDK root}\Samples\C++\Direct3D\MeshFromOBJ

(exe:)

{SDK root}\Samples\C++\Direct3D\Bin\x86\MeshFromOBJ.exe

sorry if I've misread your question.

Note: It loads from a .obj file, but it's actually just vertex info in text (you can open it with Notepad)

(edit) And just yet I saw it.. you were looking for managed stuff, sorry.
No problems. I will have to do somoe more digging into this.
In case you haven't found it yet, you can use the VertexBuffer property on the mesh to retrieve a vertex buffer to put your data in directly. The SDK docs provide a simple example for that and over here you can find a more elaborate one that works with multiple attribute sets.

Hope this helps :)
Rim van Wersch [ MDXInfo ] [ XNAInfo ] [ YouTube ] - Do yourself a favor and bookmark this excellent free online D3D/shader book!
Many thanks!

This topic is closed to new replies.

Advertisement