#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 () |
void | bind () const |
bool | setSize (uint width, uint height) |
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 | getRGBAPixelFormat () |
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.
void 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. |
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.