Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osgGL2::ProgramObject Class Reference

Inheritance diagram for osgGL2::ProgramObject:

osg::StateAttribute osg::Object osg::Referenced List of all members.

Public Member Functions

 ProgramObject ()
 ProgramObject (const ProgramObject &rhs, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 META_StateAttribute (osgGL2, ProgramObject, PROGRAMOBJECT)
virtual int compare (const osg::StateAttribute &sa) const
virtual void apply (osg::State &state) const
virtual void compileGLObjects (osg::State &state) const
virtual void releaseGLObjects (osg::State *state=0) const
void dirtyProgramObject ()
void dirtyShaderObjects ()
void enable (bool enabled)
void addShader (ShaderObject *shadObj)
void setUniform (const char *uniformName, int value)
void setUniform (const char *uniformName, float value)
void setUniform (const char *uniformName, osg::Vec2 value)
void setUniform (const char *uniformName, osg::Vec3 value)
void setUniform (const char *uniformName, osg::Vec4 value)
void setSampler (const char *uniformName, int value)

Static Public Member Functions

static void deleteObject (unsigned int contextID, GLhandleARB handle)
static void flushDeletedGL2Objects (unsigned int contextID, double currentTime, double &availableTime)

Protected Types

typedef std::vector< ShaderObjectPtr > ShaderObjectList

Protected Member Functions

virtual ~ProgramObject ()
PerContextProgObj * getPCPO (unsigned int contextID) const
void updateUniforms (int frameNumber) const

Protected Attributes

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

Classes

class  PerContextProgObj

Detailed Description

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.


Member Typedef Documentation

typedef std::vector< ShaderObjectPtr > osgGL2::ProgramObject::ShaderObjectList [protected]
 


Constructor & Destructor Documentation

osgGL2::ProgramObject::ProgramObject (   ) 
 

osgGL2::ProgramObject::ProgramObject (  const ProgramObject &  rhs,
const osg::CopyOp &  copyop = osg::CopyOp::SHALLOW_COPY
) 
 

Copy constructor using CopyOp to manage deep vs shallow copy.

virtual osgGL2::ProgramObject::~ProgramObject (   )  [protected, virtual]
 


Member Function Documentation

void osgGL2::ProgramObject::addShader (  ShaderObject *  shadObj  ) 
 

Attach a ShaderObject to this ProgramObject

virtual void osgGL2::ProgramObject::apply (  osg::State &  state  )  const [virtual]
 

If enabled, install our shader program in the GL pipeline, performing any shader program rebuild operations that might be pending.

virtual int osgGL2::ProgramObject::compare (  const osg::StateAttribute &  sa  )  const [virtual]
 

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

virtual void osgGL2::ProgramObject::compileGLObjects (  osg::State &  state  )  const [virtual]
 

static void osgGL2::ProgramObject::deleteObject (  unsigned int  contextID,
GLhandleARB  handle
)  [static]
 

Mark internal GL objects for deletion. Deletion requests are queued until they can be executed in the proper GL context.

void osgGL2::ProgramObject::dirtyProgramObject (   ) 
 

Mark us as "dirty" and in need of relinking.

void osgGL2::ProgramObject::dirtyShaderObjects (   ) 
 

Mark our attached ShaderObjects as "dirty" and in need of recompilation.

void osgGL2::ProgramObject::enable (  bool  enabled  )  [inline]
 

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

static void osgGL2::ProgramObject::flushDeletedGL2Objects (  unsigned int  contextID,
double  currentTime,
double &  availableTime
)  [static]
 

flush all the cached glProgramObjects which need to be deleted in the OpenGL context related to contextID.

PerContextProgObj* osgGL2::ProgramObject::getPCPO (  unsigned int  contextID  )  const [protected]
 

Get the PCPO for a particular GL context

osgGL2::ProgramObject::META_StateAttribute (  osgGL2  ,
ProgramObject  ,
PROGRAMOBJECT 
) 
 

virtual void osgGL2::ProgramObject::releaseGLObjects (  osg::State *  state = 0  )  const [virtual]
 

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.

void osgGL2::ProgramObject::setSampler (  const char *  uniformName,
int  value
)  [inline]
 

void osgGL2::ProgramObject::setUniform (  const char *  uniformName,
osg::Vec4  value
) 
 

void osgGL2::ProgramObject::setUniform (  const char *  uniformName,
osg::Vec3  value
) 
 

void osgGL2::ProgramObject::setUniform (  const char *  uniformName,
osg::Vec2  value
) 
 

void osgGL2::ProgramObject::setUniform (  const char *  uniformName,
float  value
) 
 

void osgGL2::ProgramObject::setUniform (  const char *  uniformName,
int  value
) 
 

Assign a value to a ProgramObject's uniform variable

void osgGL2::ProgramObject::updateUniforms (  int  frameNumber  )  const [protected]
 

Per frame, copy the list of pending UniformValue updates to each of the PCPOs.


Member Data Documentation

bool osgGL2::ProgramObject::_enabled [protected]
 

int osgGL2::ProgramObject::_frameNumberOfLastPCPOUpdate [mutable, protected]
 

osg::buffered_value< osg::ref_ptr<PerContextProgObj> > osgGL2::ProgramObject::_pcpoList [mutable, protected]
 

ShaderObjectList osgGL2::ProgramObject::_shaderObjectList [protected]
 

UniformValueList osgGL2::ProgramObject::_univalList [mutable, protected]
 


The documentation for this class was generated from the following file:
Generated on Fri May 13 15:15:51 2005 for openscenegraph by  doxygen 1.4.2