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

osgGL2::ShaderObject Class Reference

osgGL2::ShaderObject is an application-level abstraction of the OpenGL Shading Language glShaderObject. More...

Inheritance diagram for osgGL2::ShaderObject:

Inheritance graph
[legend]
List of all members.

Public Types

enum  Type { VERTEX = GL_VERTEX_SHADER_ARB, FRAGMENT = GL_FRAGMENT_SHADER_ARB, UNKNOWN = -1 }

Public Member Functions

 ShaderObject ()
 ShaderObject (Type type)
 ShaderObject (Type type, const char *sourceText)
 ShaderObject (const ShaderObject &rhs, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 Copy constructor using CopyOp to manage deep vs shallow copy.
 META_Object (osgGL2, ShaderObject)
int compare (const ShaderObject &sa) const
void setShaderSource (const char *sourceText)
 Load the ShaderObject's source code text from a string.
const std::string & getShaderSource () const
 Retreive the source code text.
bool loadShaderSourceFromFile (const char *fileName)
 Load the ShaderObject's source code text from a file.
Type getType () const
 Get the ShaderObject type as an enum.
const char * getTypename () const
 Get the ShaderObject type as a descriptive string.
void dirtyShaderObject ()
 Mark us as "dirty" and in need of recompilation.
void build (unsigned int contextID) const
 Perform a recompilation of all our PCSOs.
void attach (unsigned int contextID, GLhandleARB progObj) const
 For a given GL context, attach a glShaderObject to a glProgramObject.

Protected Member Functions

virtual ~ShaderObject ()
PerContextShaderObjgetPCSO (unsigned int contextID) const
void addProgObjRef (ProgramObject *progObj)

Protected Attributes

Type _type
std::string _shaderSource
std::vector< ProgramObjectPtr_programObjectList
osg::buffered_value< osg::ref_ptr<
PerContextShaderObj > > 
_pcsoList

Friends

void ProgramObject::addShader (ShaderObject *shadObj)

Classes

class  PerContextShaderObj
 PCSO is an OSG-internal encapsulation of glShaderObjects per-GL context. More...

Detailed Description

osgGL2::ShaderObject is an application-level abstraction of the OpenGL Shading Language glShaderObject.

It is a container to load the shader source code text and manage its compilation. A ShaderObject may be attached to more than one osgGL2::ProgramObject. ShaderObject will automatically manage per-context instancing of the internal objects, if that is necessary for a particular display configuration.


Member Enumeration Documentation

enum osgGL2::ShaderObject::Type
 

Enumeration values:
VERTEX 
FRAGMENT 
UNKNOWN 


Constructor & Destructor Documentation

ShaderObject::ShaderObject  ) 
 

ShaderObject::ShaderObject Type  type  ) 
 

ShaderObject::ShaderObject Type  type,
const char *  sourceText
 

ShaderObject::ShaderObject const ShaderObject rhs,
const osg::CopyOp copyop = osg::CopyOp::SHALLOW_COPY
 

Copy constructor using CopyOp to manage deep vs shallow copy.

ShaderObject::~ShaderObject  )  [protected, virtual]
 


Member Function Documentation

void ShaderObject::addProgObjRef ProgramObject progObj  )  [protected]
 

void ShaderObject::attach unsigned int  contextID,
GLhandleARB  progObj
const
 

For a given GL context, attach a glShaderObject to a glProgramObject.

void ShaderObject::build unsigned int  contextID  )  const
 

Perform a recompilation of all our PCSOs.

int ShaderObject::compare const ShaderObject sa  )  const
 

void ShaderObject::dirtyShaderObject  ) 
 

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

ShaderObject::PerContextShaderObj * ShaderObject::getPCSO unsigned int  contextID  )  const [protected]
 

const std::string& osgGL2::ShaderObject::getShaderSource  )  const [inline]
 

Retreive the source code text.

Type osgGL2::ShaderObject::getType  )  const [inline]
 

Get the ShaderObject type as an enum.

const char * ShaderObject::getTypename  )  const
 

Get the ShaderObject type as a descriptive string.

bool ShaderObject::loadShaderSourceFromFile const char *  fileName  ) 
 

Load the ShaderObject's source code text from a file.

osgGL2::ShaderObject::META_Object osgGL2  ,
ShaderObject 
 

void ShaderObject::setShaderSource const char *  sourceText  ) 
 

Load the ShaderObject's source code text from a string.


Friends And Related Function Documentation

void ProgramObject::addShader ShaderObject shadObj  )  [friend]
 


Member Data Documentation

osg::buffered_value< osg::ref_ptr<PerContextShaderObj> > osgGL2::ShaderObject::_pcsoList [mutable, protected]
 

std::vector< ProgramObjectPtr > osgGL2::ShaderObject::_programObjectList [protected]
 

std::string osgGL2::ShaderObject::_shaderSource [protected]
 

Type osgGL2::ShaderObject::_type [protected]
 


The documentation for this class was generated from the following files:
Generated at Tue Apr 5 00:56:32 2005 for the OpenSceneGraph by doxygen 1.4.1.