IDirect3DRM2::LoadTexture

Loads a Direct3DRMTexture2 texture from the specified file. This texture can have 8, 24, or 32 bits-per-pixel, and it should be in either the Windows bitmap (.bmp) or Portable Pixmap (.ppm) P6 format.

HRESULT LoadTexture(
const char * lpFileName,
LPDIRECT3DRMTEXTURE2* lplpD3DRMTexture
);

Parameters

lpFileName

Address of the name of the required .bmp or .ppm file.

lplpD3DRMTexture

Address of a pointer to be initialized with a valid IDirect3DRMTexture2 pointer if the call succeeds.

Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained-Mode Return Values.

Remarks

LoadTexture checks whether the texture is in BMP or PPM format, which are the formats it knows how to load. If you want to load other formats, you can add code to the callback to load the image into a D3DRMIMAGE structure and then call IDirect3DRM2::CreateTexture.

If you write your own texture callback, the LoadTexture call in the texture callback does not take a reference to the texture. For example:

HRESULT loadTextures(char *name, void *arg, LPDIRECT3DRMTEXTURE2 *tex)

{

return lpD3DRM2->LoadTexture(name, tex);

}

In this sample, no reference is taken for tex. If you want to keep a reference to each texture loaded by your texture callback, you should AddRef the texture. For example:

LPDIRECT3DRMTEXTURE2 *texarray;

HRESULT loadTextures(char *name, void *arg, LPDIRECT3DRMTEXTURE2 *tex)

{

if (FAILED(lpD3DRM2->LoadTexture(name, tex)) {

return NULL;

}

texArray[current++] = tex;

tex->AddRef();

return tex;

}