MHuiSegmentedTexture Class Reference

class MHuiSegmentedTexture

MHuiSegmentedTexture is an abstract base class for texture image objects. It specifies one or more texture images that comprise a larger (virtual) image. THuiImage refers to objects that implement MHuiSegmentedTexture .

A segmented texture is a texture that is composed of one or more segments. Each segment has a position, dimensions, and a name that identifies the texture image of the segment. The purpose is that it is possible to compose large images out of smaller segments. The segments can overlap.

One use case is where the OpenGL texture size is limited (e.g., 256x256). A class implementing MHuiSegmentedTexture would in this case split the uploaded source image to multiple segments and create a different OpenGL texture for each. All of the segments would still be hidden inside the implementing MHuiSegmentedTexture-derived class, though, so it could be treated as a single entity.

When an object implements the MHuiSegmentedTexture interface, it can be drawn using the DrawImage() methods in CHuiGc (since THuiImage specifies the image as MHuiSegmentedTexture ).

Note:

CHuiGc and CHuiTexture only support single-segment textures at the moment.

CHuiGles10Texture CHuiTexture CHuiGc THuiImage

Constructor & Destructor Documentation

~MHuiSegmentedTexture()

IMPORT_C ~MHuiSegmentedTexture ( ) [virtual]

Construction / Destruction Virtual destructor, needed because we have a couple of implemented methods.

Member Functions Documentation

Bind(TInt, TInt)

IMPORT_C void Bind ( TInt aSegment = 0,
TInt aTextureUnit = 0
) const

Binds given texture segment to the texture target. Binding makes the texture segment active.

SegmentCount() to get the number of available segments.

Parameters

TInt aSegment = 0 Index of a segment. Defaults to the first segment.
TInt aTextureUnit = 0 Which (multi-)texture unit to bind to. The default value binds to the first texture unit (single-texturing mode).

Handle(TInt)

IMPORT_C THuiTextureHandle Handle ( TInt aSegment = 0 ) const

Returns a handle to given texture segment. Defaults to first segment.

Parameters

TInt aSegment = 0

SegmentCount()

TInt SegmentCount ( ) const [pure virtual]

Determines how many segments the texture has. Will return 1 if the texture is not segmented.

SegmentName(TInt)

TUint SegmentName ( TInt aSegment ) const [pure virtual]

Determines the texture name of a segment. For example with OpenGL ES renderer, this will be the texture id generated with glGenTextures().

Parameters

TInt aSegment Segment index to access.

SegmentOffset(TInt)

TPoint SegmentOffset ( TInt aSegment ) const [pure virtual]

Determines the logical offset for a texture segment.

Parameters

TInt aSegment Valid segment index for this texture.

SegmentSize(TInt)

TSize SegmentSize ( TInt aSegment ) const [pure virtual]

Determines the logical size of a texture segment. Can be non-power-of-two (NPOT) and may be different from the actual texture size.

Size() to return logical size of the whole texture. SegmentTextureSize() to determine the actual resolution of the texture.

Parameters

TInt aSegment Valid segment index for this texture.

SegmentTextureSize(TInt)

TSize SegmentTextureSize ( TInt aSegment ) const [pure virtual]

Determines the actual resolution of the texture used by the segment. Most likely only Power-of-Two, unless NPOT supported by the graphics library.

Parameters

TInt aSegment Valid segment index for this texture.

Size()

TSize Size ( ) const [pure virtual]

Returns the logical size of this texture. Ie. the original size of the image represented with this texture. This size is independent of the possible segmentation of this texture.

On the other hand the actual texture size may vary across segments and typically has some driver/hw limitations.

Note that all the segments must be contained inside the logical area defined with this function.

SegmentSize() To return logical size for a particular texture segment. SegmentOffset() To return logical position for a particular texture segment. SegmentTextureSize() To return texture size for a segment.