class OSGGL2_EXPORT osgGL2::ProgramObject

osgGL2::ProgramObject is an application-level abstraction of the OpenGL Shading Language glProgramObject.

Inheritance:


Public Methods

[more] ProgramObject()
[more] ProgramObject(const ProgramObject& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy
[more] META_StateAttribute(osgGL2, ProgramObject, PROGRAMOBJECT)
[more]virtual int compare(const osg::StateAttribute& sa) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs
[more]virtual void apply(osg::State& state) const
If enabled, install our shader program in the GL pipeline, performing any shader program rebuild operations that might be pending.
[more]virtual void compileGLObjects(osg::State& state) const
[more]virtual void releaseGLObjects(osg::State* state=0) const
release an OpenGL objects in specified graphics context if State object is passed, otherwise release OpenGL objexts for all graphics context if State object pointer NULL
[more]void dirtyProgramObject()
Mark us as "dirty" and in need of relinking.
[more]void dirtyShaderObjects()
Mark our attached ShaderObjects as "dirty" and in need of recompilation.
[more]void enable( bool enabled )
An override to control whether the shader program will actually be installed when OSG attempts to apply()
[more]void addShader( ShaderObject* shadObj )
Attach a ShaderObject to this ProgramObject
[more]void setUniform( const char* uniformName, int value )
Assign a value to a ProgramObject's uniform variable
[more]void setUniform( const char* uniformName, float value )
[more]void setUniform( const char* uniformName, osg::Vec2 value )
[more]void setUniform( const char* uniformName, osg::Vec3 value )
[more]void setUniform( const char* uniformName, osg::Vec4 value )
[more]inline void setSampler( const char* uniformName, int value )
[more]static void deleteObject(unsigned int contextID, GLhandleARB handle)
Mark internal GL objects for deletion.
[more]static void flushDeletedGL2Objects(unsigned int contextID, double currentTime, double& availableTime)
flush all the cached glProgramObjects which need to be deleted in the OpenGL context related to contextID

Protected Classes

class PerContextProgObj: public osg::Referenced
PCPO is an OSG-internal encapsulation of glProgramObjects per-GL context.

Protected Fields

[more]bool _enabled
[more]ShaderObjectList _shaderObjectList
[more]mutable osg::buffered_value< osg::ref_ptr<PerContextProgObj> > _pcpoList
[more]mutable int _frameNumberOfLastPCPOUpdate
[more]mutable UniformValueList _univalList

Protected Methods

[more]virtual ~ProgramObject()
[more]PerContextProgObj* getPCPO(unsigned int contextID) const
Get the PCPO for a particular GL context
[more]void updateUniforms( int frameNumber ) const
Per frame, copy the list of pending UniformValue updates to each of the PCPOs.

Protected

[more]typedef std::vector< ShaderObjectPtr > ShaderObjectList


Documentation

osgGL2::ProgramObject is an application-level abstraction of the OpenGL Shading Language glProgramObject. It is an osg::StateAttribute that, when applied, will install an OGLSL shader program for subsequent rendering. osgGL2::ShaderObjects containing the actual shader source code are attached to the ProgramObject, which will then manage the compilation, linking, and installation of the GL shader program. ProgramObject will automatically manage per-context instancing of the internal objects, if that is necessary for a particular display configuration.
o ProgramObject()

o ProgramObject(const ProgramObject& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy

o META_StateAttribute(osgGL2, ProgramObject, PROGRAMOBJECT)

ovirtual int compare(const osg::StateAttribute& sa) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs

ovirtual void apply(osg::State& state) const
If enabled, install our shader program in the GL pipeline, performing any shader program rebuild operations that might be pending.

ovirtual void compileGLObjects(osg::State& state) const

ovirtual void releaseGLObjects(osg::State* state=0) const
release an OpenGL objects in specified graphics context if State object is passed, otherwise release OpenGL objexts for all graphics context if State object pointer NULL

ovoid dirtyProgramObject()
Mark us as "dirty" and in need of relinking.

ovoid dirtyShaderObjects()
Mark our attached ShaderObjects as "dirty" and in need of recompilation.

ovoid enable( bool enabled )
An override to control whether the shader program will actually be installed when OSG attempts to apply()

ovoid addShader( ShaderObject* shadObj )
Attach a ShaderObject to this ProgramObject

ovoid setUniform( const char* uniformName, int value )
Assign a value to a ProgramObject's uniform variable

ovoid setUniform( const char* uniformName, float value )

ovoid setUniform( const char* uniformName, osg::Vec2 value )

ovoid setUniform( const char* uniformName, osg::Vec3 value )

ovoid setUniform( const char* uniformName, osg::Vec4 value )

oinline void setSampler( const char* uniformName, int value )

ostatic void deleteObject(unsigned int contextID, GLhandleARB handle)
Mark internal GL objects for deletion. Deletion requests are queued until they can be executed in the proper GL context.

ostatic void flushDeletedGL2Objects(unsigned int contextID, double currentTime, double& availableTime)
flush all the cached glProgramObjects which need to be deleted in the OpenGL context related to contextID

ovirtual ~ProgramObject()

oPerContextProgObj* getPCPO(unsigned int contextID) const
Get the PCPO for a particular GL context

ovoid updateUniforms( int frameNumber ) const
Per frame, copy the list of pending UniformValue updates to each of the PCPOs.

obool _enabled

otypedef std::vector< ShaderObjectPtr > ShaderObjectList

oShaderObjectList _shaderObjectList

omutable osg::buffered_value< osg::ref_ptr<PerContextProgObj> > _pcpoList

omutable int _frameNumberOfLastPCPOUpdate

omutable UniformValueList _univalList


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.