• Advertisement
Sign in to follow this  

Quickly Modifying Direct Meshes

This topic is 2216 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone,

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...

[color=blue]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);


_catmullShellMesh = temp;


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement