Share via


Texture.Texture(Device,Int32,Int32,Int32,Usage,Format,Pool) Constructor (Microsoft.DirectX.Direct3D)

Creates a new instance of the Texture class.

Definition

Visual Basic Public Sub New( _
    ByVal device As Device, _
    ByVal width As Integer, _
    ByVal height As Integer, _
    ByVal numLevels As Integer, _
    ByVal usage As Usage, _
    ByVal format As Format, _
    ByVal pool As Pool _
)
C# public Texture(
    Device device,
    int width,
    int height,
    int numLevels,
    Usage usage,
    Format format,
    Pool pool
);
C++ public:
 Texture(
    Devicedevice,
    int width,
    int height,
    int numLevels,
    Usage usage,
    Format format,
    Pool pool
);
JScript public function Texture(
    device : Device,
    width : int,
    height : int,
    numLevels : int,
    usage : Usage,
    format : Format,
    pool : Pool
);

Parameters

device Microsoft.DirectX.Direct3D.Device
A Device object to associate with the Texture.
width System.Int32
Width of the texture's top level, in pixels. The pixel dimensions of subsequent levels are the truncated value of half of the previous level's pixel dimension (independently). Each dimension clamps at a size of one pixel. Thus, if the division by 2 results in 0, 1 is taken instead.
height System.Int32
Height of the texture's top level, in pixels. The pixel dimensions of subsequent levels are the truncated value of half of the previous level's pixel dimension (independently). Each dimension clamps at a size of one pixel. Thus, if the division by 2 results in 0, 1 is taken instead.
numLevels System.Int32
Number of levels in the texture. If this is 0, Microsoft Direct3D generates all texture sublevels down to 1 by 1 pixels for hardware that supports mipmapped textures. Check the BaseTexture.LevelCount parameter to see the number of levels generated.
usage Microsoft.DirectX.Direct3D.Usage
Usage can be 0, which indicates no usage value. However, if usage is desired, use one or more Usage constants. It is good practice to match the usage parameter with the CreateFlags in the Device constructor.
format Microsoft.DirectX.Direct3D.Format
Member of the Format enumerated type that describes the format of all levels in the texture.
pool Microsoft.DirectX.Direct3D.Pool
Member of the Pool enumerated type that describes the memory class into which the texture should be placed.

Remarks

An application can discover support for automatic generation of mipmaps in a particular format by calling Manager.CheckDeviceFormat with Usage.AutoGenerateMipMap. If Manager.CheckDeviceFormat returns false, the Texture constructor succeeds, but returns a single-level texture.

Exceptions

InvalidCallException

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

OutOfVideoMemoryException

Direct3D does not have enough display memory to perform the operation.

OutOfMemoryExceptionLeave Site

Direct3D could not allocate sufficient memory to complete the call.

See Also