openscenegraph
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
osgText::GlyphTexture Class Reference
Inheritance diagram for osgText::GlyphTexture:
osg::Texture2D osg::Texture osg::StateAttribute osg::Object osg::Referenced

Public Member Functions

 GlyphTexture ()
const char * className () const
virtual int compare (const osg::StateAttribute &rhs) const
void setGlyphImageMargin (unsigned int margin)
unsigned int getGlyphImageMargin () const
void setGlyphImageMarginRatio (float margin)
float getGlyphImageMarginRatio () const
bool getSpaceForGlyph (Glyph *glyph, int &posX, int &posY)
void addGlyph (Glyph *glyph, int posX, int posY)
virtual void apply (osg::State &state) const
virtual void setThreadSafeRefUnref (bool threadSafe)
virtual void resizeGLObjectBuffers (unsigned int maxSize)
osg::ImagecreateImage ()
- Public Member Functions inherited from osg::Texture2D
 Texture2D ()
 Texture2D (Image *image)
 Texture2D (const Texture2D &text, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 META_StateAttribute (osg, Texture2D, TEXTURE)
virtual GLenum getTextureTarget () const
void setImage (Image *image)
ImagegetImage ()
const ImagegetImage () 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 setTextureSize (int width, int height) const
void setTextureWidth (int width)
void setTextureHeight (int height)
virtual int getTextureWidth () const
virtual int getTextureHeight () const
virtual int getTextureDepth () const
void setSubloadCallback (SubloadCallback *cb)
SubloadCallbackgetSubloadCallback ()
const SubloadCallbackgetSubloadCallback () const
void setNumMipmapLevels (unsigned int num) const
unsigned int getNumMipmapLevels () const
void copyTexImage2D (State &state, int x, int y, int width, int height)
void copyTexSubImage2D (State &state, int xoffset, int yoffset, int x, int y, int width, int height)
- 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 TextureasTexture ()
virtual const TextureasTexture () const
virtual Type getType () const
virtual bool isTextureAttribute () const
virtual bool getModeUsage (StateAttribute::ModeUsage &usage) 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 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
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
void setReadPBuffer (GraphicsContext *context)
GraphicsContextgetReadPBuffer ()
const GraphicsContextgetReadPBuffer () const
virtual void compileGLObjects (State &state) const
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
- Public Member Functions inherited from osg::StateAttribute
 StateAttribute ()
 StateAttribute (const StateAttribute &sa, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
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 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)
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)
osg::UserDataContainergetUserDataContainer ()
const osg::UserDataContainergetUserDataContainer () const
osg::UserDataContainergetOrCreateUserDataContainer ()
virtual void setUserData (Referenced *obj)
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)
- 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 std::vector
< osg::ref_ptr< Glyph > > 
GlyphRefList
typedef std::vector< const
Glyph * > 
GlyphPtrList
typedef osg::buffered_object
< GlyphPtrList
GlyphBuffer
- Protected Types inherited from osg::Texture2D
typedef buffered_value
< unsigned int > 
ImageModifiedCount
- Protected Types inherited from osg::Texture
typedef buffered_value
< unsigned int > 
TexParameterDirtyList
typedef buffered_object
< ref_ptr< TextureObject > > 
TextureObjectBuffer

Protected Member Functions

virtual ~GlyphTexture ()
- Protected Member Functions inherited from osg::Texture2D
virtual ~Texture2D ()
virtual void computeInternalFormat () const
void allocateMipmap (State &state) const
bool textureObjectValid (State &state) 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

int _margin
float _marginRatio
int _usedY
int _partUsedX
int _partUsedY
GlyphRefList _glyphs
GlyphBuffer _glyphsToSubload
OpenThreads::Mutex _mutex
- Protected Attributes inherited from osg::Texture2D
ref_ptr< Image_image
GLsizei _textureWidth
GLsizei _textureHeight
GLsizei _numMipmapLevels
ref_ptr< SubloadCallback_subloadCallback
ImageModifiedCount _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
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_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 }
enum  GenerateMipmapMode { GENERATE_MIPMAP_NONE, GENERATE_MIPMAP, GENERATE_MIPMAP_TEX_PARAMETER }
typedef std::list< ref_ptr
< TextureObject > > 
TextureObjectList
- Static Public Member Functions inherited from osg::Texture
static ExtensionsgetExtensions (unsigned int contextID, bool createIfNotInitalized)
static void setExtensions (unsigned int contextID, Extensions *extensions)
static bool isCompressedInternalFormat (GLint internalFormat)
static void getCompressedSize (GLenum internalFormat, GLint width, GLint height, GLint depth, GLint &blockSize, GLint &size)
static osg::ref_ptr
< Texture::TextureObjectManager > & 
getTextureObjectManager (unsigned int contextID)
static TextureObjectgenerateTextureObject (const Texture *texture, unsigned int contextID, GLenum target)
static TextureObjectgenerateTextureObject (const Texture *texture, unsigned int contextID, GLenum target, GLint numMipmapLevels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border)
static void deleteAllTextureObjects (unsigned int contextID)
static void discardAllTextureObjects (unsigned int contextID)
static void flushAllDeletedTextureObjects (unsigned int contextID)
static void discardAllDeletedTextureObjects (unsigned int contextID)
static void flushDeletedTextureObjects (unsigned int contextID, double currentTime, double &availableTime)
static void releaseTextureObject (unsigned int contextID, TextureObject *to)

Member Typedef Documentation

typedef std::vector< const Glyph* > osgText::GlyphTexture::GlyphPtrList
protected
typedef std::vector< osg::ref_ptr<Glyph> > osgText::GlyphTexture::GlyphRefList
protected

Constructor & Destructor Documentation

osgText::GlyphTexture::GlyphTexture ( )
virtual osgText::GlyphTexture::~GlyphTexture ( )
protectedvirtual

Member Function Documentation

void osgText::GlyphTexture::addGlyph ( Glyph glyph,
int  posX,
int  posY 
)
virtual void osgText::GlyphTexture::apply ( osg::State state) const
virtual

Bind the texture object. If the texture object hasn't already been compiled, create the texture mipmap levels.

Reimplemented from osg::Texture2D.

const char* osgText::GlyphTexture::className ( ) const
inlinevirtual

Return the name of the attribute's class type.

Reimplemented from osg::Texture.

virtual int osgText::GlyphTexture::compare ( const osg::StateAttribute rhs) const
virtual

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

Reimplemented from osg::Texture2D.

osg::Image* osgText::GlyphTexture::createImage ( )

create an image that maps all the associated Glyph's onto a single image, that is equivilant to what will be downloaded to the texture.

unsigned int osgText::GlyphTexture::getGlyphImageMargin ( ) const
inline
float osgText::GlyphTexture::getGlyphImageMarginRatio ( ) const
inline
bool osgText::GlyphTexture::getSpaceForGlyph ( Glyph glyph,
int &  posX,
int &  posY 
)
virtual void osgText::GlyphTexture::resizeGLObjectBuffers ( unsigned int  maxSize)
virtual

Resize any per context GLObject buffers to specified size.

Reimplemented from osg::Texture.

void osgText::GlyphTexture::setGlyphImageMargin ( unsigned int  margin)
inline

Set the margin around each glyph, to ensure that texture filtering doesn't bleed adjacent glyph's into each other.

void osgText::GlyphTexture::setGlyphImageMarginRatio ( float  margin)
inline
virtual void osgText::GlyphTexture::setThreadSafeRefUnref ( bool  threadSafe)
virtual

Set whether to use a mutex to ensure ref() and unref() are thread safe.

Reimplemented from osg::Object.

Member Data Documentation

GlyphRefList osgText::GlyphTexture::_glyphs
protected
GlyphBuffer osgText::GlyphTexture::_glyphsToSubload
mutableprotected
int osgText::GlyphTexture::_margin
protected
float osgText::GlyphTexture::_marginRatio
protected
OpenThreads::Mutex osgText::GlyphTexture::_mutex
mutableprotected
int osgText::GlyphTexture::_partUsedX
protected
int osgText::GlyphTexture::_partUsedY
protected
int osgText::GlyphTexture::_usedY
protected

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