Microsoft DirectX 8.0 (C++) |
You can navigate between faces of a cubic environment map by using the IDirect3DCubeTexture8::GetCubeMapSurface method.
The following code example uses GetCubeMapSurface to retrieve the cube-map surface used for the positive-y face (face 2).
/* * For this example, m_pCubeMap is a valid * pointer to a IDirect3DCubeTexture8 interface. */ LPDIRECT3DSURFACE8 pFace2; m_pCubeMap->GetCubeMapSurface( D3DCUBEMAP_FACE_POSITIVE_Y, 0, &pFace2);
The first parameter that GetAttachedSurface accepts is a D3DCUBEMAP_FACES enumerated value that describes the attached surface that the method should retrieve. The second parameter tells Microsoft® Direct3D® which level of a mipmapped cube texture to retrieve. The third parameter accepted is the address of the IDirect3DSurface8 interface, representing the returned cube texture surface. Because this cube-map is not mipmapped, 0 is used here.
Note After calling this method, the internal reference count on the IDirect3DSurface8 interface is increased. When you are done using this surface, be sure to call the IUnknown::Release method on this IDirect3DSurface8 interface or you will have a memory leak.