Quick question array of textures

Started by
5 comments, last by Diceydawg 14 years ago
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.
Advertisement
You have said you have an array of textures. Don't you need to use TileDevice[some index]??
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
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.
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.....
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
Yeh i figured it out. Thanks for the help everyone.

;)

This topic is closed to new replies.

Advertisement