I am trying to create a 3D file loading function. I have a structure of my vertices. I then dynamically create an array of these to hold the values from the file :
MYVERTEX *VertArray;
VertArray = new MYVERTEX[nNumVerts];
After filling in the infromation from the file, I then try to copy my data from the dynamic array to my locked vertex buffer by using memcpy :
memcpy(&pVertices, &VertArray, sizeof(MYVERTEX) * nNumVerts);
When I reach this line in my program, it causes a GPF in my program. I assume that this is because I used the new operator and I am just accessing the data area wrong. It does work when I create a static array instead of dynamic, but that seems like a waste to me :
MYVERTEX VertArray[255];
memcpy(&pVertices, VertArray, sizeof(MYVERTEX) * nNumVerts);
I have also tried taking out the
& from the second parameter,
&VertArray in the memcpy, but that also causes problems. I don't know what I am doing wrong. Any help would be much appreciated! Thanks for your time!
BTW, sorry about the long post. I just wanted to make sure that I was clear!
"I kinda think, therefore, I kinda... am?"
Edited by - psychocatt on January 16, 2001 11:18:32 AM