Gel2D - The free/open source game creation suite

Public Member Functions
gel::GelTexture Class Reference

#include <gelTexture.h>

List of all members.

Public Member Functions

 GelTexture ()
 Default constructor.
 GelTexture (const GelString &filename, ImageType type, TextureFilter filter=GEL_LINEAR, TextureWrap wrap=GEL_NO_REPEAT)
 Convenience constructor.
 GelTexture (GelImageData *image, TextureFilter filter=GEL_LINEAR, TextureWrap wrap=GEL_NO_REPEAT)
 Convenience constructor.
 ~GelTexture ()
 Destructor.
void load (const GelString &filename, ImageType type, TextureFilter filter=GEL_LINEAR, TextureWrap wrap=GEL_NO_REPEAT)
 Loads an image into the texture.
void loadOverlay (const GelString &filename, ImageType type, int xoffset, int yoffset)
 Loads an image and overlays it onto the existing texture.
void load (GelImageData *image, TextureFilter filter=GEL_LINEAR, TextureWrap wrap=GEL_NO_REPEAT)
 Loads raw image data into the texture.
void setFilterMode (TextureFilter mode)
 Sets the texture filtering mode.
void setWrapMode (TextureWrap mode)
 Sets the texture wrapping mode.
void setTexFunc (TextureFunction mode)
 Sets the texture function mode.
int getWidth () const
 Gets the width of the texture.
int getHeight () const
 Gets the height of the texture.
int getRealWidth () const
 Gets the real width of the texture.
int getRealHeight () const
 Gets the real height of the texture.
ColorMode getFormat () const
 Gets the texture's color format.
int getBpp () const
 Gets the texture's number of bytes per pixel.
GELuint getID () const
 Gets the texture's ID.

Constructor & Destructor Documentation

gel::GelTexture::GelTexture ( )

Default constructor.

gel::GelTexture::GelTexture ( const GelString filename,
ImageType  type,
TextureFilter  filter = GEL_LINEAR,
TextureWrap  wrap = GEL_NO_REPEAT 
)

Convenience constructor.

Loads an image into the texture.

See also:
load( const char *filename, ImageType type, TextureFilter filter, TextureWrap wrap )
gel::GelTexture::GelTexture ( GelImageData image,
TextureFilter  filter = GEL_LINEAR,
TextureWrap  wrap = GEL_NO_REPEAT 
)

Convenience constructor.

Loads an image into the texture.

See also:
load( GelImageData *image, TextureFilter filter, TextureWrap wrap )
gel::GelTexture::~GelTexture ( )

Destructor.


Member Function Documentation

void gel::GelTexture::load ( const GelString filename,
ImageType  type,
TextureFilter  filter = GEL_LINEAR,
TextureWrap  wrap = GEL_NO_REPEAT 
)

Loads an image into the texture.

Parameters:
filename: String holding the filename of the image to be read.
type: The image format. Can be either IMG_PNG or IMG_TGA.
filter: How to filter the image when sampling. Can be either GEL_NEAREST or GEL_LINEAR. If omitted, defaults to GEL_LINEAR.
wrap: How to wrap the image when uv coordinates exceed image boundaries. Options are GEL_REPEAT, GEL_NO_REPEAT, or GEL_CLAMP. If omitted, defaults to GEL_NO_REPEAT.
void gel::GelTexture::loadOverlay ( const GelString filename,
ImageType  type,
int  xoffset,
int  yoffset 
)

Loads an image and overlays it onto the existing texture.

This function should only be called after an image has already been loaded into the texture.

Parameters:
filename: The filename of the image to be read.
type: The image format. Can be either IMG_PNG or IMG_TGA.
xoffset: The overlay image's horizontal offset.
yoffset: The overlay image's vertical offset.
void gel::GelTexture::load ( GelImageData image,
TextureFilter  filter = GEL_LINEAR,
TextureWrap  wrap = GEL_NO_REPEAT 
)

Loads raw image data into the texture.

Use this function with care; it is easy to feed it wrong information and crash the program.

Parameters:
image: Pointer to an image data structure containing the width, height, format, bytes per pixel, and a pointer to the image data to be written.
filter: How to filter the image when sampling. If omitted, defaults to GEL_LINEAR.
wrap: How to wrap the image when uv coordinates exceed image boundaries. If omitted, defaults to GEL_NO_REPEAT.
void gel::GelTexture::setFilterMode ( TextureFilter  mode)

Sets the texture filtering mode.

This determines how to filter the image when texels cannot be directly mapped to pixels, (i.e. the image has been scaled, rotated, or distorted).

Parameters:
mode: Valid modes are GEL_NEAREST or GEL_LINEAR.
void gel::GelTexture::setWrapMode ( TextureWrap  mode)

Sets the texture wrapping mode.

This determines how the image will be wrapped when uv coordinates exceed image boundaries.

Parameters:
mode: Valid modes are GEL_REPEAT, GEL_NO_REPEAT, or GEL_CLAMP.
void gel::GelTexture::setTexFunc ( TextureFunction  mode)

Sets the texture function mode.

This determines how the texture will be blended with the object's color.

Parameters:
mode: Valid modes are GEL_DECAL, GEL_MODULATE, or GEL_REPLACE.
int gel::GelTexture::getWidth ( ) const [inline]

Gets the width of the texture.

Returns:
The width of the texture in pixels.
int gel::GelTexture::getHeight ( ) const [inline]

Gets the height of the texture.

Returns:
The height of the texture in pixels.
int gel::GelTexture::getRealWidth ( ) const [inline]

Gets the real width of the texture.

Returns:
The width of the texture in pixels.
int gel::GelTexture::getRealHeight ( ) const [inline]

Gets the real height of the texture.

Returns:
The height of the texture in pixels.
ColorMode gel::GelTexture::getFormat ( ) const [inline]

Gets the texture's color format.

Returns:
The color format.
int gel::GelTexture::getBpp ( ) const [inline]

Gets the texture's number of bytes per pixel.

Returns:
The number of bytes per pixel.
GELuint gel::GelTexture::getID ( ) const [inline]

Gets the texture's ID.

Returns:
The ID.

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