KGLLib
KGLLib::TextureBase Class Reference
#include <texture.h>

Detailed Description
Abstract base class for all textures.This class includes basic functionality such as bind/unbind and enable/disable methods which all textures have.
See Texture class documentation for more detailed introduction and examples.
- See also:
- Texture
Definition at line 44 of file texture.h.
Public Member Functions | |
| virtual void | bind () const |
| virtual QString | debugString () const |
| virtual void | disable (bool unbind=true) const |
| virtual void | enable (bool bind=true) const |
| virtual GLuint | glId () const |
| virtual GLenum | glTarget () const =0 |
| bool | isValid () const |
| QString | name () const |
| virtual void | setFilter (GLenum filter) |
| void | setName (const QString &name) |
| virtual void | setWrapMode (GLenum mode)=0 |
| virtual void | setWrapMode (GLenum coordinate, GLenum mode) |
| TextureBase (const QString &name) | |
| TextureBase () | |
| virtual void | unbind () const |
| virtual | ~TextureBase () |
Protected Member Functions | |
| void | setValid (bool valid) |
Protected Attributes | |
| GLenum | mFormat |
| GLuint | mGLId |
| GLenum | mInternalFormat |
| QString | mName |
| bool | mValid |
Constructor & Destructor Documentation
| KGLLib::TextureBase::TextureBase | ( | ) |
Creates new invalid texture.
It is up to subclasses to actually initialize the texture. TODO: should we do glGenTextures() here or in subclasses? Probably latter.
Definition at line 155 of file texture.cpp.
| KGLLib::TextureBase::TextureBase | ( | const QString & | name | ) |
| KGLLib::TextureBase::~TextureBase | ( | ) | [virtual] |
Member Function Documentation
| void KGLLib::TextureBase::bind | ( | ) | const [virtual] |
| QString KGLLib::TextureBase::debugString | ( | ) | const [virtual] |
Definition at line 218 of file texture.cpp.
| void KGLLib::TextureBase::disable | ( | bool | unbind = true |
) | const [virtual] |
Disables texturing with this texture type for currently active texture unit.
- Parameters:
-
unbind if true then unbind() is called before disabling texturing
Definition at line 193 of file texture.cpp.
| void KGLLib::TextureBase::enable | ( | bool | bind = true |
) | const [virtual] |
Enables texturing with this texture type for currently active texture unit.
- Parameters:
-
bind if true then bind() is called after enabling texturing
Definition at line 185 of file texture.cpp.
| virtual GLuint KGLLib::TextureBase::glId | ( | ) | const [inline, virtual] |
| virtual GLenum KGLLib::TextureBase::glTarget | ( | ) | const [pure virtual] |
TODO: maybe rename to glType().
- Returns:
- type of this texture (e.g. GL_TEXTURE_2D)
Implemented in KGLLib::Texture, and KGLLib::Texture3D.
| bool KGLLib::TextureBase::isValid | ( | ) | const [inline] |
| QString KGLLib::TextureBase::name | ( | ) | const [inline] |
| void KGLLib::TextureBase::setFilter | ( | GLenum | filter | ) | [virtual] |
Sets texture's filter to filter.
filter is minification filter, magnification filter is set to GL_NEAREST if filter is GL_NEAREST and to GL_LINEAR otherwise.
Common values are:
- GL_NEAREST - return nearest pixel. Usually you don't want this.
- GL_LINEAR - return weighed average of neighboring pixels.
- GL_NEAREST_MIPMAP_LINEAR - same as GL_LINEAR but uses nearest MIPMAP (aka bilinear).
- GL_LINEAR_MIPMAP_LINEAR - uses GL_LINEAR on two neighboring mipmaps and then takes weighed average of them (aka trilinear) TODO: some better wording here GL_LINEAR_MIPMAP_LINEAR usually gives best quality but uses a third more memory and has a bit lower performance.
Definition at line 201 of file texture.cpp.
| void KGLLib::TextureBase::setName | ( | const QString & | name | ) |
Sets texture's name to name.
The name doesn't have any connection with OpenGL but it can be used to identify textures when debugging.
Definition at line 213 of file texture.cpp.
| void KGLLib::TextureBase::setValid | ( | bool | valid | ) | [inline, protected] |
| virtual void KGLLib::TextureBase::setWrapMode | ( | GLenum | mode | ) | [pure virtual] |
Sets wrap mode for all coordinates of this texture.
Subclasses need to reimplement this, calling setWrapMode() for every possible coordinate.
Implemented in KGLLib::Texture, and KGLLib::Texture3D.
| void KGLLib::TextureBase::setWrapMode | ( | GLenum | coordinate, | |
| GLenum | mode | |||
| ) | [virtual] |
Sets texture wrap mode for given coordinate.
Wrap mode controls how exactly the texture coordinates are interpreted:
- GL_REPEAT is default and ignores integer part of the texture coordinate, causing the texture to be repeated.
- GL_CLAMP clamps coordinates to range [0; 1]. TODO: explain other modes as well
Definition at line 208 of file texture.cpp.
| void KGLLib::TextureBase::unbind | ( | ) | const [virtual] |
Unbinds the texture.
After calling this, no texture is bound but texturing may still be enabled (in which case texturing results are undefined). TODO: is this meanful or should it be removed (as users usually want to either disable() texturing or just bind() another texture)?
Definition at line 180 of file texture.cpp.
Member Data Documentation
GLenum KGLLib::TextureBase::mFormat [protected] |
GLuint KGLLib::TextureBase::mGLId [protected] |
GLenum KGLLib::TextureBase::mInternalFormat [protected] |
QString KGLLib::TextureBase::mName [protected] |
bool KGLLib::TextureBase::mValid [protected] |
The documentation for this class was generated from the following files:
KDE 4.2 API Reference