I am trying access to texture by using DX interface LPDIRECT3DTEXTURE9, but seems pointer in bmap->d3dtex pointed to interface what do not work correctly(anyone who do not know - d3dtex is BMAP parameter)
For example: in this code i try get info about texture into 'texinfo' structure, and then i use GetLevelDesc its crash.
#include <acknex.h>
#include <d3d9.h>
#include <default.c>
typedef struct {
D3DFORMAT Format;
D3DRESOURCETYPE Type;
DWORD Usage;
D3DPOOL Pool;
D3DMULTISAMPLE_TYPE MultiSampleType;
DWORD MultiSampleQuality;
UINT Width;
UINT Height;
} D9DSURFACE_DESC;
D9DSURFACE_DESC texinfo;
LPDIRECT3DTEXTURE9 tex;
void d3d9Tex (BMAP* ebmap)
{
tex = ebmap->d3dtex;
tex->GetLevelDesc(0, &texinfo);// in this function its crash with error
}
void main ()
{
level_load(0);
you = ent_create ("box.mdl",nullvector,0);
d3d9Tex(ent_getskin(you,1));
}
first i did think what i make mistake in code but then i try replace original texture by loading new, happened miracle GetLevelDesc return correct information about LPDIRECT3DTEXTURE9
void d3d9Tex (BMAP* ebmap)
{
D3DXCreateTextureFromFileA ((LPDIRECT3DDEVICE9)pd3ddev,"RGB.png",&ebmap.d3dtex);
tex = ebmap->d3dtex;
tex->GetLevelDesc(0, &texinfo);// now it works fine
}
Finally anybody can me explain what i doing wrong when i try to use d3d9Tex with LPDIRECT3DDEVICE9 interface for original model texture?