Sign in to follow this  

[solved]D3DX10: ID3DX10Mesh::SetIndexBuffer: invalid buffer pointer

This topic is 3375 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 have hardcoded a cubes vertices and indices to load into an ID3DX10Mesh object just to get an idea of how it works, I have the following code inside an initScene() function, however, when i call meshPtr->DrawSubset(0) in my renderScene() function I get the error: D3DX10: ID3DX10Mesh::SetIndexBuffer: invalid buffer pointer

    vector<D3DXVECTOR3> vect;
    vect.push_back(D3DXVECTOR3(0.0,  0.0,  0.0));
    vect.push_back(D3DXVECTOR3(0.0,  0.0,  1.0));
    vect.push_back(D3DXVECTOR3(0.0,  1.0,  0.0));
    vect.push_back(D3DXVECTOR3(0.0,  1.0,  1.0));
    vect.push_back(D3DXVECTOR3(1.0,  0.0,  0.0));
    vect.push_back(D3DXVECTOR3(1.0,  0.0,  1.0));
    vect.push_back(D3DXVECTOR3(1.0,  1.0,  0.0));
    vect.push_back(D3DXVECTOR3(1.0,  1.0,  1.0));

    UINT indices [36] = { 0,6,4,0,2,6,0,3,2,0,1,3,2,7,6,2,3,7,4,6,7,4,7,5,0,4,5,0,5,1,1,5,7,1,7,3 };

    D3D10_INPUT_ELEMENT_DESC layout[ = {{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}};

    HRESULT hr = D3DX10CreateMesh(
      g_pd3dDevice,
      layout,
      sizeof(layout) / sizeof(layout[0]),
      "POSITION",
      8,
      12,
      D3DX10_MESH_32_BIT,
      &meshPtr
    );

    meshPtr->SetVertexData(0, vect[0]);
    meshPtr->SetIndexData(0, indices[0]);
    meshPtr->CommitToDevice();
}
any ideas as to what i am doing wrong would be much appreciated! [Edited by - FoxMulder900 on September 17, 2008 6:06:37 PM]

Share this post


Link to post
Share on other sites

This topic is 3375 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this