CubeTexture.CubeTexture(IDirect3DCubeTexture9) Constructor (Microsoft.DirectX.Direct3D)
How Do I...?
- Create a Cube Texture
Initializes a new instance of the CubeTexture class.
Definition
Visual Basic Public Sub New( _
ByVal pInterop As IDirect3DCubeTexture9 _
)C# public CubeTexture(
IDirect3DCubeTexture9 pInterop
);C++ public:
CubeTexture(
IDirect3DCubeTexture9 pInterop
);JScript public function CubeTexture(
pInterop : IDirect3DCubeTexture9
);
Parameters
pInterop Microsoft.DirectX.PrivateImplementationDetails.IDirect3DCubeTexture9
Unmanaged Component Object Model (COM) IDirect3DCubeTexture9 interface pointer.
Remarks
A mipmap is a collection of successively downsampled (mipmapped) surfaces. A cube texture created by CubeTexture is a collection of six textures (each mipmapped), one for each face. All faces must be present in the cube texture. Also, a cube map surface must be the same pixel size in all three dimensions (x, y, and z).
An application can discover support for the automatic generation of mipmaps in a particular format by calling Manager.CheckDeviceFormat with Usage.AutoGenerateMipMap. If Manager.CheckDeviceFormat returns false, this constructor succeeds, but it creates a one-level texture.
How Do I...?
Create a Cube Texture
This example demonstrates how to create a cube texture.
A cube texture is created after the hardware is checked to ensure that cube textures are supported. The new cube texture has an edge length of 16 pixels, and no Usage value. Provided the hardware supports mipmap cube textures, all cube texture sublevels down to 1x1 pixels for each face are automatically generated.
In the following C# code example, device is assumed to be the rendering Device. Developers should also check to ensure that the hardware supports the X8R8G8B8 format.
[C#] //Check cube texture requirements. CubeTextureRequirements tr = new CubeTextureRequirements(); tr.Format = Format.A8R8G8B8; TextureLoader.CheckCubeTextureRequirements(device, 0, Pool.Managed, out tr); //Create texture. CubeTexture cube = new CubeTexture( device, 16, 0, 0, Format.X8R8G8B8, Pool.Managed );