This topic is now archived and is closed to further replies.


coping vertex data to vertex vb in a loop

Recommended Posts

i have a class hierarchy. (Object->frame->geometry->point) geometry has vertex information pos nor color etc.(DX3D vectors and floats) the point class constructor takes arguments for vertix quantity and pointers to d3dxvectors for vertex values. example: Vertex = new direct3dxvector3[vertex-Quantity]. the same for color value. the vertex size is already defined. My point is sense the geometry is not a seperate clsss or struct i have to do something like this when it comes to copying the Vertices to vb buffer. BYTE* pVertices; Result = pVertexBuffer->Lock(0,0,&pVertices,D3DLOCK_DISCARD); BYTE* pOffset = pVertices; for (int i = 0; i < vertex-Quantity; i++) { memcpy(pCurrentVertex,Vertex++,3*sizeof(float)); pOffset += VertexSize; } i got this idea from the zen of direct3d programing book but the book uses seperate class for vertex struct and a list with while loop; i cant get this approach to work one soul to use many lives to live! [edited by - kaos2000 on August 17, 2002 9:01:20 PM]

Share this post

Link to post
Share on other sites