class SG_EXPORT osg::Texture

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

Inheritance:


Public Classes

[more]enum WrapParameter
[more]enum WrapMode
[more]enum FilterParameter
[more]enum FilterMode
[more]enum InternalFormatMode
[more]enum ShadowCompareFunc
[more]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

[more]mutable TextureObjectBuffer _textureObjectBuffer

Public Methods

[more] Texture()
[more] Texture(const Texture& text, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy
[more]virtual osg::Object* cloneType() const
[more]virtual osg::Object* clone(const CopyOp& copyop) const
[more]virtual bool isSameKindAs(const osg::Object* obj) const
[more]virtual const char* libraryName() const
[more]virtual const char* className() const
[more]virtual Type getType() const
[more]virtual bool isTextureAttribute() const
[more]void setWrap(WrapParameter which, WrapMode wrap)
Set the texture wrap mode
[more]WrapMode getWrap(WrapParameter which) const
Get the texture wrap mode
[more]void setBorderColor(const Vec4& color)
Set the border color for this texture.
[more]const Vec4& getBorderColor() const
Get the border color for this texture
[more]void setBorderWidth(GLint width)
Set the border width
[more]GLint getBorderWidth() const
[more]void setFilter(FilterParameter which, FilterMode filter)
Set the texture filter mode
[more]FilterMode getFilter(FilterParameter which) const
Get the texture filter mode
[more]void setMaxAnisotropy(float anis)
Set the maximum anisotropy value, default value is 10 for no anisotropic filtering.
[more]inline float getMaxAnisotropy() const
Get the maximum anisotropy value
[more]inline void setUseHardwareMipMapGeneration(bool useHardwareMipMapGeneration)
Set the hint of whether to use hardware mip map generation where available
[more]inline bool getUseHardwareMipMapGeneration() const
Get the hint of whether to use hardware mip map generation where available
[more]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).
[more]inline bool getUnRefImageDataAfterApply() const
Get the automatic unreference of image data after the texture has been set up in apply
[more]inline void setClientStorageHint(bool flag)
Set whether to use client storage of the texture where supported by OpenGL drivers.
[more]inline bool getClientStorageHint() const
Get whether to use client storage of the texture where supported by OpenGL drivers
[more]inline void setInternalFormatMode(InternalFormatMode mode)
Set the internal format mode.
[more]inline InternalFormatMode getInternalFormatMode() const
Get the internal format mode
[more]inline void setInternalFormat(GLint internalFormat)
Set the internal format to use when creating OpenGL textures.
[more]inline GLint getInternalFormat() const
Get the internal format to use when creating OpenGL textures
[more]bool isCompressedInternalFormat() const
[more]inline TextureObject* getTextureObject(unsigned int contextID) const
Get the handle to the texture object for the current context
[more]void dirtyTextureObject()
Force a recompile on next apply() of associated OpenGL texture objects
[more]bool areAllTextureObjectsLoaded() const
return true if the texture objects for all the required graphics contexts are loaded
[more]inline unsigned int& getTextureParameterDirty(unsigned int contextID) const
get the dirty flag for the current contextID
[more]void dirtyTextureParameters()
Force a resetting on next apply() of associated OpenGL texture parameters
[more]void setShadowComparison(bool flag)
[more]void setShadowCompareFunc(ShadowCompareFunc func)
[more]ShadowCompareFunc getShadowCompareFunc()
[more]void setShadowTextureMode(ShadowTextureMode mode)
[more]ShadowTextureMode getShadowTextureMode()
[more]void setShadowAmbient(float shadow_ambient)
[more]float getShadowAmbient()
[more]virtual void setImage(unsigned int face, Image* image)
Set the texture image for specified face.
[more]virtual Image* getImage(unsigned int face)
Get the texture image for specified face.
[more]virtual const Image* getImage(unsigned int face) const
Get the const texture image for specified face.
[more]virtual unsigned int getNumImages() const
Get the number of images that can be assigned to the Texture.
[more]virtual void apply(State& state) const
Texture is pure virtual base class, apply must be overriden.
[more]virtual void compileGLObjects(State& state) const
Calls apply(state) to compile the texture.
[more]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
[more]static Extensions* getExtensions(unsigned int contextID, bool createIfNotInitalized)
Function to call to get the extension of a specified context.
[more]static void setExtensions(unsigned int contextID, Extensions* extensions)
setExtensions allows users to override the extensions across graphics contexts.
[more]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.
[more]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.
[more]void takeTextureObjects(TextureObjectListMap& toblm)
take the active texture objects from the Texture and place them in the specified TextureObjectListMap
[more]static void setTextureObjectManager(TextureObjectManager* tom)
[more]static TextureObjectManager* getTextureObjectManager()
[more]static void flushTextureObjects(unsigned int contextID, double currentTime, double& availableTime)

Public

[more]typedef std::list< ref_ptr<TextureObject> > TextureObjectList
[more]typedef std::map<unsigned int, TextureObjectList > TextureObjectListMap
[more]typedef buffered_object< ref_ptr<TextureObject> > TextureObjectBuffer

Protected Fields

[more]mutable TexParameterDirtyList _texParametersDirtyList
[more]WrapMode _wrap_s
[more]WrapMode _wrap_t
[more]WrapMode _wrap_r
[more]FilterMode _min_filter
[more]FilterMode _mag_filter
[more]float _maxAnisotropy
[more]bool _useHardwareMipMapGeneration
[more]bool _unrefImageDataAfterApply
[more]bool _clientStorageHint
[more]Vec4 _borderColor
[more]GLint _borderWidth
[more]InternalFormatMode _internalFormatMode
[more]mutable GLint _internalFormat
[more]bool _use_shadow_comparison
[more]ShadowCompareFunc _shadow_compare_func
[more]ShadowTextureMode _shadow_texture_mode
[more]float _shadow_ambient

Protected Methods

[more]virtual ~Texture()
[more]virtual void computeInternalFormat() const
[more]void computeInternalFormatWithImage(const osg::Image& image) const
[more]void computeRequiredTextureDimensions(State& state, const osg::Image& image, GLsizei& width, GLsizei& height, GLsizei& numMipmapLevels) const
[more]bool isCompressedInternalFormat(GLint internalFormat) const
[more]void applyTexParameters(GLenum target, State& state) const
Helper method which does setting of texture paramters.
[more]int compareTexture(const Texture& rhs) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs

Protected

[more]typedef buffered_value<unsigned int> TexParameterDirtyList


Inherited from StateAttribute:

Public Classes

oenum Values
oenum Types
ostruct ModeUsage

Public Methods

ovirtual int compare(const StateAttribute& sa) const
obool operator < (const StateAttribute& rhs) const
obool operator == (const StateAttribute& rhs) const
obool operator != (const StateAttribute& rhs) const
ovirtual bool getModeUsage(ModeUsage&) const

Public

otypedef GLenum GLMode
otypedef unsigned int GLModeValue
otypedef unsigned int OverrideValue
otypedef unsigned int Type


Inherited from Object:

Public Classes

oenum DataVariance

Public Methods

oinline void setDataVariance(DataVariance dv)
oinline DataVariance getDataVariance() const
oinline void setUserData(Referenced* obj)
oinline Referenced* getUserData()
oinline const Referenced* getUserData() const

Protected Fields

oDataVariance _dataVariance
oref_ptr<Referenced> _userData


Inherited from Referenced:

Public Methods

oinline Referenced& operator = (const Referenced&)
ostatic void setDeleteHandler(DeleteHandler* handler)
ostatic DeleteHandler* getDeleteHandler()
oinline void ref() const
oinline void unref_nodelete() const
oinline int referenceCount() const
oinline void unref() const

Protected Fields

omutable OpenThreads::Mutex _refMutex
omutable int _refCount


Documentation

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

o Texture(const Texture& text, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy

ovirtual osg::Object* cloneType() const

ovirtual osg::Object* clone(const CopyOp& copyop) const

ovirtual bool isSameKindAs(const osg::Object* obj) const

ovirtual const char* libraryName() const

ovirtual const char* className() const

ovirtual Type getType() const

ovirtual bool isTextureAttribute() const

oenum WrapParameter

o WRAP_S

o WRAP_T

o WRAP_R

oenum WrapMode

o CLAMP

o CLAMP_TO_EDGE

o CLAMP_TO_BORDER

o REPEAT

o MIRROR

ovoid setWrap(WrapParameter which, WrapMode wrap)
Set the texture wrap mode

oWrapMode getWrap(WrapParameter which) const
Get the texture wrap mode

ovoid setBorderColor(const Vec4& color)
Set the border color for this texture. Makes difference only if wrap mode is CLAMP_TO_BORDER

oconst Vec4& getBorderColor() const
Get the border color for this texture

ovoid setBorderWidth(GLint width)
Set the border width

oGLint getBorderWidth() const

oenum FilterParameter

o MIN_FILTER

o MAG_FILTER

oenum FilterMode

o LINEAR

o LINEAR_MIPMAP_LINEAR

o LINEAR_MIPMAP_NEAREST

o NEAREST

o NEAREST_MIPMAP_LINEAR

o NEAREST_MIPMAP_NEAREST

ovoid setFilter(FilterParameter which, FilterMode filter)
Set the texture filter mode

oFilterMode getFilter(FilterParameter which) const
Get the texture filter mode

ovoid 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.

oinline float getMaxAnisotropy() const
Get the maximum anisotropy value

oinline void setUseHardwareMipMapGeneration(bool useHardwareMipMapGeneration)
Set the hint of whether to use hardware mip map generation where available

oinline bool getUseHardwareMipMapGeneration() const
Get the hint of whether to use hardware mip map generation where available

oinline 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.

oinline bool getUnRefImageDataAfterApply() const
Get the automatic unreference of image data after the texture has been set up in apply

oinline 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.

oinline bool getClientStorageHint() const
Get whether to use client storage of the texture where supported by OpenGL drivers

oenum InternalFormatMode

o USE_IMAGE_DATA_FORMAT

o USE_USER_DEFINED_FORMAT

o USE_ARB_COMPRESSION

o USE_S3TC_DXT1_COMPRESSION

o USE_S3TC_DXT3_COMPRESSION

o USE_S3TC_DXT5_COMPRESSION

oinline 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.

oinline InternalFormatMode getInternalFormatMode() const
Get the internal format mode

oinline void setInternalFormat(GLint internalFormat)
Set the internal format to use when creating OpenGL textures. Also sets the internalFormatMode to USE_USER_DEFINED_FORMAT.

oinline GLint getInternalFormat() const
Get the internal format to use when creating OpenGL textures

obool isCompressedInternalFormat() const

oinline TextureObject* getTextureObject(unsigned int contextID) const
Get the handle to the texture object for the current context

ovoid dirtyTextureObject()
Force a recompile on next apply() of associated OpenGL texture objects

obool areAllTextureObjectsLoaded() const
return true if the texture objects for all the required graphics contexts are loaded

oinline unsigned int& getTextureParameterDirty(unsigned int contextID) const
get the dirty flag for the current contextID

ovoid dirtyTextureParameters()
Force a resetting on next apply() of associated OpenGL texture parameters

ovoid setShadowComparison(bool flag)

oenum ShadowCompareFunc

o LEQUAL

o GEQUAL

ovoid setShadowCompareFunc(ShadowCompareFunc func)

oShadowCompareFunc getShadowCompareFunc()

oenum ShadowTextureMode

o LUMINANCE

o INTENSITY

o ALPHA

ovoid setShadowTextureMode(ShadowTextureMode mode)

oShadowTextureMode getShadowTextureMode()

ovoid setShadowAmbient(float shadow_ambient)

ofloat getShadowAmbient()

ovirtual void setImage(unsigned int face, Image* image)
Set the texture image for specified face.

ovirtual Image* getImage(unsigned int face)
Get the texture image for specified face.

ovirtual const Image* getImage(unsigned int face) const
Get the const texture image for specified face.

ovirtual unsigned int getNumImages() const
Get the number of images that can be assigned to the Texture.

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

ovirtual void compileGLObjects(State& state) const
Calls apply(state) to compile the texture.

ovirtual 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

ostatic 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..

ostatic 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.

ovoid 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

ovoid 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

ovirtual ~Texture()

ovirtual void computeInternalFormat() const

ovoid computeInternalFormatWithImage(const osg::Image& image) const

ovoid computeRequiredTextureDimensions(State& state, const osg::Image& image, GLsizei& width, GLsizei& height, GLsizei& numMipmapLevels) const

obool isCompressedInternalFormat(GLint internalFormat) const

ovoid applyTexParameters(GLenum target, State& state) const
Helper method which does setting of texture paramters.

oint compareTexture(const Texture& rhs) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs

otypedef buffered_value<unsigned int> TexParameterDirtyList

omutable TexParameterDirtyList _texParametersDirtyList

oWrapMode _wrap_s

oWrapMode _wrap_t

oWrapMode _wrap_r

oFilterMode _min_filter

oFilterMode _mag_filter

ofloat _maxAnisotropy

obool _useHardwareMipMapGeneration

obool _unrefImageDataAfterApply

obool _clientStorageHint

oVec4 _borderColor

oGLint _borderWidth

oInternalFormatMode _internalFormatMode

omutable GLint _internalFormat

obool _use_shadow_comparison

oShadowCompareFunc _shadow_compare_func

oShadowTextureMode _shadow_texture_mode

ofloat _shadow_ambient

otypedef std::list< ref_ptr<TextureObject> > TextureObjectList

otypedef std::map<unsigned int, TextureObjectList > TextureObjectListMap

ovoid takeTextureObjects(TextureObjectListMap& toblm)
take the active texture objects from the Texture and place them in the specified TextureObjectListMap

otypedef buffered_object< ref_ptr<TextureObject> > TextureObjectBuffer

omutable TextureObjectBuffer _textureObjectBuffer

ostatic void setTextureObjectManager(TextureObjectManager* tom)

ostatic TextureObjectManager* getTextureObjectManager()

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