TextureLoader.CheckCubeTextureRequirements(Device,Usage,Pool,CubeTextureRequirements) Method (Microsoft.DirectX.Direct3D)

How Do I...?

  • Create a Cube Texture

Checks creation parameters for a cube texture.

Definition

Visual Basic Public Shared Sub CheckCubeTextureRequirements( _
    ByVal device As Device, _
    ByVal usage As Usage, _
    ByVal pool As Pool, _
    ByRef requirements As CubeTextureRequirements _
)
C# public static void CheckCubeTextureRequirements(
    Device device,
    Usage usage,
    Pool pool,
    out CubeTextureRequirements requirements
);
C++ public:
static void CheckCubeTextureRequirements(
    Devicedevice,
    Usage usage,
    Pool pool,
    [Out] CubeTextureRequirementsrequirements
);
JScript public static function CheckCubeTextureRequirements(
    device : Device,
    usage : Usage,
    pool : Pool,
    requirements : CubeTextureRequirements
);

Parameters

device Microsoft.DirectX.Direct3D.Device
A Device class that represents the device to associate with the cube texture.
usage Microsoft.DirectX.Direct3D.Usage
Value that is either 0 or Usage.RenderTarget. Setting this flag to Usage.RenderTarget indicates that the surface will be used as a render target. The resource can then be passed to the param_Surface_renderTarget parameter of the Device.SetRenderTarget method. If Usage.RenderTarget is specified, the application should determine whether the device supports this operation by calling Manager.CheckDeviceFormat.
pool Microsoft.DirectX.Direct3D.Pool
Member of the Pool enumerated type that describes the memory class into which the texture should be placed.
requirements Microsoft.DirectX.Direct3D.CubeTextureRequirements
A CubeTextureRequirements structure that contains the cube texture creation parameters.

Remarks

If invalid parameters are passed to this method, it returns corrected parameters.

Cube textures differ from other surfaces in that they are collections of surfaces. To call Device.SetRenderTarget with a cube texture, select an individual face using CubeTexture.GetCubeMapSurface and pass the resulting surface to Device.SetRenderTarget.

Exceptions

NotAvailableException

This device does not support the queried technique.

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

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

See Also