Sign in to follow this  
u235

Trouble setting the world transform

Recommended Posts

float x, y, z;

D3DXMATRIX *v;
D3DXMatrixTranslation(&v, x, y, z);

device->SetTransform(D3DTS_WORLD, &v);
The call to D3DXMatrixTranslation causes the error: cannot convert parameter 1 from 'D3DXMATRIX **__w64 ' to 'D3DXMATRIX *' and the call to device->SetTransform() causes the error: cannot convert parameter 2 from 'D3DXMATRIX **__w64 ' to 'const D3DMATRIX *' I don't believe I've ever run into this error before and I am pretty sure I've used these functions in the same manner before so I don't know why this error is coming up. If anyone can shed some light on this, I would greatly appreciate it. Thanks.

Share this post


Link to post
Share on other sites
You are taking the "address of" a pointer. You rarely ever need the address of a pointer variable. Either:
1)
D3DXMATRIX* v;
D3DXMatrixTranslation(v, x, y, z);

or 2)
D3DXMATRIX v;
D3DXMatrixTranslation(&v, x, y, z);

Both of these should work. The error tells you that you were using a D3DXMATRIX** because the address of a pointer is a pointer to a pointer.

Share this post


Link to post
Share on other sites
Quote:
Original post by deh0512
You rarely ever need the address of a pointer variable.

Unless, of course, you're using DirectX, like the OP, in which case the overwhelming majority of functions that get new interfaces require the address of a pointer. Ex: IDirect3D9::CreateDevice(), IDirect3DTexture9::GetSurfaceLevel(), etc.

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