DirectX tutorial #6

Links: Up

This sample corresponds to tutorial #6 in the Managed DirectX SDK, and was provided by Jack Palevich (thanks Jack!). The tutorial renders a mesh. You will need to have the Managed DirectX SDK installed, and to adjust the path settings in the Meshes.fsharpp project (if using Visual Studio) and/or set the MANAGED_DX environment variable (if using build.bat).

From the code: For advanced geometry, most apps will prefer to load pre-authored meshes from a file. Fortunately, when using meshes, D3DX does most of the work for this, parsing a geometry file and creating vertx buffers (and index buffers) for us. This tutorial shows how to use a D3DXMESH object, including loading it from a file and rendering it. One thing D3DX does not handle for us is the materials and textures for a mesh, so note that we have to handle those manually.

Note: one advanced (but nice) feature that we don't show here is that when cloning a mesh we can specify the FVF. So, regardless of how the mesh was authored, we can add/remove normals, add more texture coordinate sets (for multi-texturing), etc.

The F# code in dxlib.fs contains some common functions used in the context of DirectX programming. The F# code in Meshes.fs is the main code for the sample.