Sign in to follow this  
gregpat90

passing d3d9 device to function

Recommended Posts

im having a problem trying to set up a utility function that initilize d3d device. i am declaring the pointer IDirect3DDevice9* in my main cpp file and trying to initlize it in utdx.cpp. im trying to passing it by refernce utdx::intdx( &g_device, g_hWnd); but nothing i do is working im getting a error Error 2 error C2664: 'IDirect3D9::CreateDevice' : cannot convert parameter 6 from 'IDirect3DDevice9 ***__w64 ' to 'IDirect3DDevice9 **'

Share this post


Link to post
Share on other sites
You shouldn't declare a pointer to IDirect3DDevice9* (which is a pointer-to-a-pointer to IDirect3DDevice9), it should be a pointer to IDirect3DDevice9.

In your code, the & operator is the "address-of" operator, so what you're doing is passing a pointer to a pointer to a pointer to an IDirect3DDevice 9 object.

When passing by reference, the address-of operator isn't needed, which is what's causing the error.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this