GLIP-Lib
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Glip::CoreGL::HdlTextureFormatDescriptor Class Reference

Object handle describing an OpenGL Texture mode. More...

#include <HdlTextureTools.hpp>

Public Member Functions

bool isDepthValid (GLenum depth) const
 Test if a depth is valid for the current format. More...
 
bool hasChannel (GLenum channel) const
 Returns true if the format has the required channel, false otherwise or raise an exception if the channel is unknown. More...
 
int getChannelIndex (GLenum channel) const
 Get the index of a particular channel. More...
 
int getChannelOffsetInBits (int channelIndex, GLenum depth) const
 Get the channel offset/position. More...
 
int getChannelOffset (int channelIndex, GLenum depth) const
 Get the channel offset/position. More...
 
int getChannelSizeInBits (int channelIndex, GLenum depth) const
 Get the size of a channel. More...
 
int getChannelSize (int channelIndex, GLenum depth) const
 Get the size of a channel. More...
 
int getPixelSizeInBits (GLenum depth) const
 Get the pixel size. More...
 
int getPixelSize (GLenum depth) const
 Get the pixel size. More...
 

Static Public Member Functions

static int getTypeSizeInBits (GLenum depth)
 Return the size of the type associated with depth. More...
 
static int getTypeSize (GLenum depth)
 Return the size of the type associated with depth. More...
 
static void getShuffle (const HdlTextureFormatDescriptor &dst, const HdlTextureFormatDescriptor &src, char *shuffleIndex, const int length)
 Construct the shuffling pattern between two format. More...
 
static int getBitShuffle (const HdlTextureFormatDescriptor &dst, const GLenum &dstDepth, const HdlTextureFormatDescriptor &src, const GLenum &srcDepth, char *shuffleBitIndex, const int length, bool *isBlack=NULL)
 Construct the byte shuffling pattern between two format. More...
 
static void applyBitShuffle (char *dst, const char *src, const char *shuffleBitIndex, const int length)
 Apply the bit shuffling pattern from the source to the destination. More...
 

Public Attributes

const GLenum mode
 Name of the mode (GL_RGB, GL_RGBA, etc.).
 
const GLenum aliasMode
 Name of the alias mode (simplified mode, GL_RGB, GL_RGBA, etc.).
 
const GLenum uncompressedMode
 Name of the corresponding uncompressed mode (the same as mode if not a compressed format).
 
const GLenum compressedMode
 Name of the corresponding compressed mode (the same as mode if already a compressed format).
 
const int numChannels
 Number of channels.
 
const GLenum channels [HdlTextureFormatDescriptor_MaxNumChannels]
 Channels content (GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_LUMINANCE, etc.) or GL_NONE if empty.
 
const int channelsSizeInBits [HdlTextureFormatDescriptor_MaxNumChannels]
 Size of the channels in bits or 0 if empty.
 
const GLenum channelsDepth [HdlTextureFormatDescriptor_MaxNumChannels]
 Depth associated with the channel or GL_NONE if no type is enforced or if channel is empty.
 
const bool isFloatingPoint
 If the format is in floating point.
 
const bool isCompressed
 If the format is compressed.
 
const bool isSupported
 If the format is supported.
 

Detailed Description

Object handle describing an OpenGL Texture mode.

Member Function Documentation

void HdlTextureFormatDescriptor::applyBitShuffle ( char *  dst,
const char *  src,
const char *  shuffleBitIndex,
const int  length 
)
static

Apply the bit shuffling pattern from the source to the destination.

Parameters
dstDestination pixel address.
srcSource pixel address.
shuffleBitIndexBit shuffle pattern, see HdlTextureFormatDescriptor::getBitShuffle.
lengthLength of the shuffling pattern, usually returned by HdlTextureFormatDescriptor::getBitShuffle.
int HdlTextureFormatDescriptor::getBitShuffle ( const HdlTextureFormatDescriptor dst,
const GLenum &  dstDepth,
const HdlTextureFormatDescriptor src,
const GLenum &  srcDepth,
char *  shuffleBitIndex,
const int  length,
bool *  isBlack = NULL 
)
static

Construct the byte shuffling pattern between two format.

Parameters
dstThe destination format.
dstDepthThe depth associated with the destination format.
srcThe source format.
srcDepthThe depth associated with the source format.
shuffleBitIndexPointer to a buffer which will contain the bit shuffling pattern.
lengthLength of the given buffer (dst.getPixelSize() is sufficient).
isBlackIf not null, will contain a boolean asserting that there is not correspondence between the source and the destination.
Returns
The length of the pattern actually written.

This function constructs an array containing the bit index of the channels in the source from the point of view of the destination (or -1 if a channel does not exist in the source). To be used with HdlTextureFormatDescriptor::applyBitShuffle. It will raise an exception if either or both the source and the destination are floating point formats.

int HdlTextureFormatDescriptor::getChannelIndex ( GLenum  channel) const

Get the index of a particular channel.

Parameters
channelThe channel name (GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA or GL_LUMINANCE).
Returns
The channel index or -1 if not found.
int HdlTextureFormatDescriptor::getChannelOffset ( int  channelIndex,
GLenum  depth 
) const

Get the channel offset/position.

Parameters
channelIndexThe index of the channel
depthThe depth associated with the current format.
Returns
The channel offset in bytes or -1 if the channel does not exist.
int HdlTextureFormatDescriptor::getChannelOffsetInBits ( int  channelIndex,
GLenum  depth 
) const

Get the channel offset/position.

Parameters
channelIndexThe index of the channel
depthThe depth associated with the current format.
Returns
The channel offset in bits or -1 if the channel does not exist.
int HdlTextureFormatDescriptor::getChannelSize ( int  channelIndex,
GLenum  depth 
) const

Get the size of a channel.

Parameters
channelIndexThe index of the channel
depthThe depth associated with the current format.
Returns
The channel size in bytes or 0 if the channel does not exist.
int HdlTextureFormatDescriptor::getChannelSizeInBits ( int  channelIndex,
GLenum  depth 
) const

Get the size of a channel.

Parameters
channelIndexThe index of the channel
depthThe depth associated with the current format.
Returns
The channel size in bits or 0 if the channel does not exist.
int HdlTextureFormatDescriptor::getPixelSize ( GLenum  depth) const

Get the pixel size.

Parameters
depthThe depth associated with the current format.
Returns
The pixel size in bytes.
int HdlTextureFormatDescriptor::getPixelSizeInBits ( GLenum  depth) const

Get the pixel size.

Parameters
depthThe depth associated with the current format.
Returns
The pixel size in bits.
void HdlTextureFormatDescriptor::getShuffle ( const HdlTextureFormatDescriptor dst,
const HdlTextureFormatDescriptor src,
char *  shuffleIndex,
const int  length 
)
static

Construct the shuffling pattern between two format.

Parameters
dstThe destination format.
srcThe source format.
shuffleIndexPointer to a buffer which will contain the shuffling pattern.
lengthLength of the given buffer (dst.numChannels is sufficient).

This function constructs an array containing the index of the channels in the source from the point of view of the destination (or -1 if a channel does not exist in the source).

int HdlTextureFormatDescriptor::getTypeSize ( GLenum  depth)
static

Return the size of the type associated with depth.

Parameters
depthThe depth, described as its enumerator value (e.g. GL_BYTE for GLbyte).
Returns
Size of the type, in bytes.
int HdlTextureFormatDescriptor::getTypeSizeInBits ( GLenum  depth)
static

Return the size of the type associated with depth.

Parameters
depthThe depth, described as its enumerator value (e.g. GL_BYTE for GLbyte).
Returns
Size of the type, in bits.
bool HdlTextureFormatDescriptor::hasChannel ( GLenum  channel) const

Returns true if the format has the required channel, false otherwise or raise an exception if the channel is unknown.

Parameters
channelThe channel name (GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA or GL_LUMINANCE).
Returns
True if the format has the channel.
bool HdlTextureFormatDescriptor::isDepthValid ( GLenum  depth) const

Test if a depth is valid for the current format.

Parameters
depthThe depth to be tested.
Returns
True if the depth can be associated to this format.

The documentation for this class was generated from the following files: