Share via


CubeTexture.CubeTexture(IDirect3DCubeTexture9,Device,Pool) 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 lp As IDirect3DCubeTexture9, _
    ByVal device As Device, _
    ByVal pool As Pool _
)
C# public CubeTexture(
    IDirect3DCubeTexture9 lp,
    Device device,
    Pool pool
);
C++ public:
 CubeTexture(
    IDirect3DCubeTexture9 lp,
    Devicedevice,
    Pool pool
);
JScript public function CubeTexture(
    lp : IDirect3DCubeTexture9,
    device : Device,
    pool : Pool
);

Parameters

lp Microsoft.DirectX.PrivateImplementationDetails.IDirect3DCubeTexture9
Unmanaged Component Object Model (COM) IDirect3DCubeTexture9 interface pointer.
device Microsoft.DirectX.Direct3D.Device
A Device object.
pool Microsoft.DirectX.Direct3D.Pool
A Pool value that describes the memory class into which the cube texture should be placed.

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 );