Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Problem wit VertexBuffer in DX; c++

Hi. Does anyone know how to get to the coords from the vertexBuffer? I only found a sollution written in c#
but I'm searching for one in c++. There's lot of stuff bout writing into the Vbuffer on the internet but I can't find anything about reading. All I know is that I can get a pointer to a memory buffer containing the returned vertex data by using the lock method. In c# there's a graphicStream type object so it looks pretty simple, but I've decided that I won't change the language I use just cuz i'm stuck for 3 days (at least not before asking somebody how to deal with this "tiny" issue) :]. BTW i'm talkin bout directx :)

Thanks in advance for any help


  • kidkidkidkid Member Posts: 1
    I don't know what you meant yet.
    In my opinion maybe this following code will help you.

    // create the vertex and store the pointer into yourBuffer, which is created globally

    VOID* pVoid; // the void pointer
    yourBuffer->Lock(0, 0, (void**)&pVoid, 0); // lock the vertex buffer
    memcpy(pVoid, yourVertex, sizeof(yourVertex)); // copy the vertices to the locked buffer
    yourBuffer->Unlock(); // unlock the vertex buffer

Sign In or Register to comment.