Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Problem in final code
- in general, I figured it out myself, but at a high level:
1. Step the texture itself - here a very unpleasant nuance came out with D3DXCreateTextureFromFile - you need to take D3DXCreateTextureFromFileEx:
extern "C" bool LoadTextureFromFile(const char* filename, void** out_texture, int* out_width, int* out_height)
{
// Load texture from disk
PDIRECT3DTEXTURE9 texture;
D3DCOLOR color = 0xFFFFFFFF;
HRESULT hr = D3DXCreateTextureFromFileExA(
g_pd3dDevice, filename, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT, 0,
D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, color, NULL, NULL,
&texture);
//HRESULT hr = D3DXCreateTextureFromFileA( &texture);
if (hr != S_OK)
return false;
// Retrieve description of the texture surface so we can access its size
D3DSURFACE_DESC my_image_desc;
texture->GetLevelDesc(0, &my_image_desc);
*out_texture = (void *)texture;
*out_width = (int)my_image_desc.Width;
*out_height = (int)my_image_desc.Height;
return true;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question