The AddMyTexture Function

The MyScene function calls the AddMyTexture function to load a texture and associate it with the sphere. AddMyTexture calls the IDirect3DRM::LoadTexture method to load a bitmap called tutor.bmp, and then it calls the IDirect3DRMMeshBuilder::SetTexture method to associate the bitmap with the sphere.

/////////////////////////////////////////////////////////////////////

//

// AddMyTexture

// Creates and applies wrap for texture.

//

/////////////////////////////////////////////////////////////////////

void AddMyTexture(LPDIRECT3DRMMESHBUILDER lpSphere3_builder,

LPDIRECT3DRMTEXTURE * lplpTex)

{

lpD3DRM->lpVtbl->LoadTexture(lpD3DRM, "tutor.bmp", lplpTex);

// If you need a color depth other than the default (16),

// call IDirect3DRMTexture::SetShades here.

lpSphere3_builder->lpVtbl->SetTexture(lpSphere3_builder, *lplpTex);

}