XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

Problem with vertex buffer Map

Last post 05-05-2008 11:14 AM by Soth. 3 replies.
  • 05-04-2008 3:56 PM

    Problem with vertex buffer Map

    I try to get the data from a vertex buffer created before. The code is like this:

    struct VertexType

    {

    D3DXVECTOR3 Pos;

    D3DXVECTOR4 Col;

    };

    VertexType *pData = NULL;

    HRESULT hr = vertexBuffer->Map(D3D10_MAP_READ , 0, reinterpret_cast< void** >( &pData ));

    The problem is that the returned hr is an E_INVALIDARG.

    Can anybody help me with this problem?

  • 05-04-2008 8:55 PM In reply to

    Re: Problem with vertex buffer Map

    You need to post the code that returns the error (as well as the code that creates the vertex buffer).

    Also, run with the debug directX runtime, and logging turned on. What does the Output window say when you get the error?
    Jon Watte, Direct3D MVP kW X-port 3ds Max .X exporter kW Animation source code
  • 05-05-2008 7:15 AM In reply to

    Re: Problem with vertex buffer Map

    I thought to attach the correct code. Sorry.

     

    The code is the follow:

     

    struct VertexType

    {

    D3DXVECTOR3 Pos;

    D3DXVECTOR4 Col;

    };

     

    ...

    ...

    VertexType *pData = NULL;

    HRESULT hr = vertexBuffer->Map(D3D10_MAP_READ , 0, reinterpret_cast< void** >(&pData));

     

    The error is in the HRESULT that is not S_OK but E_INVALIDARG.

  • 05-05-2008 11:14 AM In reply to

    Re: Problem with vertex buffer Map

    Well, maybe you have created the buffer with a wrong flag. AFAIK only DYNAMIC and STAGING resources are mappable, besides you must set correct CPU flag (CPU_READ for dynamic). The most reliable way to check what is wrong is to enable the dubug layer as was mentioned before.
Page 1 of 1 (4 items) Previous Next