Need help on access violation error
I am getting an access violation in D3D8.dll:
Loaded ''C:\WINDOWS\SYSTEM\WINMM.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\D3DXOF.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\NTDLL.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\DDRAW.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\VERSION.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\ADVAPI32.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\GDI32.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\KERNEL32.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\USER32.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\D3D8.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\HOOK98.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\MSVCRT.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\GAMEUTIL.DLL'', no matching symbolic information found.
Loaded ''C:\WINDOWS\SYSTEM\d3dref8.dll'', no matching symbolic information found.
D3DX: (INFO) Using 3DNow Instructions
First-chance exception in VertexShader.exe (D3D8.DLL): 0xC0000005: Access Violation.
The program ''C:\Program Files\Microsoft Visual Studio\MyProjects\View\Debug\VertexShader.exe'' has exited with code 0 (0x0).
on this line of code:
pd3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, sector[sec].polygon[poly].numverticies-2 )
as well as any other DrawPrimitves.
How can I fix this?
Thanks...
I would assume so.
These commands work fine:
pd3dDevice->SetStreamSource( 0, sector[sec].polygon[poly].vertbuf, sizeof(LEVELVERTEX) );
m_pd3dDevice->CreateVertexBuffer
m_pd3dDevice->SetTransform( D3DTS_VIEW, &m_matView );
and others.
This is unless there is something else when it comes to DrawPimitive calls.
These commands work fine:
pd3dDevice->SetStreamSource( 0, sector[sec].polygon[poly].vertbuf, sizeof(LEVELVERTEX) );
m_pd3dDevice->CreateVertexBuffer
m_pd3dDevice->SetTransform( D3DTS_VIEW, &m_matView );
and others.
This is unless there is something else when it comes to DrawPimitive calls.
m_pd3dDevice <---> pd3dDevice
????
Are these two something different? That would explain it...
Joakim Asplund
http://megajocke.y2.org
????
Are these two something different? That would explain it...
Joakim Asplund
http://megajocke.y2.org
HRESULT CLevelInfo::Render(LPDIRECT3DDEVICE8 pd3dDevice, CShader* Shader, D3DXVECTOR3 eye)
{
.
.
.
pd3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, sector[sec].polygon[poly].numverticies-2 )
}
m_pLevelInfo->Render( m_pd3dDevice, m_pShader, g_vEye );
{
.
.
.
pd3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, sector[sec].polygon[poly].numverticies-2 )
}
m_pLevelInfo->Render( m_pd3dDevice, m_pShader, g_vEye );
Could you please post your entire render code? Have you verified that your numVertices value is correct?
HRESULT CMyD3DApplication::Render(){ // Clear the backbuffer m_pd3dDevice->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, //0x000000ff, 1.0f, 0L ); 0x00334C66, 1.0f, 0L ); // Begin the scene if( SUCCEEDED( m_pd3dDevice->BeginScene() ) ) { m_pShader->pPixelProgramContainer->SetShaderActive(); m_pShader->pPixelProgramContainer->SetTextureStageState(m_pShader->pixel1_tex0_iter, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP); m_pShader->pPixelProgramContainer->SetTextureStageState(m_pShader->pixel1_tex0_iter, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP); m_pShader->pPixelProgramContainer->SetTextureStageState(m_pShader->pixel1_tex0_iter, D3DTSS_MINFILTER, D3DTEXF_LINEAR); m_pShader->pPixelProgramContainer->SetTextureStageState(m_pShader->pixel1_tex0_iter, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); m_pShader->pPixelProgramContainer->SetTextureStageState(m_pShader->pixel1_tex0_iter, D3DTSS_MIPFILTER, D3DTEXF_LINEAR);// m_pShader->pPixelProgramContainer->SetTextureWrapMode(pixel1_tex0_iter, 0); m_pShader->pPixelProgramContainer->SetTexture(m_pShader->pixel1_normalmap_iter, m_CubeMap); m_pShader->pPixelProgramContainer->SetTextureStageState(m_pShader->pixel1_tex1_iter, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP); m_pShader->pPixelProgramContainer->SetTextureStageState(m_pShader->pixel1_tex1_iter, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP); m_pShader->pPixelProgramContainer->SetTextureStageState(m_pShader->pixel1_tex1_iter, D3DTSS_MINFILTER, D3DTEXF_LINEAR); m_pShader->pPixelProgramContainer->SetTextureStageState(m_pShader->pixel1_tex1_iter, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); m_pShader->pPixelProgramContainer->SetTextureStageState(m_pShader->pixel1_tex1_iter, D3DTSS_MIPFILTER, D3DTEXF_LINEAR);// pPixelProgramContainer->SetTexture(pixel1_tex1_iter, m_pNvidiaTexture2); m_pShader->pPixelProgramContainer->SetShaderConstant(m_pShader->pixel1_ambient_iter, &m_Ambient); m_pShader->pVertexProgramContainer->SetShaderActive(); m_pLevelInfo->Render( m_pd3dDevice, m_pShader, g_vEye );/* m_pd3dDevice->SetStreamSource( 0, m_pVB, sizeof(DisplayVertex) ); m_pd3dDevice->SetIndices( m_pIB, 0 ); m_pd3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, m_dwNumVertices, 0, m_dwNumIndices/3 );*/ RenderText( m_pd3dDevice ); // End the scene. m_pd3dDevice->EndScene(); } return S_OK;}
HRESULT CLevelInfo::Render(LPDIRECT3DDEVICE8 pd3dDevice, CShader* Shader, D3DXVECTOR3 eye){ HRESULT hr; for(int sec = 0; sec < numSectors; sec ++) { Shader->pPixelProgramContainer->SetTexture(Shader->pixel1_tex1_iter, m_pLightMap[sec]); for (int poly = 0; poly < sector[sec].numpolygons; poly ++) { float d1 = D3DXVec3Dot(§or[sec].polygon[poly].normal, §or[sec].polygon[poly].vertex[0].pos); float d2 = D3DXVec3Dot(§or[sec].polygon[poly].normal, &eye); if(d2 > d1) { Shader->pPixelProgramContainer->SetTexture(Shader->pixel1_tex0_iter, m_pLevelTexture[sector[sec].polygon[poly].iTextureIdx]); pd3dDevice->SetStreamSource( 0, sector[sec].polygon[poly].vertbuf, sizeof(LEVELVERTEX) ); if(FAILED(hr = pd3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, sector[sec].polygon[poly].numverticies-2 ) ) ) return hr; } } } return S_OK;}
This error also happens on DrawPrimitive calls in common files such as d3dfont so I don''t think it is one specific problem.
Are you aware DrawPrimitive takes the number of *polys* instead of vertices? That might cause the access violation.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement