## class SG_EXPORT osg::Texture

> Texture base class which encapsulates OpenGl texture functionality which common betweent the various types of OpenGL textures

## Inheritance:

### 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 = 0
virtual osg::Object* clone(const CopyOp& copyop) const = 0
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)
  Sets the border color for this texture.
const Vec4& getBorderColor() 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 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
virtual void apply(State& state) const = 0
  Texture is pure virtual base class, apply must be overriden.
virtual void compile(State& state) const
  Calls apply(state) to compile the texture.
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, 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 Members

enum WrapParameter
enum WrapMode
enum FilterParameter
enum FilterMode
enum InternalFormatMode
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
typedef std::list< ref_ptr<TextureObject> > TextureObjectList
typedef std::map<unsigned int, TextureObjectList > TextureObjectListMap
typedef buffered_object< ref_ptr<TextureObject> > TextureObjectBuffer
class SG_EXPORT TextureObjectManager: public osg::Referenced

### 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
Vec4 _borderColor
InternalFormatMode _internalFormatMode
mutable GLint _internalFormat

### Protected Methods

virtual ~Texture()
virtual void computeInternalFormat() const = 0
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 Members

typedef buffered_value<unsigned int> TexParameterDirtyList

### Inherited from StateAttribute:

### 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 void getAssociatedModes(std::vector<GLMode>& ) 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 void setDataVariance(DataVariance dv)
inline DataVariance getDataVariance() const
inline void setUserData(Referenced* obj)
inline Referenced* getUserData()
inline const Referenced* getUserData() const

### Public Members

enum DataVariance

### Protected Fields

DataVariance _dataVariance
ref_ptr<Referenced> _userData

### Inherited from Referenced:

### Public Methods

inline Referenced& operator = (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 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 = 0`

`virtual osg::Object* clone(const CopyOp& copyop) const = 0`

`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)`
  Sets the border color for this texture. Makes difference only if wrap mode is CLAMP_TO_BORDER

`const Vec4& getBorderColor() 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

`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

`virtual void apply(State& state) const = 0`
  Texture is pure virtual base class, apply must be overriden.

`virtual void compile(State& state) const`
  Calls apply(state) to compile the texture.

`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, 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 = 0`

`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`

`Vec4 _borderColor`

`InternalFormatMode _internalFormatMode`

`mutable GLint _internalFormat`

`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++.