Click to See Complete Forum and Search --> : Accessing Direct 3D device from different file


Bobbysl
March 28th, 2009, 01:16 AM
I've trying to make a game engine using a object oriented methodology. The problem is i've made a class called "object" in a file called object.cpp to hold all the functions and variables for the 3D objects. So when i use D3DXLoadMeshFromX i can't access my direct 3D device which is in a class of its on called D3DDevice in the file D3DDevice.cpp.
I've tried using pointers but D3DXLoadMeshFromX doesnt seem to accept a pointer as a argument. Any idea how i might get passed this???
Thanks

object.cpp
just an expert got more in the actual file

....
D3DXLoadMeshFromX(L"test.x",
D3DXMESH_SYSTEMMEM,
g_pd3dDevice, // the Direct3D Device
NULL,
&bufMaterial,
NULL,
&g_dwNumMaterials,
&g_pMesh);
...


D3DDevice.cpp
just an expert got more in the actual file

...
LPDIRECT3DDEVICE9 g_pd3dDevice;
...


i can create a direct3D device in by defining it in my main using my class.

Thanks