• Advertisement
Sign in to follow this  

Trouble setting the world transform

This topic is 3671 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Are you sure you wanted

D3DXMATRIX *v;

And not

D3DXMATRIX v;

?

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
The first will compile, but not work, because the pointer will be garbage.

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
Thanks for the help. Got it working now with no problem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement