?/TD> |
Microsoft DirectX 9.0 |
After any Microsoft?DirectX?program finishes, it needs to deallocate any DirectX objects that it used and invalidate the pointers to them. The mesh objects used in this sample also need to be deallocated. When it receives a WM_DESTROY message, the Meshes sample project calls Cleanup, an application-defined function, to handle this.
The following code fragment deletes the material list.
if( g_pMeshMaterials ) delete[] g_pMeshMaterials;
The following code fragment deallocates each individual texture that was loaded and then deletes the texture list.
if( g_pMeshTextures ) { for( DWORD i = 0; i < g_dwNumMaterials; i++ ) { if( g_pMeshTextures[i] ) g_pMeshTextures[i]->Release(); } delete[] g_pMeshTextures;
The following code fragment deallocates the mesh object.
Delete the mesh object if( g_pMesh ) g_pMesh->Release();
This tutorial has shown you how to load and render meshes. This is the last tutorial in this section. To see how a typical Microsoft Direct3D?application is written, see Samples.