Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Directx 断言错误:_BLOCK_TYPE_有效(pHead->;nBlockUse)_Directx_Assertion_Indices_Id3dxmesh - Fatal编程技术网

Directx 断言错误:_BLOCK_TYPE_有效(pHead->;nBlockUse)

Directx 断言错误:_BLOCK_TYPE_有效(pHead->;nBlockUse),directx,assertion,indices,id3dxmesh,Directx,Assertion,Indices,Id3dxmesh,我在以下代码的标题中得到错误: std::vector<short> GetIndicesFromID3DXMesh(ID3DXMesh* model) { //LPVOID * ppData; DWORD stride = sizeof(short); BYTE* ibptr = NULL; short* indices = new short[model->GetNumFaces() * 3]; std::vector<

我在以下代码的标题中得到错误:

  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;
}
std::向量getIndicatesFromID3DXMESH(ID3DXMesh*模型)
{
//LPVOID*ppData;
DWORD stride=sizeof(短);
字节*ibptr=NULL;
short*index=newshort[model->GetNumFaces()*3];
std::向量拷贝;
模型->锁定索引缓冲(0,(LPVOID*)和索引);
对于(大小i=0;iGetNumFaces()*3;i++)
{
复制。推回(索引[i]);
}
模型->解锁索引缓冲();
删除[]个索引;
返回副本;
}
在第行删除[]个索引


我不知道我为什么会得到它,我不知道我是如何得到它的,我可以不得到它吗?

不要为索引分配空间。DirectX执行分配,然后在调用unlock时释放它

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