Jump to content
  • Advertisement

Archived

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

Funkymunky

Locking VBuffer and passing the data to fill out

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

Alright, I have two separate classes, a loader and an object (because there are multiple objects). So the loader holds the vertex buffer, and needs to obtain the vertices from 3 different objects. After I lock the vertex buffer, how do I take that ppbData parameter that I normally fill out with the vertex data and pass it to the other classes function which can then fill it out? right now it crashes after the three fill it out, on the drawindexedprimitive call (invalid data i guess).

Share this post


Link to post
Share on other sites
Advertisement
First I lock both the vertex buffer and index buffer,
(vbuffer->Lock(0, sizeof(MyVertex)*numverts, (BYTE**)&pVertices, 0),
then I passit to a function who has a parameter of (MyVertex *verts), then I try to access it like a normal array in the function using the left and right brackets.
Next I (A) unlock the index and vertex buffer

so (B) in the function I'm using


void AddVerts(MyVertex *verts, int numverts)
{
for(int i=0; i<numberobjectverts; i++)
{
verts[i+numverts]=objectverts[i];
...



The thing that seems strange to me is the I'm using the BYTE** pVertices which I return from vbuffer->Lock( so should I be passing a pointer to a pointer of an array or something? It's been referenced to a memory address or something from the Lock call maybe?

[edited by - Funkymunky on June 5, 2004 11:44:21 AM]

Share this post


Link to post
Share on other sites
Ok as far as I can tell it''s filling out the vertices and indices properly, but it crashes the program on the DrawIndexedPrimitive call. I can''t get an HRESULT out of it...any ideas?

Share this post


Link to post
Share on other sites

  • 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!