TextureLoader.FromCubeStream Method

Language:

Creates a cube texture from a file in memory.

Definition

Visual Basic Public Shared Function FromCubeStream( _
    ByVal device As Device, _
    ByVal stream As Stream, _
    ByVal readBytes As Integer, _
    ByVal size As Integer, _
    ByVal mipLevels As Integer, _
    ByVal usage As Usage, _
    ByVal format As Format, _
    ByVal pool As Pool, _
    ByVal filter As Filter, _
    ByVal mipFilter As Filter, _
    ByVal colorKey As Integer _
) As CubeTexture
C# public static CubeTexture FromCubeStream(
    Device device,
    Stream stream,
    int readBytes,
    int size,
    int mipLevels,
    Usage usage,
    Format format,
    Pool pool,
    Filter filter,
    Filter mipFilter,
    int colorKey
);
C++ public:
static CubeTextureFromCubeStream(
    Devicedevice,
    Streamstream,
    int readBytes,
    int size,
    int mipLevels,
    Usage usage,
    Format format,
    Pool pool,
    Filter filter,
    Filter mipFilter,
    int colorKey
);
JScript public static function FromCubeStream(
    device : Device,
    stream : Stream,
    readBytes : int,
    size : int,
    mipLevels : int,
    usage : Usage,
    format : Format,
    pool : Pool,
    filter : Filter,
    mipFilter : Filter,
    colorKey : int
) : CubeTexture;

Parameters

device Microsoft.DirectX.Direct3D.Device
A Device object that represents the device to associate with the cube texture.
stream System.IO.Stream
A Stream Leave Site from which to create the cube texture. See Remarks.
readBytes System.Int32
Size of the file in memory, in bytes.
size System.Int32
Width and height of the cube texture in pixels. For example, if the cube texture is an 8-pixel by 8-pixel cube, the value is 8. If the value is 0, the dimensions are taken from the file.
mipLevels System.Int32
Number of mip levels requested. If this value is 0, a complete mipmap chain is created.
usage Microsoft.DirectX.Direct3D.Usage
Zero or Usage.RenderTarget, or Usage.Dynamic. Setting this flag to Usage.RenderTarget indicates that the surface should 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. The Usage.Dynamic value indicates that the surface should be handled dynamically.
format Microsoft.DirectX.Direct3D.Format
Member of the Format enumerated type that describes the requested pixel format for the cube texture. The returned cube texture might have a different format from that specified by param_Format_format. Applications should check the format of the returned cube texture. If param_Format_format is Unknown, the format is taken from the file.
pool Microsoft.DirectX.Direct3D.Pool
Member of the Pool enumerated type that describes the memory class into which the cube texture should be placed.
filter Microsoft.DirectX.Direct3D.Filter
One or more Filter flags that control how the image is filtered.
mipFilter Microsoft.DirectX.Direct3D.Filter
One or more Filter flags that control how the mipmaps are filtered.
colorKey System.Int32
An Int32 Leave Site value to replace with transparent black, or 0 to disable the color key. The color key is always a 32-bit ARGB color that is independent of the source image format. Alpha is significant, and usually should be set to FF for opaque color keys. For example, for opaque black, the value equals 0xFF000000.

Return Value

Microsoft.DirectX.Direct3D.CubeTexture
A CubeTexture object that represents the created cube texture object.

Remarks

This method supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga.

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.

The TextureLoader.FromCubeFile method uses the Microsoft DirectDraw surface (DDS) file format. The DXTex tool enables generation of a cube map from other file formats, and saves it as a .dds file.

Exceptions
InvalidCallException The method call is invalid. For example, a method's parameter might contain an invalid value.
InvalidDataException The data is invalid.
NotAvailableException This device does not support the queried technique.
OutOfVideoMemoryException Microsoft Direct3D does not have enough display memory to perform the operation.
OutOfMemoryException Leave Site Direct3D could not allocate sufficient memory to complete the call.

See Also


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center