Adding vertices to a D3DXMesh..

Started by
0 comments, last by aker_jus 21 years, 3 months ago
I am trying to extend my mesh class (remember my demo?), by giving the ability to add vertices to an already loaded mesh. I specify D3DXMESH_DYNAMIC for the mesh flags without MANAGED, so it can be correct. Here is my add vertex code: [cpp] void CRTStaticMesh::AddVertex(Vec3* vertex) { if (meshes.bProgressive) return; Vec3* vertices=NULL; //get the VB meshes.pMesh->GetVertexBuffer(&meshes.pVB); meshes.pVB->Lock(0, 0, (void**)&vertices, D3DLOCK_DISCARD); memcpy(vertices, vertex, sizeof(vertex)); meshes.pVB->Unlock(); SR(meshes.pVB); } [/cpp] Also, should I lock my VB with DISCARD or NOSYSLOCK? I am sure that there will be no disp mode changes, so whats the difference? Btw, the above code isnt adding the vertex, meaning I cannot see it rendered along with the other vertices. Whats wrong here? Thanks!
GraphicsWare|RenderTechhttp://www.graphicsware.com3D Graphics & Solutions
Advertisement
Anyone?
GraphicsWare|RenderTechhttp://www.graphicsware.com3D Graphics & Solutions

This topic is closed to new replies.

Advertisement