Original Post
I''m having trouble with the Managed D3D PatchMesh class; when I tell it to tessellate, it throws a null reference exception.
Are there any tutorials where I can get an idea of how to properly use the PatchMesh class? Here''s my code:
PatchMesh m = PatchMesh.CreateNPatchMesh(mBase); int faces = (int)(mBase.NumberFaces * Math.Pow(mDetail,1)), vertices = (int)(mBase.NumberVertices * Math.Pow(mDetail,1)); mMesh = new Direct3D.Mesh( faces, vertices, MeshFlags.Managed, mBase.VertexFormat, mRenderer.Device); // Direct3D.Mesh.TessellateNPatches(tmp, mAdj, 2, true); m.Tessellate(mDetail, (Mesh)mMesh); m.Dispose();