OpenSceneGraph 3.6.5
BindImageTexture
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
14
15#ifndef _GLImageUnitBinding_H
16#define _GLImageUnitBinding_H
17
18#include <osg/Export>
19#include <osg/Texture>
20
21namespace osg
22{
30 public:
39
41 GLuint imageunit = 0,
42 osg::Texture* target = 0,
43 Access access = READ_ONLY,
44 GLenum format = GL_RGBA8,
45 int level = 0,
46 bool layered = GL_FALSE,
47 int layer = 0) : osg::StateAttribute(),
48 _target(target),
49 _imageunit(imageunit),
50 _level(level),
51 _layered(layered),
52 _layer(layer),
53 _access(access),
54 _format(format) {}
55
65
66 virtual ~BindImageTexture() {}
67
69
70 inline void setImageUnit(GLuint i) { _imageunit=i; }
71 inline GLuint getImageUnit() const { return _imageunit; }
72
73 inline void setLevel(GLint i) { _level=i; }
74 inline GLint getLevel() const { return _level; }
75
76 inline void setIsLayered(GLboolean i) { _layered=i; }
77 inline GLboolean getIsLayered() const { return _layered; }
78
79 inline void setLayer(GLint i) { _layer=i; }
80 inline GLint getLayer() const { return _layer; }
81
82 inline void setAccess(Access i) { _access=i; }
83 inline Access getAccess() const { return _access; }
84
85 inline void setFormat(GLenum i) { _format=i; }
86 inline GLenum getFormat() const { return _format; }
87
88 inline void setTexture(osg::Texture* target) { _target=target; }
89 inline osg::Texture* getTexture() { return _target.get();}
90 inline const osg::Texture* getTexture() const { return _target.get();}
91
92 virtual void apply(osg::State&state) const;
93
94 virtual int compare(const osg::StateAttribute &sa) const;
95
96 virtual unsigned getMember() const { return static_cast<unsigned int>(_imageunit); }
97
98 protected:
99
102 GLint _level;
103 GLboolean _layered;
104 GLint _layer;
106 GLenum _format;
107
108};
109
110}
111#endif
#define GL_RGBA8
Definition Texture:308
#define GL_WRITE_ONLY_ARB
Definition BufferObject:54
#define GL_READ_WRITE_ARB
Definition BufferObject:55
#define GL_READ_ONLY_ARB
Definition BufferObject:53
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
GLboolean _layered
Definition BindImageTexture:103
void setAccess(Access i)
Definition BindImageTexture:82
virtual void apply(osg::State &state) const
apply the OpenGL state attributes.
GLint _layer
Definition BindImageTexture:104
GLuint _imageunit
Definition BindImageTexture:101
GLint getLayer() const
Definition BindImageTexture:80
virtual unsigned getMember() const
Return the member identifier within the attribute's class type.
Definition BindImageTexture:96
void setLayer(GLint i)
Definition BindImageTexture:79
GLenum _format
Definition BindImageTexture:106
osg::Texture * getTexture()
Definition BindImageTexture:89
Access _access
Definition BindImageTexture:105
GLboolean getIsLayered() const
Definition BindImageTexture:77
virtual int compare(const osg::StateAttribute &sa) const
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
META_StateAttribute(osg, BindImageTexture, BINDIMAGETEXTURE) inline void setImageUnit(GLuint i)
Definition BindImageTexture:68
GLuint getImageUnit() const
Definition BindImageTexture:71
Access getAccess() const
Definition BindImageTexture:83
GLint _level
Definition BindImageTexture:102
osg::ref_ptr< osg::Texture > _target
Definition BindImageTexture:100
virtual ~BindImageTexture()
Definition BindImageTexture:66
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
GLenum getFormat() const
Definition BindImageTexture:86
void setTexture(osg::Texture *target)
Definition BindImageTexture:88
const osg::Texture * getTexture() const
Definition BindImageTexture:90
GLint getLevel() const
Definition BindImageTexture:74
BindImageTexture(const BindImageTexture &o, osg::CopyOp op=osg::CopyOp::SHALLOW_COPY)
Definition BindImageTexture:56
Access
Type of access that will be performed on the texture image.
Definition BindImageTexture:33
@ READ_WRITE
Definition BindImageTexture:37
@ READ_ONLY
Definition BindImageTexture:35
@ NOT_USED
Definition BindImageTexture:34
@ WRITE_ONLY
Definition BindImageTexture:36
void setFormat(GLenum i)
Definition BindImageTexture:85
void setLevel(GLint i)
Definition BindImageTexture:73
void setIsLayered(GLboolean i)
Definition BindImageTexture:76
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Base class for state attributes.
Definition StateAttribute:77
@ BINDIMAGETEXTURE
Definition StateAttribute:211
Texture pure virtual base class that encapsulates OpenGL texture functionality common to the various ...
Definition Texture:422
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.