openscenegraph
osg::TextureBuffer Class Reference

#include <TextureBuffer>

Inheritance diagram for osg::TextureBuffer:
osg::Texture osg::StateAttribute osg::Object osg::Referenced

Public Member Functions

 TextureBuffer ()
 TextureBuffer (BufferData *image)
 TextureBuffer (const TextureBuffer &text, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 META_StateAttribute (osg, TextureBuffer, TEXTURE)
virtual int compare (const StateAttribute &rhs) const
virtual GLenum getTextureTarget () const
void setImage (Image *image)
ImagegetImage ()
const ImagegetImage () const
virtual bool isDirty (unsigned int contextID) const
unsigned int & getModifiedCount (unsigned int contextID) const
virtual void setImage (unsigned int, Image *image)
virtual ImagegetImage (unsigned int)
virtual const ImagegetImage (unsigned int) const
virtual unsigned int getNumImages () const
void setTextureWidth (int width)
virtual int getTextureWidth () const
virtual int getTextureHeight () const
virtual int getTextureDepth () const
virtual void allocateMipmap (State &) const
virtual void apply (State &state) const
void setBufferData (BufferData *bo)
const BufferDatagetBufferData () const
Public Member Functions inherited from osg::Texture
 Texture ()
 Texture (const Texture &text, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
virtual osg::ObjectcloneType () const =0
virtual osg::Objectclone (const CopyOp &copyop) const =0
virtual bool isSameKindAs (const osg::Object *obj) const
virtual const char * libraryName () const
virtual const char * className () const
virtual TextureasTexture ()
virtual const TextureasTexture () const
virtual Type getType () const
virtual bool isTextureAttribute () const
void setWrap (WrapParameter which, WrapMode wrap)
WrapMode getWrap (WrapParameter which) const
void setBorderColor (const Vec4d &color)
const Vec4dgetBorderColor () const
void setBorderWidth (GLint width)
GLint getBorderWidth () const
void setFilter (FilterParameter which, FilterMode filter)
FilterMode getFilter (FilterParameter which) const
void setMaxAnisotropy (float anis)
float getMaxAnisotropy () const
void setMinLOD (float minlod)
float getMinLOD () const
void setMaxLOD (float maxlod)
float getMaxLOD () const
void setLODBias (float lodbias)
float getLODBias () const
void setSwizzle (const Vec4i &swizzle)
const Vec4igetSwizzle () const
void setUseHardwareMipMapGeneration (bool useHardwareMipMapGeneration)
bool getUseHardwareMipMapGeneration () const
void setUnRefImageDataAfterApply (bool flag)
bool getUnRefImageDataAfterApply () const
void setClientStorageHint (bool flag)
bool getClientStorageHint () const
void setResizeNonPowerOfTwoHint (bool flag)
bool getResizeNonPowerOfTwoHint () const
void setInternalFormatMode (InternalFormatMode mode)
InternalFormatMode getInternalFormatMode () const
void setInternalFormat (GLint internalFormat)
GLint getInternalFormat () const
bool isCompressedInternalFormat () const
void setSourceFormat (GLenum sourceFormat)
GLenum getSourceFormat () const
void setSourceType (GLenum sourceType)
GLenum getSourceType () const
InternalFormatType getInternalFormatType () const
GLenum selectSizedInternalFormat (const osg::Image *image=0) const
TextureObjectgetTextureObject (unsigned int contextID) const
void setTextureObject (unsigned int contextID, TextureObject *to)
void dirtyTextureObject ()
bool areAllTextureObjectsLoaded () const
unsigned int & getTextureParameterDirty (unsigned int contextID) const
void dirtyTextureParameters ()
void allocateMipmapLevels ()
void setShadowComparison (bool flag)
bool getShadowComparison () const
void setShadowCompareFunc (ShadowCompareFunc func)
ShadowCompareFunc getShadowCompareFunc () const
void setShadowTextureMode (ShadowTextureMode mode)
ShadowTextureMode getShadowTextureMode () const
void setShadowAmbient (float shadow_ambient)
float getShadowAmbient () const
template<class T>
void setImage (unsigned int face, const ref_ptr< T > &image)
void setReadPBuffer (GraphicsContext *context)
template<class T>
void setReadPBuffer (const ref_ptr< T > &context)
GraphicsContextgetReadPBuffer ()
const GraphicsContextgetReadPBuffer () const
virtual void compileGLObjects (State &state) const
virtual void resizeGLObjectBuffers (unsigned int maxSize)
virtual void releaseGLObjects (State *state=0) const
void applyTexImage2D_load (State &state, GLenum target, const Image *image, GLsizei width, GLsizei height, GLsizei numMipmapLevels) const
void applyTexImage2D_subload (State &state, GLenum target, const Image *image, GLsizei width, GLsizei height, GLint inInternalFormat, GLsizei numMipmapLevels) const
TextureObjectgenerateAndAssignTextureObject (unsigned int contextID, GLenum target) const
TextureObjectgenerateAndAssignTextureObject (unsigned int contextID, GLenum target, GLint numMipmapLevels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border) const
Public Member Functions inherited from osg::StateAttribute
 StateAttribute ()
 StateAttribute (const StateAttribute &sa, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
virtual StateAttributeasStateAttribute ()
virtual const StateAttributeasStateAttribute () const
virtual unsigned int getMember () const
TypeMemberPair getTypeMemberPair () const
bool operator< (const StateAttribute &rhs) const
bool operator== (const StateAttribute &rhs) const
bool operator!= (const StateAttribute &rhs) const
const ParentListgetParents () const
StateSetgetParent (unsigned int i)
const StateSetgetParent (unsigned int i) const
unsigned int getNumParents () const
void setShaderComponent (ShaderComponent *sc)
ShaderComponentgetShaderComponent ()
const ShaderComponentgetShaderComponent () const
virtual bool getModeUsage (ModeUsage &) const
virtual bool checkValidityOfAssociatedModes (osg::State &) const
void setUpdateCallback (StateAttributeCallback *uc)
StateAttributeCallbackgetUpdateCallback ()
const StateAttributeCallbackgetUpdateCallback () const
void setEventCallback (StateAttributeCallback *ec)
StateAttributeCallbackgetEventCallback ()
const StateAttributeCallbackgetEventCallback () const
Public Member Functions inherited from osg::Object
 Object ()
 Object (bool threadSafeRefUnref)
 Object (const Object &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
std::string getCompoundClassName () const
virtual NodeasNode ()
virtual const NodeasNode () const
virtual NodeVisitorasNodeVisitor ()
virtual const NodeVisitorasNodeVisitor () const
virtual StateSetasStateSet ()
virtual const StateSetasStateSet () const
virtual UniformasUniform ()
virtual const UniformasUniform () const
virtual CameraasCamera ()
virtual const CameraasCamera () const
virtual DrawableasDrawable ()
virtual const DrawableasDrawable () const
virtual CallbackasCallback ()
virtual const CallbackasCallback () const
virtual CallbackObjectasCallbackObject ()
virtual const CallbackObjectasCallbackObject () const
virtual UserDataContainerasUserDataContainer ()
virtual const UserDataContainerasUserDataContainer () const
virtual ValueObjectasValueObject ()
virtual const ValueObjectasValueObject () const
virtual ImageasImage ()
virtual const ImageasImage () const
virtual void setThreadSafeRefUnref (bool threadSafe)
virtual void setName (const std::string &name)
void setName (const char *name)
const std::string & getName () const
void setDataVariance (DataVariance dv)
DataVariance getDataVariance () const
virtual void computeDataVariance ()
void setUserDataContainer (osg::UserDataContainer *udc)
template<class T>
void setUserDataContainer (const ref_ptr< T > &udc)
osg::UserDataContainergetUserDataContainer ()
const osg::UserDataContainergetUserDataContainer () const
osg::UserDataContainergetOrCreateUserDataContainer ()
virtual void setUserData (Referenced *obj)
template<class T>
void setUserData (const ref_ptr< T > &ud)
virtual ReferencedgetUserData ()
virtual const ReferencedgetUserData () const
template<typename T>
bool getUserValue (const std::string &name, T &value) const
template<typename T>
void setUserValue (const std::string &name, const T &value)
template<typename T>
BoolValueObject UCharValueObject UShortValueObject UIntValueObject DoubleValueObject Vec3fValueObject Vec2dValueObject Vec4dValueObject PlaneValueObject MatrixdValueObject BoundingBoxdValueObject BoundingSpheredValueObject bool getUserValue (const std::string &name, T &value) const
Public Member Functions inherited from osg::Referenced
 Referenced ()
 Referenced (bool threadSafeRefUnref)
 Referenced (const Referenced &)
Referencedoperator= (const Referenced &)
bool getThreadSafeRefUnref () const
OpenThreads::MutexgetRefMutex () const
int ref () const
int unref () const
int unref_nodelete () const
int referenceCount () const
ObserverSetgetObserverSet () const
ObserverSetgetOrCreateObserverSet () const
void addObserver (Observer *observer) const
void removeObserver (Observer *observer) const

Protected Types

typedef buffered_value< unsigned int > BufferDataModifiedCount
Protected Types inherited from osg::Texture
typedef buffered_value< unsigned int > TexParameterDirtyList
typedef buffered_object< ref_ptr< TextureObject > > TextureObjectBuffer

Protected Member Functions

virtual ~TextureBuffer ()
virtual void computeInternalFormat () const
Protected Member Functions inherited from osg::Texture
virtual ~Texture ()
void computeInternalFormatWithImage (const osg::Image &image) const
void computeRequiredTextureDimensions (State &state, const osg::Image &image, GLsizei &width, GLsizei &height, GLsizei &numMipmapLevels) const
void computeInternalFormatType () const
void applyTexParameters (GLenum target, State &state) const
bool isHardwareMipmapGenerationEnabled (const State &state) const
bool isSafeToUnrefImageData (const State &state) const
GenerateMipmapMode mipmapBeforeTexImage (const State &state, bool hardwareMipmapOn) const
void mipmapAfterTexImage (State &state, GenerateMipmapMode beforeResult) const
void generateMipmap (State &state) const
int compareTexture (const Texture &rhs) const
int compareTextureObjects (const Texture &rhs) const
Protected Member Functions inherited from osg::StateAttribute
virtual ~StateAttribute ()
void addParent (osg::StateSet *object)
void removeParent (osg::StateSet *object)
Protected Member Functions inherited from osg::Object
virtual ~Object ()
Protected Member Functions inherited from osg::Referenced
virtual ~Referenced ()
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
void deleteUsingDeleteHandler () const

Protected Attributes

ref_ptr< BufferData_bufferData
GLsizei _textureWidth
BufferDataModifiedCount _modifiedCount
Protected Attributes inherited from osg::Texture
TexParameterDirtyList _texParametersDirtyList
TexParameterDirtyList _texMipmapGenerationDirtyList
WrapMode _wrap_s
WrapMode _wrap_t
WrapMode _wrap_r
FilterMode _min_filter
FilterMode _mag_filter
float _maxAnisotropy
float _minlod
float _maxlod
float _lodbias
Vec4i _swizzle
bool _useHardwareMipMapGeneration
bool _unrefImageDataAfterApply
bool _clientStorageHint
bool _resizeNonPowerOfTwoHint
Vec4d _borderColor
GLint _borderWidth
InternalFormatMode _internalFormatMode
InternalFormatType _internalFormatType
GLint _internalFormat
GLenum _sourceFormat
GLenum _sourceType
bool _use_shadow_comparison
ShadowCompareFunc _shadow_compare_func
ShadowTextureMode _shadow_texture_mode
float _shadow_ambient
TextureObjectBuffer _textureObjectBuffer
ref_ptr< GraphicsContext_readPBuffer
Protected Attributes inherited from osg::StateAttribute
ParentList _parents
ref_ptr< ShaderComponent_shaderComponent
ref_ptr< StateAttributeCallback_updateCallback
ref_ptr< StateAttributeCallback_eventCallback
Protected Attributes inherited from osg::Object
std::string _name
DataVariance _dataVariance
osg::UserDataContainer_userDataContainer
Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr _observerSet
OpenThreads::Atomic _refCount

Additional Inherited Members

Public Types inherited from osg::Texture
enum  WrapParameter { WRAP_S , WRAP_T , WRAP_R }
enum  WrapMode {
  CLAMP = GL_CLAMP , CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE , CLAMP_TO_BORDER = GL_CLAMP_TO_BORDER_ARB , REPEAT = GL_REPEAT ,
  MIRROR = GL_MIRRORED_REPEAT_IBM
}
enum  FilterParameter { MIN_FILTER , MAG_FILTER }
enum  FilterMode {
  LINEAR = GL_LINEAR , LINEAR_MIPMAP_LINEAR = GL_LINEAR_MIPMAP_LINEAR , LINEAR_MIPMAP_NEAREST = GL_LINEAR_MIPMAP_NEAREST , NEAREST = GL_NEAREST ,
  NEAREST_MIPMAP_LINEAR = GL_NEAREST_MIPMAP_LINEAR , NEAREST_MIPMAP_NEAREST = GL_NEAREST_MIPMAP_NEAREST
}
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 , USE_PVRTC_2BPP_COMPRESSION , USE_PVRTC_4BPP_COMPRESSION ,
  USE_ETC_COMPRESSION , USE_ETC2_COMPRESSION , USE_RGTC1_COMPRESSION , USE_RGTC2_COMPRESSION ,
  USE_S3TC_DXT1c_COMPRESSION , USE_S3TC_DXT1a_COMPRESSION
}
enum  InternalFormatType { NORMALIZED = 0x0 , FLOAT = 0x1 , SIGNED_INTEGER = 0x2 , UNSIGNED_INTEGER = 0x4 }
enum  ShadowCompareFunc {
  NEVER = GL_NEVER , LESS = GL_LESS , EQUAL = GL_EQUAL , LEQUAL = GL_LEQUAL ,
  GREATER = GL_GREATER , NOTEQUAL = GL_NOTEQUAL , GEQUAL = GL_GEQUAL , ALWAYS = GL_ALWAYS
}
enum  ShadowTextureMode { LUMINANCE = GL_LUMINANCE , INTENSITY = GL_INTENSITY , ALPHA = GL_ALPHA , NONE = GL_NONE }
enum  GenerateMipmapMode { GENERATE_MIPMAP_NONE , GENERATE_MIPMAP , GENERATE_MIPMAP_TEX_PARAMETER }
typedef std::list< ref_ptr< TextureObject > > TextureObjectList
Public Types inherited from osg::StateAttribute
enum  Values {
  OFF = 0x0 , ON = 0x1 , OVERRIDE = 0x2 , PROTECTED = 0x4 ,
  INHERIT = 0x8
}
enum  Type {
  TEXTURE , POLYGONMODE , POLYGONOFFSET , MATERIAL ,
  ALPHAFUNC , ANTIALIAS , COLORTABLE , CULLFACE ,
  FOG , FRONTFACE , LIGHT , POINT ,
  LINEWIDTH , LINESTIPPLE , POLYGONSTIPPLE , SHADEMODEL ,
  TEXENV , TEXENVFILTER , TEXGEN , TEXMAT ,
  LIGHTMODEL , BLENDFUNC , BLENDEQUATION , LOGICOP ,
  STENCIL , COLORMASK , DEPTH , VIEWPORT ,
  SCISSOR , BLENDCOLOR , MULTISAMPLE , CLIPPLANE ,
  COLORMATRIX , VERTEXPROGRAM , FRAGMENTPROGRAM , POINTSPRITE ,
  PROGRAM , CLAMPCOLOR , HINT , SAMPLEMASKI ,
  PRIMITIVERESTARTINDEX , CLIPCONTROL , VALIDATOR , VIEWMATRIXEXTRACTOR ,
  OSGNV_PARAMETER_BLOCK , OSGNVEXT_TEXTURE_SHADER , OSGNVEXT_VERTEX_PROGRAM , OSGNVEXT_REGISTER_COMBINERS ,
  OSGNVCG_PROGRAM , OSGNVSLANG_PROGRAM , OSGNVPARSE_PROGRAM_PARSER , UNIFORMBUFFERBINDING ,
  TRANSFORMFEEDBACKBUFFERBINDING , ATOMICCOUNTERBUFFERBINDING , PATCH_PARAMETER , FRAME_BUFFER_OBJECT ,
  VERTEX_ATTRIB_DIVISOR , SHADERSTORAGEBUFFERBINDING , INDIRECTDRAWBUFFERBINDING , VIEWPORTINDEXED ,
  DEPTHRANGEINDEXED , SCISSORINDEXED , BINDIMAGETEXTURE , SAMPLER ,
  CAPABILITY = 100
}
typedef GLenum GLMode
typedef unsigned int GLModeValue
typedef unsigned int OverrideValue
typedef std::pair< Type, unsigned int > TypeMemberPair
typedef std::vector< StateSet * > ParentList
typedef osg::StateAttributeCallback Callback
Public Types inherited from osg::Object
enum  DataVariance { DYNAMIC , STATIC , UNSPECIFIED }
Static Public Member Functions inherited from osg::Texture
static bool isCompressedInternalFormat (GLint internalFormat)
static void getCompressedSize (GLenum internalFormat, GLint width, GLint height, GLint depth, GLint &blockSize, GLint &size)
static osg::ref_ptr< TextureObjectgenerateTextureObject (const Texture *texture, unsigned int contextID, GLenum target)
static osg::ref_ptr< TextureObjectgenerateTextureObject (const Texture *texture, unsigned int contextID, GLenum target, GLint numMipmapLevels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border)
Static Public Member Functions inherited from osg::Referenced
static OpenThreads::MutexgetGlobalReferencedMutex ()
static void setDeleteHandler (DeleteHandler *handler)
static DeleteHandlergetDeleteHandler ()

Detailed Description

Encapsulates OpenGL texture buffer functionality in a Texture delegating its content to attached BufferObject

Member Typedef Documentation

◆ BufferDataModifiedCount

Constructor & Destructor Documentation

◆ TextureBuffer() [1/3]

osg::TextureBuffer::TextureBuffer ( )

◆ TextureBuffer() [2/3]

osg::TextureBuffer::TextureBuffer ( BufferData * image)

◆ TextureBuffer() [3/3]

osg::TextureBuffer::TextureBuffer ( const TextureBuffer & text,
const CopyOp & copyop = CopyOp::SHALLOW_COPY )

Copy constructor using CopyOp to manage deep vs shallow copy.

References osg::CopyOp::SHALLOW_COPY, and TextureBuffer().

◆ ~TextureBuffer()

virtual osg::TextureBuffer::~TextureBuffer ( )
protectedvirtual

Member Function Documentation

◆ allocateMipmap()

virtual void osg::TextureBuffer::allocateMipmap ( State & state) const
inlinevirtual

Allocate mipmap levels of the texture by subsequent calling of glTexImage* function.

Implements osg::Texture.

◆ apply()

virtual void osg::TextureBuffer::apply ( State & state) const
virtual

Bind the texture buffer.

Implements osg::Texture.

◆ compare()

virtual int osg::TextureBuffer::compare ( const StateAttribute & rhs) const
virtual

Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.

Implements osg::StateAttribute.

◆ computeInternalFormat()

virtual void osg::TextureBuffer::computeInternalFormat ( ) const
protectedvirtual

Implements osg::Texture.

◆ getBufferData()

const BufferData * osg::TextureBuffer::getBufferData ( ) const
inline

Set setBufferData attached

References _bufferData.

◆ getImage() [1/4]

Image * osg::TextureBuffer::getImage ( )
inline

Gets the texture image.

References _bufferData.

◆ getImage() [2/4]

const Image * osg::TextureBuffer::getImage ( ) const
inline

Gets the const texture image.

References _bufferData.

◆ getImage() [3/4]

virtual Image * osg::TextureBuffer::getImage ( unsigned int )
inlinevirtual

Gets the texture image, ignoring face.

Implements osg::Texture.

References getImage().

Referenced by getImage().

◆ getImage() [4/4]

virtual const Image * osg::TextureBuffer::getImage ( unsigned int ) const
inlinevirtual

Gets the const texture image, ignoring face.

Implements osg::Texture.

References getImage().

Referenced by getImage().

◆ getModifiedCount()

unsigned int & osg::TextureBuffer::getModifiedCount ( unsigned int contextID) const
inline

References _modifiedCount.

◆ getNumImages()

virtual unsigned int osg::TextureBuffer::getNumImages ( ) const
inlinevirtual

Gets the number of images that can be assigned to the Texture.

Implements osg::Texture.

◆ getTextureDepth()

virtual int osg::TextureBuffer::getTextureDepth ( ) const
inlinevirtual

Reimplemented from osg::Texture.

◆ getTextureHeight()

virtual int osg::TextureBuffer::getTextureHeight ( ) const
inlinevirtual

Reimplemented from osg::Texture.

◆ getTextureTarget()

virtual GLenum osg::TextureBuffer::getTextureTarget ( ) const
inlinevirtual

Implements osg::Texture.

References GL_TEXTURE_BUFFER.

◆ getTextureWidth()

virtual int osg::TextureBuffer::getTextureWidth ( ) const
inlinevirtual

Gets the texture width.

Reimplemented from osg::Texture.

References _textureWidth.

◆ isDirty()

virtual bool osg::TextureBuffer::isDirty ( unsigned int contextID) const
inlinevirtual

return true if the texture image data has been modified and the associated GL texture object needs to be updated.

Reimplemented from osg::Texture.

References _bufferData, and _modifiedCount.

◆ META_StateAttribute()

osg::TextureBuffer::META_StateAttribute ( osg ,
TextureBuffer ,
TEXTURE  )

◆ setBufferData()

void osg::TextureBuffer::setBufferData ( BufferData * bo)

Set setBufferData attached

◆ setImage() [1/2]

void osg::TextureBuffer::setImage ( Image * image)

Sets the texture image.

◆ setImage() [2/2]

virtual void osg::TextureBuffer::setImage ( unsigned int ,
Image * image )
inlinevirtual

Sets the texture image, ignoring face.

Implements osg::Texture.

References setImage().

Referenced by setImage().

◆ setTextureWidth()

void osg::TextureBuffer::setTextureWidth ( int width)
inline

Sets the texture width. If width is zero, calculate the value from the source image width.

References _textureWidth.

Member Data Documentation

◆ _bufferData

ref_ptr< BufferData > osg::TextureBuffer::_bufferData
protected

◆ _modifiedCount

BufferDataModifiedCount osg::TextureBuffer::_modifiedCount
mutableprotected

Referenced by getModifiedCount(), and isDirty().

◆ _textureWidth

GLsizei osg::TextureBuffer::_textureWidth
protected

Referenced by getTextureWidth(), and setTextureWidth().


The documentation for this class was generated from the following file: