0

I get

Unhandled exception at 0x004687b4 in D3DTest.exe: 0xC0000005: Access violation reading location 0x00000000.    

the error is at:

m_d3dDevice->CreateIndexBuffer(sizeof(short)*CHUNK_PRIMITIVES*3,D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &m_ib, NULL);    

Now I checked m_d3dDevice and it's all OK,everything works properly if I don't create the buffer. m_ib is also propery created before being used in that function:

LPDIRECT3DVERTEXBUFFER9 m_vb;
    m_vb = NULL;

I don't think anything else could be causing the problem.I'm confused.

4

1 回答 1

0

尝试从 DirectX 控制面板启用调试运行时,如果有任何警告和错误,它将向您显示,并始终检查 DX 函数的返回代码。

显示创建索引缓冲区的整个函数的代码也会有所帮助。

于 2012-04-30T21:43:58.937 回答