Texture base class which encapsulates OpenGl texture functionality which common betweent the various types of OpenGL textures
Inheritance:
Public Classes
-
enum WrapParameter
-
enum WrapMode
-
enum FilterParameter
-
enum FilterMode
-
enum InternalFormatMode
-
enum ShadowCompareFunc
-
enum ShadowTextureMode
-
class SG_EXPORT Extensions: public osg::Referenced
- Extensions class which encapsulates the querring of extensions and associated function pointers, and provide convinience wrappers to check for the extensions or use the associated functions
-
class TextureObject: public osg::Referenced
-
class SG_EXPORT TextureObjectManager: public osg::Referenced
Public Fields
-
mutable TextureObjectBuffer _textureObjectBuffer
Public Methods
-
Texture()
-
Texture(const Texture& text, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
- Copy constructor using CopyOp to manage deep vs shallow copy
-
virtual osg::Object* cloneType() const
-
virtual osg::Object* clone(const CopyOp& copyop) const
-
virtual bool isSameKindAs(const osg::Object* obj) const
-
virtual const char* libraryName() const
-
virtual const char* className() const
-
virtual Type getType() const
-
virtual bool isTextureAttribute() const
-
void setWrap(WrapParameter which, WrapMode wrap)
- Set the texture wrap mode
-
WrapMode getWrap(WrapParameter which) const
- Get the texture wrap mode
-
void setBorderColor(const Vec4& color)
- Set the border color for this texture.
-
const Vec4& getBorderColor() const
- Get the border color for this texture
-
void setBorderWidth(GLint width)
- Set the border width
-
GLint getBorderWidth() const
-
void setFilter(FilterParameter which, FilterMode filter)
- Set the texture filter mode
-
FilterMode getFilter(FilterParameter which) const
- Get the texture filter mode
-
void setMaxAnisotropy(float anis)
- Set the maximum anisotropy value, default value is 10 for no anisotropic filtering.
-
inline float getMaxAnisotropy() const
- Get the maximum anisotropy value
-
inline void setUseHardwareMipMapGeneration(bool useHardwareMipMapGeneration)
- Set the hint of whether to use hardware mip map generation where available
-
inline bool getUseHardwareMipMapGeneration() const
- Get the hint of whether to use hardware mip map generation where available
-
inline void setUnRefImageDataAfterApply(bool flag)
- Set the automatic unreference of image data after the texture has been set up in apply, on (true) or off (false).
-
inline bool getUnRefImageDataAfterApply() const
- Get the automatic unreference of image data after the texture has been set up in apply
-
inline void setClientStorageHint(bool flag)
- Set whether to use client storage of the texture where supported by OpenGL drivers.
-
inline bool getClientStorageHint() const
- Get whether to use client storage of the texture where supported by OpenGL drivers
-
inline void setInternalFormatMode(InternalFormatMode mode)
- Set the internal format mode.
-
inline InternalFormatMode getInternalFormatMode() const
- Get the internal format mode
-
inline void setInternalFormat(GLint internalFormat)
- Set the internal format to use when creating OpenGL textures.
-
inline GLint getInternalFormat() const
- Get the internal format to use when creating OpenGL textures
-
bool isCompressedInternalFormat() const
-
inline TextureObject* getTextureObject(unsigned int 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
-
bool areAllTextureObjectsLoaded() const
- return true if the texture objects for all the required graphics contexts are loaded
-
inline unsigned int& getTextureParameterDirty(unsigned int contextID) const
- get the dirty flag for the current contextID
-
void dirtyTextureParameters()
- Force a resetting on next apply() of associated OpenGL texture parameters
-
void setShadowComparison(bool flag)
-
void setShadowCompareFunc(ShadowCompareFunc func)
-
ShadowCompareFunc getShadowCompareFunc()
-
void setShadowTextureMode(ShadowTextureMode mode)
-
ShadowTextureMode getShadowTextureMode()
-
void setShadowAmbient(float shadow_ambient)
-
float getShadowAmbient()
-
virtual void setImage(unsigned int face, Image* image)
- Set the texture image for specified face.
-
virtual Image* getImage(unsigned int face)
- Get the texture image for specified face.
-
virtual const Image* getImage(unsigned int face) const
- Get the const texture image for specified face.
-
virtual unsigned int getNumImages() const
- Get the number of images that can be assigned to the Texture.
-
virtual void apply(State& state) const
- Texture is pure virtual base class, apply must be overriden.
-
virtual void compileGLObjects(State& state) const
- Calls apply(state) to compile the texture.
-
virtual void releaseGLObjects(State* state=0) const
- release an OpenGL objects in specified graphics context if State object is passed, otherwise release OpenGL objexts for all graphics context if State object pointer NULL
-
static Extensions* getExtensions(unsigned int contextID, bool createIfNotInitalized)
- Function to call to get the extension of a specified context.
-
static void setExtensions(unsigned int contextID, Extensions* extensions)
- setExtensions allows users to override the extensions across graphics contexts.
-
void applyTexImage2D_load(State& state, GLenum target, const Image* image, GLsizei width, GLsizei height, GLsizei numMipmapLevels) const
- Helper method which does the creation of the texture itself, but does not set or use texture binding.
-
void applyTexImage2D_subload(State& state, GLenum target, const Image* image, GLsizei width, GLsizei height, GLint inInternalFormat, GLsizei numMipmapLevels) const
- Helper method which subloads images to the texture itself, but does not set or use texture binding.
-
void takeTextureObjects(TextureObjectListMap& toblm)
- take the active texture objects from the Texture and place them in the specified TextureObjectListMap
-
static void setTextureObjectManager(TextureObjectManager* tom)
-
static TextureObjectManager* getTextureObjectManager()
-
static void flushTextureObjects(unsigned int contextID, double currentTime, double& availableTime)
Public
-
typedef std::list< ref_ptr<TextureObject> > TextureObjectList
-
typedef std::map<unsigned int, TextureObjectList > TextureObjectListMap
-
typedef buffered_object< ref_ptr<TextureObject> > TextureObjectBuffer
Protected Fields
-
mutable TexParameterDirtyList _texParametersDirtyList
-
WrapMode _wrap_s
-
WrapMode _wrap_t
-
WrapMode _wrap_r
-
FilterMode _min_filter
-
FilterMode _mag_filter
-
float _maxAnisotropy
-
bool _useHardwareMipMapGeneration
-
bool _unrefImageDataAfterApply
-
bool _clientStorageHint
-
Vec4 _borderColor
-
GLint _borderWidth
-
InternalFormatMode _internalFormatMode
-
mutable GLint _internalFormat
-
bool _use_shadow_comparison
-
ShadowCompareFunc _shadow_compare_func
-
ShadowTextureMode _shadow_texture_mode
-
float _shadow_ambient
Protected Methods
-
virtual ~Texture()
-
virtual void computeInternalFormat() const
-
void computeInternalFormatWithImage(const osg::Image& image) const
-
void computeRequiredTextureDimensions(State& state, const osg::Image& image, GLsizei& width, GLsizei& height, GLsizei& numMipmapLevels) const
-
bool isCompressedInternalFormat(GLint internalFormat) const
-
void applyTexParameters(GLenum target, State& state) const
- Helper method which does setting of texture paramters.
-
int compareTexture(const Texture& rhs) const
- return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs
Protected
-
typedef buffered_value<unsigned int> TexParameterDirtyList
Public Classes
-
enum Values
-
enum Types
-
struct ModeUsage
Public Methods
-
virtual int compare(const StateAttribute& sa) const
-
bool operator < (const StateAttribute& rhs) const
-
bool operator == (const StateAttribute& rhs) const
-
bool operator != (const StateAttribute& rhs) const
-
virtual bool getModeUsage(ModeUsage&) const
Public
-
typedef GLenum GLMode
-
typedef unsigned int GLModeValue
-
typedef unsigned int OverrideValue
-
typedef unsigned int Type
Inherited from Object:
Public Classes
-
enum DataVariance
Public Methods
-
inline void setDataVariance(DataVariance dv)
-
inline DataVariance getDataVariance() const
-
inline void setUserData(Referenced* obj)
-
inline Referenced* getUserData()
-
inline const Referenced* getUserData() const
Protected Fields
-
DataVariance _dataVariance
-
ref_ptr<Referenced> _userData
Public Methods
-
inline Referenced& operator = (const Referenced&)
-
static void setDeleteHandler(DeleteHandler* handler)
-
static DeleteHandler* getDeleteHandler()
-
inline void ref() const
-
inline void unref_nodelete() const
-
inline int referenceCount() const
-
inline void unref() const
Protected Fields
-
mutable OpenThreads::Mutex _refMutex
-
mutable int _refCount
Documentation
Texture base class which encapsulates OpenGl texture functionality which common betweent the various types of OpenGL textures
- Texture()
- Texture(const Texture& text, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
- Copy constructor using CopyOp to manage deep vs shallow copy
- virtual osg::Object* cloneType() const
- virtual osg::Object* clone(const CopyOp& copyop) const
- virtual bool isSameKindAs(const osg::Object* obj) const
- virtual const char* libraryName() const
- virtual const char* className() const
- virtual Type getType() const
- virtual bool isTextureAttribute() const
- enum WrapParameter
- WRAP_S
- WRAP_T
- WRAP_R
- enum WrapMode
- CLAMP
- CLAMP_TO_EDGE
- CLAMP_TO_BORDER
- REPEAT
- MIRROR
- void setWrap(WrapParameter which, WrapMode wrap)
- Set the texture wrap mode
- WrapMode getWrap(WrapParameter which) const
- Get the texture wrap mode
- void setBorderColor(const Vec4& color)
- Set the border color for this texture. Makes difference only if
wrap mode is CLAMP_TO_BORDER
- const Vec4& getBorderColor() const
- Get the border color for this texture
- void setBorderWidth(GLint width)
- Set the border width
- GLint getBorderWidth() const
- enum FilterParameter
- MIN_FILTER
- MAG_FILTER
- enum FilterMode
- LINEAR
- LINEAR_MIPMAP_LINEAR
- LINEAR_MIPMAP_NEAREST
- NEAREST
- NEAREST_MIPMAP_LINEAR
- NEAREST_MIPMAP_NEAREST
- void setFilter(FilterParameter which, FilterMode filter)
- Set the texture filter mode
- FilterMode getFilter(FilterParameter which) const
- Get the texture filter mode
- void setMaxAnisotropy(float anis)
- Set the maximum anisotropy value, default value is 10 for
no anisotropic filtering. If hardware does not support anisotropic
filtering then normal filtering is used, equivilant to a max anisotropy value of 1.0.
valid range is 1.0f upwards. The maximum value depends on the graphics
system being used.
- inline float getMaxAnisotropy() const
- Get the maximum anisotropy value
- inline void setUseHardwareMipMapGeneration(bool useHardwareMipMapGeneration)
- Set the hint of whether to use hardware mip map generation where available
- inline bool getUseHardwareMipMapGeneration() const
- Get the hint of whether to use hardware mip map generation where available
- inline void setUnRefImageDataAfterApply(bool flag)
- Set the automatic unreference of image data after the texture has been set up in apply, on (true) or off (false).
If the image data is only referened by this Texture then the image data will be autoamtically deleted.
- inline bool getUnRefImageDataAfterApply() const
- Get the automatic unreference of image data after the texture has been set up in apply
- inline void setClientStorageHint(bool flag)
- Set whether to use client storage of the texture where supported by OpenGL drivers.
Note, if UseClientStorageHint is set, and the OpenGL drivers support it, the osg::Image(s) associated with
this texture cannot be deleted, so the UnRefImageDataAfterApply flag is then ignored.
- inline bool getClientStorageHint() const
- Get whether to use client storage of the texture where supported by OpenGL drivers
- 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(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 _internalFormat.
- inline InternalFormatMode getInternalFormatMode() const
- Get the internal format mode
- inline void setInternalFormat(GLint internalFormat)
- Set the internal format to use when creating OpenGL textures.
Also sets the internalFormatMode to USE_USER_DEFINED_FORMAT.
- inline GLint getInternalFormat() const
- Get the internal format to use when creating OpenGL textures
- bool isCompressedInternalFormat() const
- inline TextureObject* getTextureObject(unsigned int 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
- bool areAllTextureObjectsLoaded() const
- return true if the texture objects for all the required graphics contexts are loaded
- inline unsigned int& getTextureParameterDirty(unsigned int contextID) const
- get the dirty flag for the current contextID
- void dirtyTextureParameters()
- Force a resetting on next apply() of associated OpenGL texture parameters
- void setShadowComparison(bool flag)
- enum ShadowCompareFunc
- LEQUAL
- GEQUAL
- void setShadowCompareFunc(ShadowCompareFunc func)
- ShadowCompareFunc getShadowCompareFunc()
- enum ShadowTextureMode
- LUMINANCE
- INTENSITY
- ALPHA
- void setShadowTextureMode(ShadowTextureMode mode)
- ShadowTextureMode getShadowTextureMode()
- void setShadowAmbient(float shadow_ambient)
- float getShadowAmbient()
- virtual void setImage(unsigned int face, Image* image)
- Set the texture image for specified face.
- virtual Image* getImage(unsigned int face)
- Get the texture image for specified face.
- virtual const Image* getImage(unsigned int face) const
- Get the const texture image for specified face.
- virtual unsigned int getNumImages() const
- Get the number of images that can be assigned to the Texture.
- virtual void apply(State& state) const
- Texture is pure virtual base class, apply must be overriden.
- virtual void compileGLObjects(State& state) const
- Calls apply(state) to compile the texture.
- virtual void releaseGLObjects(State* state=0) const
- release an OpenGL objects in specified graphics context if State
object is passed, otherwise release OpenGL objexts for all graphics context if
State object pointer NULL
- static Extensions* getExtensions(unsigned int contextID, bool createIfNotInitalized)
- Function to call to get the extension of a specified context.
If the Exentsion object for that context has not yet been created then
and the 'createIfNotInitalized' flag been set to false then returns NULL.
If 'createIfNotInitalized' is true then the Extensions object is
automatically created. However, in this case the extension object
only be created with the graphics context associated with ContextID..
- static void setExtensions(unsigned int contextID, Extensions* extensions)
- setExtensions allows users to override the extensions across graphics contexts.
typically used when you have different extensions supported across graphics pipes
but need to ensure that they all use the same low common denominator extensions.
- void applyTexImage2D_load(State& state, GLenum target, const Image* image, GLsizei width, GLsizei height, GLsizei numMipmapLevels) const
- Helper method which does the creation of the texture itself, but does not set or use texture binding.
Note, do not call this method directly unless you are implementing your own Subload callback
- void applyTexImage2D_subload(State& state, GLenum target, const Image* image, GLsizei width, GLsizei height, GLint inInternalFormat, GLsizei numMipmapLevels) const
- Helper method which subloads images to the texture itself, but does not set or use texture binding.
Note, do not call this method directly unless you are implementing your own Subload callback
- virtual ~Texture()
- virtual void computeInternalFormat() const
- void computeInternalFormatWithImage(const osg::Image& image) const
- void computeRequiredTextureDimensions(State& state, const osg::Image& image, GLsizei& width, GLsizei& height, GLsizei& numMipmapLevels) const
- bool isCompressedInternalFormat(GLint internalFormat) const
- void applyTexParameters(GLenum target, State& state) const
- Helper method which does setting of texture paramters.
- int compareTexture(const Texture& rhs) const
- return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs
- typedef buffered_value<unsigned int> TexParameterDirtyList
- mutable TexParameterDirtyList _texParametersDirtyList
- WrapMode _wrap_s
- WrapMode _wrap_t
- WrapMode _wrap_r
- FilterMode _min_filter
- FilterMode _mag_filter
- float _maxAnisotropy
- bool _useHardwareMipMapGeneration
- bool _unrefImageDataAfterApply
- bool _clientStorageHint
- Vec4 _borderColor
- GLint _borderWidth
- InternalFormatMode _internalFormatMode
- mutable GLint _internalFormat
- bool _use_shadow_comparison
- ShadowCompareFunc _shadow_compare_func
- ShadowTextureMode _shadow_texture_mode
- float _shadow_ambient
- typedef std::list< ref_ptr<TextureObject> > TextureObjectList
- typedef std::map<unsigned int, TextureObjectList > TextureObjectListMap
- void takeTextureObjects(TextureObjectListMap& toblm)
- take the active texture objects from the Texture and place them in the specified TextureObjectListMap
- typedef buffered_object< ref_ptr<TextureObject> > TextureObjectBuffer
- mutable TextureObjectBuffer _textureObjectBuffer
- static void setTextureObjectManager(TextureObjectManager* tom)
- static TextureObjectManager* getTextureObjectManager()
- static void flushTextureObjects(unsigned int contextID, double currentTime, double& availableTime)
- Direct child classes:
- TextureRectangle
TextureCubeMap
Texture3D
Texture2D
Texture1D
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.