ScummVM API documentation
OpenGL::Texture Class Reference

#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 ()
 

Protected Attributes

const GLenum _glIntFormat
 
const GLenum _glFormat
 
const GLenum _glType
 
uint _width
 
uint _height
 
uint _logicalWidth
 
uint _logicalHeight
 
GLfloat _texCoords [4 *2]
 
GLint _glFilter
 
GLuint _glTexture
 

Detailed Description

A simple GL texture object abstraction.

This is used for low-level GL texture handling.

Constructor & Destructor Documentation

◆ Texture()

OpenGL::Texture::Texture ( GLenum  glIntFormat,
GLenum  glFormat,
GLenum  glType,
bool  autoCreate = true 
)

Constrcut a new GL texture object.

Parameters
glIntFormatThe internal format to use.
glFormatThe input format.
glTypeThe input type.

Member Function Documentation

◆ enableLinearFiltering()

void OpenGL::Texture::enableLinearFiltering ( bool  enable)

Enable or disable linear texture filtering.

Parameters
enabletrue to enable and false to disable.

◆ isLinearFilteringEnabled()

bool OpenGL::Texture::isLinearFilteringEnabled ( ) const
inline

Test whether linear filtering is enabled.

◆ setWrapMode()

void OpenGL::Texture::setWrapMode ( WrapMode  wrapMode)

Enable or disable linear texture filtering.

Parameters
enabletrue to enable and false to disable.

◆ destroy()

void OpenGL::Texture::destroy ( )

Destroy the OpenGL texture name.

◆ create()

void OpenGL::Texture::create ( )

Create the OpenGL texture name.

◆ bind()

void OpenGL::Texture::bind ( ) const

Bind the texture to the active texture unit.

◆ setSize()

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().

Parameters
widthThe desired logical width.
heightThe desired logical height.
Returns
Whether the call was successful

◆ updateArea()

void OpenGL::Texture::updateArea ( const Common::Rect area,
const Graphics::Surface src 
)

Copy image data to the texture.

Parameters
areaThe area to update.
srcSurface for the whole texture containing the pixel data to upload. Only the area described by area will be uploaded.

◆ getWidth()

uint OpenGL::Texture::getWidth ( void  ) const
inline

Query the GL texture's width.

◆ getHeight()

uint OpenGL::Texture::getHeight ( void  ) const
inline

Query the GL texture's height.

◆ getLogicalWidth()

uint OpenGL::Texture::getLogicalWidth ( ) const
inline

Query the logical texture's width.

◆ getLogicalHeight()

uint OpenGL::Texture::getLogicalHeight ( ) const
inline

Query the logical texture's height.

◆ getTexCoords()

const GLfloat* OpenGL::Texture::getTexCoords ( ) const
inline

Obtain texture coordinates for rectangular drawing.

◆ getGLTexture()

GLuint OpenGL::Texture::getGLTexture ( ) const
inline

Obtain texture name.

Beware that the texture name changes whenever create is used. destroy will invalidate the texture name.


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