So I tried a number of combinations to resolve my issue and i think my brain has now gone dead.
I basically have a mesh where the indices and vertices are continuously changing. When i use the following code the mesh appears once and then whne createmesh() method is executed again it disappears. I have attached an image of the wire frame which shows the vertices and indices are different between each call of the createmesh() method.
Now if i create a new instance of _catmullShellMesh in the createmesh() i dont have a problem but that means i have to dipose of the mesh each time the method is called which leads to memory corruption problems.
I believe problem stems from the cloning and computing of the normals because if i bypass this code i get the correct wireframe but obviously no colour.
A fresh set of eyes would be much appreciated.
Thanks in advance...
public class DynamicShell
{
private Mesh _catmullShellMesh;
public DynamicShell(...)
{
_catmullShellMesh = new Mesh(1500, _maxMeshVertices, MeshFlags.Managed, CustomVertex.PositionColored.Format, _DXDevice);
}
private void CreateMesh()
{
_catmullShellMesh.VertexBuffer.SetData(_catmullVertexData, 0, LockFlags.Discard);
_catmullShellMesh.IndexBuffer.SetData(_catmullIndexArray.ToArray(), 0, LockFlags.Discard);
Mesh temp = _catmullShellMesh.Clone(_catmullShellMesh.Options.Value, CustomVertex.PositionNormal.Format, _DXDevice);
temp.ComputeNormals();
_catmullShellMesh.Dispose();
_catmullShellMesh = temp;
}
}


















