![]() |
| ||
| DirectX and C++ DrawIndexedPrimitive question Here is my code of the function in questiion: void DrawScene(LPDIRECT3DDEVICE9 p_dx_Device, LPDIRECT3DVERTEXBUFFER9 p_dx_VertexBuffer, LPDIRECT3DINDEXBUFFER9 p_dx_IndexBuffer) the following line is the error line: p_dx_Device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, int_VertCount, 0, int_PrimCount); when i build it, no errors occur, however upon running i get: Unhandled exception at 0x4ff4f522 in testdx.exe: 0xC0000005: Access violation reading location 0x00231ad8. now i have done a little debugging already. i have found that none of my variables or pointers to variables in my entire program are set at memory location 0x00231ad8, or any where close for that matter. I bring up the memory listing for that area, and there are "?" all over.... the closest variable that the function DrawIndexedPrimitive should use (and that my program includes) is at 0x002197c0, and none of the relevant variables would indicate any entries out of the range of that vector. my question is more along the lines of "why is it trying to access this memory location if none of my pointers or variables indicate values needed are there? and how do i solve this annoying little error?" i am at wits end. Any Help would be much appreciated. Thanks. |
| ||
| Re: DirectX and C++ DrawIndexedPrimitive question The functions you call are probably attempting to access that memory location because of bad arguments you send it. Check the value of pointers such as p_dx_Device to make sure they are valid and the value of the parameters sent to make sure they are correct. for example what is the value of int_VertCount ? Is it a valid value ? |
| ||
| Re: DirectX and C++ DrawIndexedPrimitive question Quote:
int_PrimCount = 3 p_dx_Device is a object created by the DirectX function Direct3DCreate9::CreateDevice and is populated properly as well as passed properly. the DrawIndexedPrimitive function syntax is: DrawIndexedPrimitive( according to the SDK. Below is the code where the values are stored for the Vertexs and Indices: int LoadIndicesAndVerts(HWND han_Window, LPDIRECT3DDEVICE9 p_dx_Device, char *s_fName, LPDIRECT3DVERTEXBUFFER9 &p_VertBuf, LPDIRECT3DINDEXBUFFER9 &p_IndBuf) the LoadVerts function is a function solely for the purpose of extracting the vertex information from my custom file format (which is working properly). The file being loaded is a simple 3 triangle file for testing.... I am befuddled. |
| All times are GMT -4. The time now is 11:08 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC