Thread: VertexBuffer->Lock and stl::vector

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    132

    VertexBuffer->Lock and stl::vector

    I am trying to use IDirect3DVertexBuffer9::Lock and pass an stl::vector containing my vertex structure, as data, instead of a VERTEX3* data pointer.

    Can someone help me, becuase it crashes. Here is my code:
    PHP Code:
        meshes.pVB->Lock(iNextVertexData,iDataSize,(void**)&meshes.pVertices,flags);
            
    memcpy((void*)&meshes.pVertices.back(),&ver,iDataSize);
        
    meshes.pVB->Unlock(); 
    Ignore the iNextVertexData and iData variables, I would be grateful if you helped me for the Lock and 3rd parameter only. It crashes on memcpy, so I guess a proper lock isnt done.
    Y3K Network http://www.y3knetwork.com
    Bringing the software of the future on the net.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Let me see your vector declaration.

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    132
    I figured it out, thanks anyway. I used a temporary void* to store my vertices.
    Y3K Network http://www.y3knetwork.com
    Bringing the software of the future on the net.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stl::vector problems (memory?)
    By aker_y3k in forum C++ Programming
    Replies: 3
    Last Post: 04-15-2003, 11:21 AM