Texture state class which encapsulates OpenGl texture functionality
Inheritance:
Public Methods
-
Texture()
-
Texture(const Texture& text, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
- Copy constructor using CopyOp to manage deep vs shallow copy
-
META_StateAttribute(Texture, (Type)(TEXTURE_0+_textureUnit))
-
virtual int compare(const StateAttribute& rhs) const
- return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs
-
virtual void setStateSetModes(StateSet& ds, const GLModeValue value) const
-
void setImage(Image* image)
- Set the texture image.
-
Image* getImage()
- Get the texture image.
-
inline const Image* getImage() const
- Get the const texture image.
-
void copyTexImage2D(State& state, int x, int y, int width, int height )
- Copy pixels into a 2D texture imageAs per glCopyTexImage2D.
-
void copyTexSubImage2D(State& state, int xoffset, int yoffset, int x, int y, int width, int height )
- Copy a two-dimensional texture subimage.
-
inline void setTextureUnit(const unsigned int textureUnit)
- Set the texture unit.
-
inline const unsigned int getTextureUnit() const
- get the texture unit
-
void setWrap(const WrapParameter which, const WrapMode wrap)
- Set the texture wrap mode
-
const WrapMode getWrap(const WrapParameter which) const
- Get the texture wrap mode
-
void setFilter(const FilterParameter which, const FilterMode filter)
- Set the texture filter mode
-
const FilterMode getFilter(const FilterParameter which) const
- Get the texture filter mode
-
inline void setInternalFormatMode(const InternalFormatMode mode)
- Set the internal format mode.
-
inline const InternalFormatMode getInternalFormatMode() const
- Get the internal format mode
-
inline void setInternalFormatValue(const int internalFormat)
- Set the internal format to use when creating OpenGL textures.
-
inline const int getInternalFormatValue() const
- Get the internal format to use when creating OpenGL textures
-
inline const uint getTextureObject(const uint contextID) const
- return the OpenGL texture object for specified context
-
inline const uint getTextureObjectSize() const
- return the memory size of texture object.
-
inline void setSubloadMode(const SubloadMode mode)
- Set the texture subload mode.
-
inline const SubloadMode getSubloadMode() const
- Get the texture subload mode.
-
inline void setSubloadOffset(const int x, const int y)
- Set the texture subload offsets.
-
inline void getSubloadOffset(int& x, int& y) const
- Get the texture subload offsets.
-
inline GLuint& getHandle(const uint contextID) const
- Get the handle to the texture object for the current context
-
void dirtyTextureObject()
- Force a recompile on next apply() of associated OpenGL texture objects
-
virtual void apply(State& state) const
- On first apply (unless already compiled), create the minmapped texture and bind it, subsequent apply will simple bind to texture
-
virtual void compile(State& state) const
- Compile the texture mip maps.
-
virtual void applyImmediateMode(State& state) const
- Method which does the creation of the texture itself, and does not set or use texture binding.
-
static void deleteTextureObject(uint contextID, GLuint handle)
- use deleteTextureObject instead of glDeleteTextures to allow OpenGL texture objects to cached until they can be deleted by the OpenGL context in which they were created, specified by contextID
-
static void flushDeletedTextureObjects(uint contextID)
- flush all the cached display list which need to be deleted in the OpenGL context related to contextID
Public Members
-
enum WrapParameter
-
enum WrapMode
-
enum FilterParameter
-
enum FilterMode
-
enum InternalFormatMode
-
enum SubloadMode
Protected Fields
-
mutable uint _textureObjectSize
-
mutable ref_ptr<Image> _image
-
unsigned int _textureUnit
-
WrapMode _wrap_s
-
WrapMode _wrap_t
-
WrapMode _wrap_r
-
FilterMode _min_filter
-
FilterMode _mag_filter
-
InternalFormatMode _internalFormatMode
-
int _internalFormatValue
-
mutable unsigned int _textureWidth
-
mutable unsigned int _textureHeight
-
SubloadMode _subloadMode
-
unsigned int _subloadOffsX
-
unsigned int _subloadOffsY
Protected Methods
-
virtual ~Texture()
Protected Members
-
typedef std::vector<GLuint> TextureNameList mutable TextureNameList _handleList
-
typedef std::vector<uint> ImageModifiedTag mutable ImageModifiedTag _modifiedTag
-
typedef std::map<uint,std::set<uint> >static DeletedTextureObjectCache DeletedTextureObjectCache s_deletedTextureObjectCache
Public Methods
-
virtual Object* cloneType() const
-
virtual Object* clone(const CopyOp&) const
-
virtual bool isSameKindAs(const Object* obj) const
-
virtual const char* className() const
-
virtual const Type getType() const
-
bool operator < (const StateAttribute& rhs) const
-
bool operator == (const StateAttribute& rhs) const
-
bool operator != (const StateAttribute& rhs) const
Public Members
-
typedef GLenum GLMode
-
typedef unsigned int GLModeValue
-
typedef unsigned int OverrideValue
-
enum Values
-
typedef unsigned int Type
-
enum Types
Inherited from Object:
Public Methods
-
inline Referenced& operator = (Referenced&)
-
inline void ref() const
-
inline void unref() const
-
inline const int referenceCount() const
Protected Fields
-
mutable int _refCount
Documentation
Texture state class which encapsulates OpenGl texture functionality
Texture()
Texture(const Texture& text, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
- Copy constructor using CopyOp to manage deep vs shallow copy
META_StateAttribute(Texture, (Type)(TEXTURE_0+_textureUnit))
virtual int compare(const StateAttribute& rhs) const
- return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs
virtual void setStateSetModes(StateSet& ds, const GLModeValue value) const
void setImage(Image* image)
- Set the texture image.
Image* getImage()
- Get the texture image.
inline const Image* getImage() const
- Get the const texture image.
void copyTexImage2D(State& state, int x, int y, int width, int height )
- Copy pixels into a 2D texture imageAs per glCopyTexImage2D.
Creates an OpenGL texture object from the current OpenGL background
framebuffer contents at pos \a x, \a y with width \a width and
height \a height. \a width and \a height must be a power of two.
void copyTexSubImage2D(State& state, int xoffset, int yoffset, int x, int y, int width, int height )
- Copy a two-dimensional texture subimage. As per glCopyTexSubImage2D.
Updates portion of an existing OpenGL texture object from the current OpenGL background
framebuffer contents at pos \a x, \a y with width \a width and
height \a height. \a width and \a height must be a power of two,
and writing into the texture with offset \a xoffset and \a yoffset.
inline void setTextureUnit(const unsigned int textureUnit)
- Set the texture unit.
Valid values are 0,1,2,3.
Default value of texture unit is 0.
note, multi-texturing not fully implemented yet... April 2001.
inline const unsigned int getTextureUnit() const
- get the texture unit
enum WrapParameter
WRAP_S
WRAP_T
WRAP_R
enum WrapMode
CLAMP
CLAMP_TO_EDGE
REPEAT
MIRROR
void setWrap(const WrapParameter which, const WrapMode wrap)
- Set the texture wrap mode
const WrapMode getWrap(const WrapParameter which) const
- Get the texture wrap mode
enum FilterParameter
MIN_FILTER
MAG_FILTER
enum FilterMode
LINEAR
LINEAR_MIPMAP_LINEAR
LINEAR_MIPMAP_NEAREST
NEAREST
NEAREST_MIPMAP_LINEAR
NEAREST_MIPMAP_NEAREST
ANISOTROPIC
void setFilter(const FilterParameter which, const FilterMode filter)
- Set the texture filter mode
const FilterMode getFilter(const FilterParameter which) const
- Get the texture filter mode
enum InternalFormatMode
USE_IMAGE_DATA_FORMAT
USE_USER_DEFINED_FORMAT
USE_ARB_COMPRESSION
USE_S3TC_DXT1_COMPRESSION
USE_S3TC_DXT3_COMPRESSION
USE_S3TC_DXT5_COMPRESSION
inline void setInternalFormatMode(const InternalFormatMode mode)
- Set the internal format mode.
Note, If the mode is set USE_IMAGE_DATA_FORMAT, USE_ARB_COMPRESSION,
USE_S3TC_COMPRESSION the internalFormat is automatically selected,
and will overwrite the previous _internalFormatValue.
inline const InternalFormatMode getInternalFormatMode() const
- Get the internal format mode
inline void setInternalFormatValue(const int internalFormat)
- Set the internal format to use when creating OpenGL textures.
Also sets the internalFormatMode to USE_USER_DEFINED_FORMAT.
inline const int getInternalFormatValue() const
- Get the internal format to use when creating OpenGL textures
inline const uint getTextureObject(const uint contextID) const
- return the OpenGL texture object for specified context
inline const uint getTextureObjectSize() const
- return the memory size of texture object.
Texture object size can be used for estimating the cost of
uploading the texture to graphics hardware, which in turn can
be used for setting texture residence priorities.
enum SubloadMode
OFF
AUTO
IF_DIRTY
inline void setSubloadMode(const SubloadMode mode)
- Set the texture subload mode.
inline const SubloadMode getSubloadMode() const
- Get the texture subload mode.
inline void setSubloadOffset(const int x, const int y)
- Set the texture subload offsets.
inline void getSubloadOffset(int& x, int& y) const
- Get the texture subload offsets.
inline GLuint& getHandle(const uint contextID) const
- Get the handle to the texture object for the current context
void dirtyTextureObject()
- Force a recompile on next apply() of associated OpenGL texture objects
virtual void apply(State& state) const
- On first apply (unless already compiled), create the minmapped
texture and bind it, subsequent apply will simple bind to texture
virtual void compile(State& state) const
- Compile the texture mip maps. Implemented by simply calling apply().
virtual void applyImmediateMode(State& state) const
- Method which does the creation of the texture itself, and
does not set or use texture binding.
static void deleteTextureObject(uint contextID, GLuint handle)
- use deleteTextureObject instead of glDeleteTextures to allow
OpenGL texture objects to cached until they can be deleted
by the OpenGL context in which they were created, specified
by contextID
static void flushDeletedTextureObjects(uint contextID)
- flush all the cached display list which need to be deleted
in the OpenGL context related to contextID
virtual ~Texture()
typedef std::vector<GLuint> TextureNameList mutable TextureNameList _handleList
typedef std::vector<uint> ImageModifiedTag mutable ImageModifiedTag _modifiedTag
mutable uint _textureObjectSize
mutable ref_ptr<Image> _image
unsigned int _textureUnit
WrapMode _wrap_s
WrapMode _wrap_t
WrapMode _wrap_r
FilterMode _min_filter
FilterMode _mag_filter
InternalFormatMode _internalFormatMode
int _internalFormatValue
mutable unsigned int _textureWidth
mutable unsigned int _textureHeight
SubloadMode _subloadMode
unsigned int _subloadOffsX
unsigned int _subloadOffsY
typedef std::map<uint,std::set<uint> >static DeletedTextureObjectCache DeletedTextureObjectCache s_deletedTextureObjectCache
- This class has no child classes.
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.