#include <CTexture2D.h>
Public Member Functions | |
cTexture2D () | |
Constructor of cTexture2D. | |
~cTexture2D () | |
Destructor of cTexture2D. | |
bool | loadFromFile (const char *a_fileName) |
Load an image file (CHAI currently supports 24-bit .bmp and 32-bit .tga files). | |
void | render () |
Enable texturing and set this texture as the current texture. | |
void | markForUpdate () |
Call this to force texture re-initialization. | |
void | setEnvironmentMode (const GLint &a_environmentMode) |
Set the environment mode (GL_MODULATE, GL_DECAL, GL_BLEND, GL_REPLACE, or -1 for "don't set"). | |
GLint | getEnvironmentMode () |
Get the environment mode status. | |
void | setWrapMode (const GLint &a_wrapSmode, const GLint &a_wrapTmode) |
Set the texture wrap mode. | |
GLint | getWrapSmode () |
Get the texture wrap mode of S. | |
GLint | getWrapTmode () |
Get the texture wrap mode of T. | |
void | setMagnificationFunction (GLint a_magnificationFunction) |
Set the magnification function. | |
GLint | getMagnificationFunction () |
Get current magnification function. | |
void | setMinifyingFunction (GLint a_minifyingFunction) |
Set the minification function. | |
GLint | getMinifyingFunction () |
Get current magnification function. | |
void | setSphericalMappingEnabled (bool a_enabled) |
Set spherical mapping mode ON or OFF. | |
bool | getSphericalMappingEnabled () |
Get the status of the spherical mapping mode. | |
Public Attributes | |
cImageLoader | m_image |
Image loader (use this to get data about the texture itself). | |
cColorf | m_color |
Environmental color. |
cTexture2D::cTexture2D | ( | ) |
Constructor of cTexture2D.
A texture contains a 2D bitmap which can be projected onto the polygons of a 3D solid.
bool cTexture2D::loadFromFile | ( | const char * | a_fileName | ) | [virtual] |
Load an image file (CHAI currently supports 24-bit .bmp and 32-bit .tga files).
Load an image file (CHAI currently supports 24-bit .bmp and 32-bit .tga files on all platforms and should support all formats on Windows)
Reimplemented from cGenericTexture.
void cTexture2D::render | ( | ) | [virtual] |
Enable texturing and set this texture as the current texture.
Enable texturing and set this texture as the current texture
Reimplemented from cGenericTexture.
void cTexture2D::setMagnificationFunction | ( | GLint | a_magnificationFunction | ) |
Set the magnification function.
The texture magnification function is used when the pixel being textured maps to an area less than or equal to one texture element. It sets the texture magnification function to either GL_NEAREST or GL_LINEAR.
a_magnificationFunction | value shall be either GL_NEAREST or GL_LINEAR. |
void cTexture2D::setMinifyingFunction | ( | GLint | a_minifyingFunction | ) |
Set the minification function.
The texture minifying function is used whenever the pixel being textured maps to an area greater than one texture element. There are six defined minifying functions. Two of them use the nearest one or nearest four texture elements to compute the texture value. The other four use mipmaps. A mipmap is an ordered set of arrays representing the same image at progressively lower resolutions. If the texture has dimensions 2nx2m there are max(n, m) + 1 mipmaps. The first mipmap is the original texture, with dimensions 2nx2m. Each subsequent mipmap has dimensions 2k1x2l1 where 2 kx2l are the dimensions of the previous mipmap, until either k = 0 or l = 0. At that point, subsequent mipmaps have dimension 1x2l1 or 2k1x1 until the final mipmap, which has dimension 1x1. Mipmaps are defined using glTexImage1D or glTexImage2D with the level-of-detail argument indicating the order of the mipmaps. Level 0 is the original texture; level bold max(n, m) is the final 1x1 mipmap.
a_minifyingFunction | value shall be either GL_NEAREST or GL_LINEAR. |
void cTexture2D::setWrapMode | ( | const GLint & | a_wrapSmode, | |
const GLint & | a_wrapTmode | |||
) |
Set the texture wrap mode.
Sets the wrap parameter for texture coordinate s to either GL_CLAMP or GL_REPEAT. GL_CLAMP causes s coordinates to be clamped to the range [0,1] and is useful for preventing wrapping artifacts when mapping a single image onto an object. GL_REPEAT causes the integer part of the s coordinate to be ignored; OpenGL uses only the fractional part, thereby creating a repeating pattern. Border texture elements are accessed only if wrapping is set to GL_CLAMP. Initially, GL_TEXTURE_WRAP_S is set to GL_REPEAT.
a_wrapSmode | value shall be either GL_REPEAT or GL_CLAMP | |
a_wrapTmode | value shall be either GL_REPEAT or GL_CLAMP |