断言错误:_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
我在以下代码中的标题中收到错误:
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;
}
在行delete[]indices 处,
我不知道为什么会得到它,我不知道如何得到它,我不能得到它吗?
I get the error in the title in the following code:
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;
}
At the line delete[]indices
I don't know why I get it, I don't know how I get it, can i not get it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要为索引分配空间。 DirectX 进行分配,然后在调用解锁时释放它。
Don't allocate the space for your indices. DirectX does the allocation and then frees it when you call unlock.