Archived

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

Saandman

CopyMemory doesn't work w/ my vertices

Recommended Posts

// say i''ve locked my static vertex buffer and claimed a buffer pointer (_pVertices) and pVertices contain the vertices I want to copy


// now this line here won''t work

CopyMemory((void *)&_pVertices[iOffset], (void *)pVertices, iOffset + _iBufferPosition);

// this does! 

for (int i = 0; i < (iOffset + _iBufferPosition); i++)
{
_pVertices[i]._vPosition = pVertices[i]._vPosition;
_pVertices[i]._d3dColor = pVertices[i]._d3dColor;
_pVertices[i]._vNormals = pVertices[i]._vNormals;
_pVertices[i]._vTexCoords = pVertices[i]._vTexCoords;
}
whyyyyyyyy ?

Share this post


Link to post
Share on other sites
I used to make the same mistake often, when i started c++ programming.
I learned the hard way, when blue screens showed up at every second build
I copied past vid card mem boundaries, though...

-Nik

Share this post


Link to post
Share on other sites
MSDN wasn''t available when i started to learn c++, only Borland''s badly organized man pages

Besides, in this particular function, i found that it''s easy enough to forget that it''s not type safe.

-Nik

Share this post


Link to post
Share on other sites