未处理的异常directX [英] Unhandled exception directX
本文介绍了未处理的异常directX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到此错误
DirectXProgram.exe中0x012c17d2处的未处理异常:0xC0000005:访问冲突读取位置0x00000000。
这是我的代码..
I get this error
Unhandled exception at 0x012c17d2 in DirectXProgram.exe: 0xC0000005: Access violation reading location 0x00000000.
This is my code..
bool InitScene()
{
//The vertices for the triangle
Vertex vertices[] =
{
D3DXVECTOR3( 0.0f, 0.5f, 0.5f ),
D3DXVECTOR3( 0.5f, -0.5f, 0.5f ),
D3DXVECTOR3( -0.5f, -0.5f, 0.5f ),
};
//Filling the buffer descriptor
D3D10_BUFFER_DESC bd;
bd.Usage = D3D10_USAGE_DEFAULT;
bd.ByteWidth = sizeof( Vertex ) * 3;
bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = 0;
bd.MiscFlags = 0;
//Sub resource data for the Input Assembler
D3D10_SUBRESOURCE_DATA InitData;
InitData.pSysMem = vertices;
d3dDevice->CreateBuffer( &bd, &InitData, &VertexBuffer );
unsigned int stride = sizeof( Vertex );
unsigned int offset = 0;
d3dDevice->IASetVertexBuffers( 0, 1, &VertexBuffer, &stride, &offset );
D3DX10CreateEffectFromFile( "vertex.fx", NULL, NULL, "fx_4_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
d3dDevice, NULL, NULL, &FX, NULL, NULL );
Technique = FX->GetTechniqueByName( "Tech" );
D3D10_PASS_DESC PassDesc;
Technique->GetPassByIndex( 0 )->GetDesc( &PassDesc );
d3dDevice->CreateInputLayout( layout, 1, PassDesc.pIAInputSignature,
PassDesc.IAInputSignatureSize, &VertexLayout );
d3dDevice->IASetInputLayout( VertexLayout );
d3dDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
return true;
}
休息时间 Technique = FX-> GetTechniqueByName(Tech );
推荐答案
根据您提供的信息,您不太可能得到过于具体的答案,但如果您的意思是它在FX上崩溃 - > Get ... by有一个中断...,然后很可能你的D3DX10CreateEffectFromFile(...)调用失败,检查 HRESULT [ ^ ]它返回以查看可能出错的地方。
With the info you provided it's unlikely you will get a too specific answer, but if you mean it crashes on FX->Get... by "There is a break at...", then most likely your D3DX10CreateEffectFromFile(...) call fails, examine the HRESULT[^] it returns to see what might be wrong.
这篇关于未处理的异常directX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文