BindImageTexture
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef _GLImageUnitBinding_H
#define _GLImageUnitBinding_H
#include <osg/Export>
#include <osg/Texture>
namespace osg
{
class OSG_EXPORT BindImageTexture : public osg::StateAttribute {
public:
enum Access
{
NOT_USED = 0,
READ_ONLY = GL_READ_ONLY_ARB,
WRITE_ONLY = GL_WRITE_ONLY_ARB,
READ_WRITE = GL_READ_WRITE_ARB
};
BindImageTexture(
GLuint imageunit = 0,
osg::Texture* target = 0,
Access access = READ_ONLY,
GLenum format = GL_RGBA8,
int level = 0,
bool layered = GL_FALSE,
int layer = 0) : osg::StateAttribute(),
_target(target),
_imageunit(imageunit),
_level(level),
_layered(layered),
_layer(layer),
_access(access),
_format(format) {}
BindImageTexture( const BindImageTexture&o,osg::CopyOp op=osg::CopyOp::SHALLOW_COPY):
osg::StateAttribute(o,op),
_target(o._target),
_imageunit(o._imageunit),
_level(o._level),
_layered(o._layered),
_layer(o._layer),
_access(o._access),
_format(o._format) {}
virtual ~BindImageTexture() {}
META_StateAttribute(osg,BindImageTexture, BINDIMAGETEXTURE)
inline void setImageUnit(GLuint i) { _imageunit=i; }
inline GLuint getImageUnit() const { return _imageunit; }
inline void setLevel(GLint i) { _level=i; }
inline GLint getLevel() const { return _level; }
inline void setIsLayered(GLboolean i) { _layered=i; }
inline GLboolean getIsLayered() const { return _layered; }
inline void setLayer(GLint i) { _layer=i; }
inline GLint getLayer() const { return _layer; }
inline void setAccess(Access i) { _access=i; }
inline Access getAccess() const { return _access; }
inline void setFormat(GLenum i) { _format=i; }
inline GLenum getFormat() const { return _format; }
inline void setTexture(osg::Texture* target) { _target=target; }
inline osg::Texture* getTexture() { return _target.get();}
inline const osg::Texture* getTexture() const { return _target.get();}
virtual void apply(osg::State&state) const;
virtual int compare(const osg::StateAttribute &sa) const;
virtual unsigned getMember() const { return static_cast<unsigned int>(_imageunit); }
protected:
osg::ref_ptr<osg::Texture> _target;
GLuint _imageunit;
GLint _level;
GLboolean _layered;
GLint _layer;
Access _access;
GLenum _format;
};
}
#endif
GL_WRITE_ONLY_ARB
#define GL_WRITE_ONLY_ARB
Definition BufferObject:54
GL_READ_WRITE_ARB
#define GL_READ_WRITE_ARB
Definition BufferObject:55
GL_READ_ONLY_ARB
#define GL_READ_ONLY_ARB
Definition BufferObject:53
Texture
GL_RGBA8
#define GL_RGBA8
Definition Texture:308
osg::BindImageTexture::_layered
GLboolean _layered
Definition BindImageTexture:103
osg::BindImageTexture::setAccess
void setAccess(Access i)
Definition BindImageTexture:82
osg::BindImageTexture::apply
virtual void apply(osg::State &state) const
osg::BindImageTexture::_layer
GLint _layer
Definition BindImageTexture:104
osg::BindImageTexture::_imageunit
GLuint _imageunit
Definition BindImageTexture:101
osg::BindImageTexture::getLayer
GLint getLayer() const
Definition BindImageTexture:80
osg::BindImageTexture::getMember
virtual unsigned getMember() const
Definition BindImageTexture:96
osg::BindImageTexture::setLayer
void setLayer(GLint i)
Definition BindImageTexture:79
osg::BindImageTexture::_format
GLenum _format
Definition BindImageTexture:106
osg::BindImageTexture::getTexture
osg::Texture * getTexture()
Definition BindImageTexture:89
osg::BindImageTexture::_access
Access _access
Definition BindImageTexture:105
osg::BindImageTexture::getIsLayered
GLboolean getIsLayered() const
Definition BindImageTexture:77
osg::BindImageTexture::compare
virtual int compare(const osg::StateAttribute &sa) const
osg::BindImageTexture::META_StateAttribute
META_StateAttribute(osg, BindImageTexture, BINDIMAGETEXTURE) inline void setImageUnit(GLuint i)
Definition BindImageTexture:68
osg::BindImageTexture::getImageUnit
GLuint getImageUnit() const
Definition BindImageTexture:71
osg::BindImageTexture::getAccess
Access getAccess() const
Definition BindImageTexture:83
osg::BindImageTexture::_level
GLint _level
Definition BindImageTexture:102
osg::BindImageTexture::_target
osg::ref_ptr< osg::Texture > _target
Definition BindImageTexture:100
osg::BindImageTexture::~BindImageTexture
virtual ~BindImageTexture()
Definition BindImageTexture:66
osg::BindImageTexture::BindImageTexture
BindImageTexture(GLuint imageunit=0, osg::Texture *target=0, Access access=READ_ONLY, GLenum format=GL_RGBA8, int level=0, bool layered=GL_FALSE, int layer=0)
Definition BindImageTexture:40
osg::BindImageTexture::getFormat
GLenum getFormat() const
Definition BindImageTexture:86
osg::BindImageTexture::setTexture
void setTexture(osg::Texture *target)
Definition BindImageTexture:88
osg::BindImageTexture::getTexture
const osg::Texture * getTexture() const
Definition BindImageTexture:90
osg::BindImageTexture::getLevel
GLint getLevel() const
Definition BindImageTexture:74
osg::BindImageTexture::BindImageTexture
BindImageTexture(const BindImageTexture &o, osg::CopyOp op=osg::CopyOp::SHALLOW_COPY)
Definition BindImageTexture:56
osg::BindImageTexture::Access
Access
Definition BindImageTexture:33
osg::BindImageTexture::READ_WRITE
@ READ_WRITE
Definition BindImageTexture:37
osg::BindImageTexture::READ_ONLY
@ READ_ONLY
Definition BindImageTexture:35
osg::BindImageTexture::NOT_USED
@ NOT_USED
Definition BindImageTexture:34
osg::BindImageTexture::WRITE_ONLY
@ WRITE_ONLY
Definition BindImageTexture:36
osg::BindImageTexture::setFormat
void setFormat(GLenum i)
Definition BindImageTexture:85
osg::BindImageTexture::setLevel
void setLevel(GLint i)
Definition BindImageTexture:73
osg::BindImageTexture::setIsLayered
void setIsLayered(GLboolean i)
Definition BindImageTexture:76
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::StateAttribute
Definition StateAttribute:77
osg::StateAttribute::StateAttribute
StateAttribute()
osg::StateAttribute::BINDIMAGETEXTURE
@ BINDIMAGETEXTURE
Definition StateAttribute:211
osg::State
Definition State:80
osg::Texture
Definition Texture:422
osg::ref_ptr
Definition ref_ptr:32
osg
Definition AlphaFunc:19
Export
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39