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 Hello.ppm, and then it calls the IDirect3DRMMeshBuilder::SetTexture method to associate the bitmap with the sphere. The Hello.ppm bitmap is a 256´256, 256-color bitmap:

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

//

// AddMyTexture

// Creates and applies wrap for texture.

//

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

void AddMyTexture(LPDIRECT3DRMMESHBUILDER lpSphere3_builder,

LPDIRECT3DRMTEXTURE * lplpTex)

{

lpD3DRM->lpVtbl->LoadTexture(lpD3DRM, "hello.ppm", lplpTex);

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

// call IDirect3DRMTexture::SetShades here.

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

}