Question

Je reçois l'erreur dans le titre dans le code suivant:

  std::vector<short> GetIndicesFromID3DXMesh(ID3DXMesh* model)
{
    //LPVOID * ppData;
    DWORD stride = sizeof(short);
    BYTE* ibptr = NULL;

    short* indices = new short[model->GetNumFaces() * 3];

    std::vector<short> copy;

    model->LockIndexBuffer(0, (LPVOID*)&indices);

    for(size_t i = 0; i < model->GetNumFaces() * 3; i++)
    {
        copy.push_back(indices[i]);
    }

    model->UnlockIndexBuffer();

    delete []indices;
    return copy;
}

A la ligne, supprimer [] indices

Je ne sais pas pourquoi je l'obtiens, je ne sais pas comment je l'obtenir, puis-je obtenir pas?

Était-ce utile?

La solution

Ne pas allouer l'espace pour vos indices. DirectX ne l'allocation et libère alors quand vous appelez déverrouiller.

short* indices = NULL;
model->LockIndexBuffer(0, (LPVOID*)&indices);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top