Jump to content
  • Advertisement
Sign in to follow this  
POLSKASH

memcpy() for Vertex Stuffing prob

This topic is 4817 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

I'm getting this compilation error on my memcpy() line: error C2664: 'memcpy' : cannot convert parameter 2 from 'sVertex' to 'const void *' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called memcpy(Ptr, Particles.Verts[j], sizeof(sVertex)); I'm looking at the DX RolePlaying games book, and I see the difference in our code. He's using an unnamed typedef struct for his vertex, but I'm using a named struct with a set() function as well. So the structure isn't of (void*) type, and it won't let me use a (void*) explicit typecast. Can anyone help me here?

Share this post


Link to post
Share on other sites
Advertisement
memcpy(Ptr, (void *)&Particles.Verts[j], sizeof(sVertex));

I'm assuming that Verts is an array of vertices, in which case [j] increments and dereferences the pointer, so you need to get the address back before casting to void*. I'd be surprised if that's the exact code in the book, chances are you made a mistake somewhere.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!