OpenSceneGraph  3.4.0
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
osg::Texture2DArray Class Reference

Texture2DArray state class which encapsulates OpenGL 2D array texture functionality. More...

Inheritance diagram for osg::Texture2DArray:
Inheritance graph
[legend]

List of all members.

Classes

class  SubloadCallback

Public Member Functions

 Texture2DArray ()
 Texture2DArray (const Texture2DArray &cm, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 Copy constructor using CopyOp to manage deep vs shallow copy.
 META_StateAttribute (osg, Texture2DArray, TEXTURE)
virtual int compare (const StateAttribute &rhs) const
 Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
virtual GLenum getTextureTarget () const
virtual bool getModeUsage (StateAttribute::ModeUsage &) const
 Texture2DArray is related to non fixed pipeline usage only so isn't appropriate to enable/disable.
virtual void setImage (unsigned int layer, Image *image)
 Set the texture image for specified layer.
virtual ImagegetImage (unsigned int layer)
 Get the texture image for specified layer.
virtual const ImagegetImage (unsigned int layer) const
 Get the const texture image for specified layer.
virtual unsigned int getNumImages () const
 Get the number of images that are assigned to the Texture.
unsigned int & getModifiedCount (unsigned int layer, unsigned int contextID) const
 Check how often was a certain layer in the given context modified.
void setTextureSize (int width, int height, int depth)
 Set the texture width and height.
void setTextureWidth (int width)
void setTextureHeight (int height)
void setTextureDepth (int depth)
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
 Set the number of mip map levels the texture has been created with.
unsigned int getNumMipmapLevels () const
 Get the number of mip map levels the texture has been created with.
void copyTexSubImage2DArray (State &state, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height)
 Copies a two-dimensional texture subimage, as per glCopyTexSubImage3D.
virtual void apply (State &state) const
 Bind the texture if already compiled.

Protected Types

typedef std::vector< ref_ptr
< Image > > 
Images
typedef buffered_value
< unsigned int > 
ImageModifiedCount

Protected Member Functions

virtual ~Texture2DArray ()
bool imagesValid () const
virtual void computeInternalFormat () const
GLsizei computeTextureDepth () const
void allocateMipmap (State &state) const
 Allocate mipmap levels of the texture by subsequent calling of glTexImage* function.
void applyTexImage2DArray_subload (State &state, Image *image, GLsizei layer, GLsizei inwidth, GLsizei inheight, GLsizei indepth, GLint inInternalFormat, GLsizei &numMipmapLevels) const

Protected Attributes

Images _images
GLsizei _textureWidth
GLsizei _textureHeight
GLsizei _textureDepth
GLsizei _numMipmapLevels
ref_ptr< SubloadCallback_subloadCallback
std::vector< ImageModifiedCount_modifiedCount

Detailed Description

Texture2DArray state class which encapsulates OpenGL 2D array texture functionality.

Texture arrays were introduced with Shader Model 4.0 hardware.

A 2D texture array does contain textures sharing the same properties (e.g. size, bitdepth,...) in a layered structure. See http://www.opengl.org/registry/specs/EXT/texture_array.txt for more info.


Member Typedef Documentation

typedef buffered_value<unsigned int> osg::Texture2DArray::ImageModifiedCount [protected]
typedef std::vector< ref_ptr<Image> > osg::Texture2DArray::Images [protected]

Constructor & Destructor Documentation

Copy constructor using CopyOp to manage deep vs shallow copy.

virtual osg::Texture2DArray::~Texture2DArray ( ) [protected, virtual]

Member Function Documentation

void osg::Texture2DArray::allocateMipmap ( State state) const [protected, virtual]

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

Implements osg::Texture.

virtual void osg::Texture2DArray::apply ( State state) const [virtual]

Bind the texture if already compiled.

Otherwise recompile.

Implements osg::Texture.

void osg::Texture2DArray::applyTexImage2DArray_subload ( State state,
Image image,
GLsizei  layer,
GLsizei  inwidth,
GLsizei  inheight,
GLsizei  indepth,
GLint  inInternalFormat,
GLsizei &  numMipmapLevels 
) const [protected]
virtual int osg::Texture2DArray::compare ( const StateAttribute rhs) const [virtual]

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

Implements osg::StateAttribute.

virtual void osg::Texture2DArray::computeInternalFormat ( ) const [protected, virtual]

Implements osg::Texture.

GLsizei osg::Texture2DArray::computeTextureDepth ( ) const [protected]
void osg::Texture2DArray::copyTexSubImage2DArray ( State state,
int  xoffset,
int  yoffset,
int  zoffset,
int  x,
int  y,
int  width,
int  height 
)

Copies a two-dimensional texture subimage, as per glCopyTexSubImage3D.

Updates a portion of an existing OpenGL texture object from the current OpenGL background framebuffer contents at position x, y with width width and height height. Loads framebuffer data into the texture using offsets xoffset and yoffset. zoffset specifies the layer of the texture array to which the result is copied.

virtual Image* osg::Texture2DArray::getImage ( unsigned int  layer) [virtual]

Get the texture image for specified layer.

Implements osg::Texture.

virtual const Image* osg::Texture2DArray::getImage ( unsigned int  layer) const [virtual]

Get the const texture image for specified layer.

Implements osg::Texture.

virtual bool osg::Texture2DArray::getModeUsage ( StateAttribute::ModeUsage ) const [inline, virtual]

Texture2DArray is related to non fixed pipeline usage only so isn't appropriate to enable/disable.

Reimplemented from osg::Texture.

unsigned int& osg::Texture2DArray::getModifiedCount ( unsigned int  layer,
unsigned int  contextID 
) const [inline]

Check how often was a certain layer in the given context modified.

virtual unsigned int osg::Texture2DArray::getNumImages ( ) const [inline, virtual]

Get the number of images that are assigned to the Texture.

The number is equal to the texture depth. To get the maximum possible image/layer count, you have to use the extension subclass, since it provides graphic context dependent information.

Implements osg::Texture.

unsigned int osg::Texture2DArray::getNumMipmapLevels ( ) const [inline]

Get the number of mip map levels the texture has been created with.

virtual int osg::Texture2DArray::getTextureDepth ( ) const [inline, virtual]

Reimplemented from osg::Texture.

virtual int osg::Texture2DArray::getTextureHeight ( ) const [inline, virtual]

Reimplemented from osg::Texture.

virtual GLenum osg::Texture2DArray::getTextureTarget ( ) const [inline, virtual]

Implements osg::Texture.

References GL_TEXTURE_2D_ARRAY_EXT.

virtual int osg::Texture2DArray::getTextureWidth ( ) const [inline, virtual]

Reimplemented from osg::Texture.

bool osg::Texture2DArray::imagesValid ( ) const [protected]
virtual void osg::Texture2DArray::setImage ( unsigned int  layer,
Image image 
) [virtual]

Set the texture image for specified layer.

Implements osg::Texture.

void osg::Texture2DArray::setNumMipmapLevels ( unsigned int  num) const [inline]

Set the number of mip map levels the texture has been created with.

Should only be called within an osg::Texture::apply() and custom OpenGL texture load.

void osg::Texture2DArray::setTextureHeight ( int  height) [inline]
void osg::Texture2DArray::setTextureSize ( int  width,
int  height,
int  depth 
)

Set the texture width and height.

If width or height are zero then the respective size value is calculated from the source image sizes. Depth parameter specifies the number of layers to be used.

void osg::Texture2DArray::setTextureWidth ( int  width) [inline]

Member Data Documentation

std::vector<ImageModifiedCount> osg::Texture2DArray::_modifiedCount [mutable, protected]
GLsizei osg::Texture2DArray::_numMipmapLevels [mutable, protected]
GLsizei osg::Texture2DArray::_textureDepth [mutable, protected]
GLsizei osg::Texture2DArray::_textureHeight [mutable, protected]
GLsizei osg::Texture2DArray::_textureWidth [mutable, protected]

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

osg logo
Generated at Tue Dec 8 2015 00:14:26 for the OpenSceneGraph by doxygen 1.7.6.1.