#include <texture.h>
Public Member Functions | |
Texture (GLenum glIntFormat, GLenum glFormat, GLenum glType, bool autoCreate=true) | |
void | enableLinearFiltering (bool enable) |
bool | isLinearFilteringEnabled () const |
void | setWrapMode (WrapMode wrapMode) |
void | destroy () |
void | create () |
bool | bind () const |
bool | setSize (uint width, uint height) |
void | setFlip (bool flip) |
void | setRotation (Common::RotationMode rotation) |
void | updateArea (const Common::Rect &area, const Graphics::Surface &src) |
uint | getWidth () const |
uint | getHeight () const |
uint | getLogicalWidth () const |
uint | getLogicalHeight () const |
const GLfloat * | getTexCoords () const |
GLuint | getGLTexture () const |
Static Public Member Functions | |
static const Graphics::PixelFormat | getRGBPixelFormat () |
static const Graphics::PixelFormat | getRGBAPixelFormat () |
static const Graphics::PixelFormat | getBGRAPixelFormat () |
Protected Member Functions | |
void | computeTexCoords () |
Protected Attributes | |
const GLenum | _glIntFormat |
const GLenum | _glFormat |
const GLenum | _glType |
uint | _width |
uint | _height |
uint | _logicalWidth |
uint | _logicalHeight |
bool | _flip |
Common::RotationMode | _rotation |
GLfloat | _texCoords [4 *2] |
GLint | _glFilter |
GLuint | _glTexture |
A simple GL texture object abstraction.
This is used for low-level GL texture handling.
OpenGL::Texture::Texture | ( | GLenum | glIntFormat, |
GLenum | glFormat, | ||
GLenum | glType, | ||
bool | autoCreate = true |
||
) |
Constrcut a new GL texture object.
glIntFormat | The internal format to use. |
glFormat | The input format. |
glType | The input type. |
void OpenGL::Texture::enableLinearFiltering | ( | bool | enable | ) |
Enable or disable linear texture filtering.
enable | true to enable and false to disable. |
|
inline |
Test whether linear filtering is enabled.
void OpenGL::Texture::setWrapMode | ( | WrapMode | wrapMode | ) |
Enable or disable linear texture filtering.
enable | true to enable and false to disable. |
void OpenGL::Texture::destroy | ( | ) |
Destroy the OpenGL texture name.
void OpenGL::Texture::create | ( | ) |
Create the OpenGL texture name.
bool OpenGL::Texture::bind | ( | ) | const |
Bind the texture to the active texture unit.
bool OpenGL::Texture::setSize | ( | uint | width, |
uint | height | ||
) |
Sets the size of the texture in pixels.
The internal OpenGL texture might have a different size. To query the actual size use getWidth()/getHeight().
width | The desired logical width. |
height | The desired logical height. |
|
inline |
Sets the flip and rotate parameters of the texture
flip | Whether to flip vertically the texture when displaying it. |
|
inline |
Sets the rotate parameter of the texture
rotation | How to rotate the texture |
void OpenGL::Texture::updateArea | ( | const Common::Rect & | area, |
const Graphics::Surface & | src | ||
) |
Copy image data to the texture.
area | The area to update. |
src | Surface for the whole texture containing the pixel data to upload. Only the area described by area will be uploaded. |
|
inline |
Query the GL texture's width.
|
inline |
Query the GL texture's height.
|
inline |
Query the logical texture's width.
|
inline |
Query the logical texture's height.
|
inline |
Obtain texture coordinates for rectangular drawing.
|
inline |
Obtain texture name.
Beware that the texture name changes whenever create is used. destroy will invalidate the texture name.