Sign in to follow this  
Diceydawg

Quick question array of textures

Recommended Posts

Here's the problem part of the code D3DXCreateTextureFromFileEx( TileDevice, Filename, info.Width, info.Height, 1, D3DPOOL_DEFAULT, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, Transparent, &info, NULL, &Textures[TextureNum] ); error C2664: 'D3DXCreateTextureFromFileExA' : cannot convert parameter 1 from 'LPDIRECT3DDEVICE9 *' to 'LPDIRECT3DDEVICE9' Texture is an array of LPDIRECT3D9TEXTURE I tried putting parentheses around Texture but to no avail. Seems like I cannot find a way to dereference what's in Textures. Here's the code for creating the array. Textures = new LPDIRECT3DTEXTURE9[NumTextures]; for (int k = 0; k < NumTextures; k++) Textures[k] = NULL; If you have to ask I'm doing this for a Tile Engine.

Share this post


Link to post
Share on other sites
sorry I probably should of told you where in the call I was getting the error. The error's coming from this line

&Textures[TextureNum] );

which according to msdn requires a *LPDIRECT3DSURFACE9 hence the dereference

Share this post


Link to post
Share on other sites
Your error does not state anything is wrong with how you're referencing your textures. However, the way you're attempting to pass the first parameter, your device, is wrong. It sounds like you have an IDirect3DDevice9** and it wants a IDirect3DDevice9*. Try replacing TileDevice with (*TileDevice).

EDIT: The reason it is highlighting the last line is because you've broken the function call up into multiple lines. In cases where there is something wrong with a multiline function call, it will always highlight the last line.

Share this post


Link to post
Share on other sites
oh wow thanks for the help lol. I thought my problem was with that last line....... Yeh I just realized after your post that the compiler tells you which parameter is the problem.....

Share this post


Link to post
Share on other sites
error C2664: 'D3DXCreateTextureFromFileExA' : cannot convert parameter 1 from 'LPDIRECT3DDEVICE9 *' to 'LPDIRECT3DDEVICE9'

The error is in the first parameter, not in the textures array. Is your TileDevice a pointer? in that case you need to dereference it

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