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

osg::SHLChunk Class Reference

SHLChunk class. See PageKernelSHLChunk for a description.

#include <OSGSHLChunk.h>

Inheritance diagram for osg::SHLChunk:

osg::SHLChunkBase osg::ShaderChunk osg::ShaderChunkBase osg::ShaderParameterChunk osg::ShaderParameterChunkBase osg::StateChunk osg::StateChunkBase osg::Attachment osg::FieldContainer List of all members.

Parameter Callbacks

typedef void(* paramtercbfp )(PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
*typedef GLint (OSG_APIENTRY *PFNGLGETUNIFORMLOCATIONARBPROC)(GLuint programObj
void addParameterCallback (const char *name, paramtercbfp fp)
*typedef const char * name

Public Types

typedef SHLChunkPtr Ptr
enum  { CgFrontEndFieldId = Inherited::NextFieldId, GLIdFieldId = CgFrontEndFieldId + 1, NextFieldId = GLIdFieldId + 1 }

Public Member Functions

virtual const StateChunkClassgetClass (void) const
Get Instance Type Information
UInt32 getTypeId (void) const
UInt16 getGroupId (void) const
const Char8getTypeName (void) const
Generic Field Access *FieldgetField (UInt32 fieldId)
FieldgetField (const Char8 *fieldName)
Sync
*virtual void changed (BitVector whichField, UInt32 origin)
Output
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
Paramerters
*void updateParameters (Window *win, const MFShaderParameterPtr &parameters, bool useProgram=true, bool force=false, bool keepProgramActive=false)
State
*virtual void activate (DrawActionBase *action, UInt32 index=0)
virtual void changeFrom (DrawActionBase *action, StateChunk *old, UInt32 index=0)
virtual void deactivate (DrawActionBase *action, UInt32 index=0)
Comparison
*virtual Real32 switchCost (StateChunk *chunk)
virtual bool operator< (const StateChunk &other) const
virtual bool operator== (const StateChunk &other) const
virtual bool operator!= (const StateChunk &other) const
FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get
*SFBoolgetSFCgFrontEnd (void)
 Get the SHLChunk::_sfCgFrontEnd field.
SFUInt32getSFGLId (void)
 Get the SHLChunk::_sfGLId field.
bool & getCgFrontEnd (void)
 Get the value of the SHLChunk::_sfCgFrontEnd field.
const bool & getCgFrontEnd (void) const
 Get the value of the SHLChunk::_sfCgFrontEnd field.
UInt32getGLId (void)
 Get the value of the SHLChunk::_sfGLId field.
const UInt32getGLId (void) const
 Get the value of the SHLChunk::_sfGLId field.
Field Set
*void setCgFrontEnd (const bool &value)
 Set the value of the SHLChunk::_sfCgFrontEnd field.
void setGLId (const UInt32 &value)
 Set the value of the SHLChunk::_sfGLId field.
Binary Access
*virtual UInt32 getBinSize (const BitVector &whichField)
virtual void copyToBin (BinaryDataHandler &pMem, const BitVector &whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField)
Copy
*virtual FieldContainerPtr shallowCopy (void) const
ShaderChunk Access
*bool readVertexProgram (const char *file)
bool readVertexProgram (std::istream &stream)
bool readFragmentProgram (const char *file)
bool readFragmentProgram (std::istream &stream)
Field Get
*SFStringgetSFVertexProgram (void)
 Get the ShaderChunk::_sfVertexProgram field.
SFStringgetSFFragmentProgram (void)
 Get the ShaderChunk::_sfFragmentProgram field.
std::string & getVertexProgram (void)
 Get the value of the ShaderChunk::_sfVertexProgram field.
const std::string & getVertexProgram (void) const
 Get the value of the ShaderChunk::_sfVertexProgram field.
std::string & getFragmentProgram (void)
 Get the value of the ShaderChunk::_sfFragmentProgram field.
const std::string & getFragmentProgram (void) const
 Get the value of the ShaderChunk::_sfFragmentProgram field.
Field Set
*void setVertexProgram (const std::string &value)
 Set the value of the ShaderChunk::_sfVertexProgram field.
void setFragmentProgram (const std::string &value)
 Set the value of the ShaderChunk::_sfFragmentProgram field.
ShaderParameterChunk Access
*bool setUniformParameter (const char *name, bool value)
bool setUniformParameter (const char *name, Int32 value)
bool setUniformParameter (const char *name, Real32 value)
bool setUniformParameter (const char *name, const Vec2f &value)
bool setUniformParameter (const char *name, const Vec3f &value)
bool setUniformParameter (const char *name, const Vec4f &value)
bool setUniformParameter (const char *name, const Matrix &value)
bool getUniformParameter (const char *name, bool &value)
bool getUniformParameter (const char *name, Int32 &value)
bool getUniformParameter (const char *name, Real32 &value)
bool getUniformParameter (const char *name, Vec2f &value)
bool getUniformParameter (const char *name, Vec3f &value)
bool getUniformParameter (const char *name, Vec4f &value)
bool getUniformParameter (const char *name, Matrix &value)
bool subUniformParameter (const char *name)
Field Get
*MFShaderParameterPtrgetMFParameters (void)
 Get the ShaderParameterChunk::_mfParameters field.
ShaderParameterPtrgetParameters (const UInt32 index)
 Get the value of the index element the ShaderParameterChunk::_mfParameters field.
MFShaderParameterPtrgetParameters (void)
 Get the ShaderParameterChunk::_mfParameters field.
const MFShaderParameterPtrgetParameters (void) const
 Get the ShaderParameterChunk::_mfParameters field.
Chunk Class Access
*UInt32 getClassId (void) const
State
virtual bool isTransparent (void) const
Parents
*MFFieldContainerPtrgetParents (void)
const MFFieldContainerPtrgetParents (void) const
MFFieldContainerPtrgetMFParents (void)
void addParent (FieldContainerPtr parent)
void subParent (FieldContainerPtr parent)
Int32 findParent (FieldContainerPtr parent)
Parents
*SFBoolgetInternal (void)
const SFBoolgetInternal (void) const
SFBoolgetSFInternal (void)
void setInternal (bool bVal)
Get Instance Type Information
UInt32 getTypeId (void) const
UInt16 getGroupId (void) const
const Char8getTypeName (void) const
Generic Field Access *FieldgetField (UInt32 fieldId)
FieldgetField (const Char8 *fieldName)

Static Public Member Functions

Get Class Type Information
static UInt16 getClassGroupId (void)
Parameter funcs
*static UInt32 getFuncUniform1i (void)
static UInt32 getFuncUniform2iv (void)
static UInt32 getFuncUniform3iv (void)
static UInt32 getFuncUniform4iv (void)
static UInt32 getFuncUniform1f (void)
static UInt32 getFuncUniform2fv (void)
static UInt32 getFuncUniform3fv (void)
static UInt32 getFuncUniform4fv (void)
static UInt32 getFuncUniformMatrix4fv (void)
static UInt32 getFuncGetUniformiv (void)
static UInt32 getFuncGetUniformfv (void)
Cluster
*static void setClusterId (Int32 id)
Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction
*static SHLChunkPtr create (void)
 create a new instance of the class
static SHLChunkPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype
Static Chunk Class Access
*static UInt32 getStaticClassId (void)
static const StateChunkClassgetStaticClass (void)
Get Class Type Information
static UInt16 getClassGroupId (void)

Static Public Attributes

static const osg::BitVector CgFrontEndFieldMask
static const osg::BitVector GLIdFieldMask
static const osg::BitVector MTInfluenceMask
static const osg::BitVector VertexProgramFieldMask
static const osg::BitVector FragmentProgramFieldMask
static const osg::BitVector ParametersFieldMask
static const BitVector InternalFieldMask = (1 << Attachment::InternalFieldId)
static const BitVector ParentsFieldMask = (1 << Attachment::ParentsFieldId)
static const BitVector NextFieldMask
CoredNodePtr helper
static const bool isNodeCore = false
CoredNodePtr helper
static const bool isNodeCore = false

Protected Member Functions

void onCreate (const SHLChunk *source=NULL)
void onDestroy (void)
void onCreate (const ShaderParameterChunk *source=NULL)
Sync
void executeSyncImpl (FieldContainer *pOther, const BitVector &whichField)
MT Edit
template<class FieldTypeT>
*void beginEditX (const BitVector &whichField, FieldTypeT &field)
template<class FieldTypeT>
void endEditX (const BitVector &whichField, FieldTypeT &field)
MT Construction
*void onCreate (const FieldContainer *source=NULL)
void onCreateAspect (const FieldContainer *aspect0, const FieldContainer *source=NULL)
Constructors
SHLChunk (void)
 SHLChunk (const SHLChunk &source)
Destructors
*virtual ~SHLChunk (void)
Sync
*void executeSyncImpl (SHLChunkBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)
Sync
*void executeSyncImpl (ShaderChunkBase *pOther, const BitVector &whichField)
Sync
*void executeSyncImpl (ShaderParameterChunkBase *pOther, const BitVector &whichField)
Sync
*void executeSyncImpl (StateChunkBase *pOther, const BitVector &whichField)
Sync
void executeSyncImpl (Attachment *pOther, const BitVector &whichField)
Sync
void executeSyncImpl (FieldContainer *pOther, const BitVector &whichField)
MT Construction
*void onCreate (const FieldContainer *source=NULL)
void onCreateAspect (const FieldContainer *aspect0, const FieldContainer *source=NULL)
MT Edit
template<class FieldTypeT>
*void beginEditX (const BitVector &whichField, FieldTypeT &field)
template<class FieldTypeT>
void endEditX (const BitVector &whichField, FieldTypeT &field)

Static Protected Member Functions

Create Fieldcontainer
template<class ObjectPtrT>
*static void newPtr (ObjectPtrT &result, const typename ObjectPtrT::StoredObjectType *prototypeP)
template<class ObjectPtrT>
static void newPtr (ObjectPtrT &result)
Create Fieldcontainer
template<class ObjectPtrT>
*static void newPtr (ObjectPtrT &result, const typename ObjectPtrT::StoredObjectType *prototypeP)
template<class ObjectPtrT>
static void newPtr (ObjectPtrT &result)

Protected Attributes

Member
*UInt32 _shares
Fields
*SFBool _sfCgFrontEnd
SFUInt32 _sfGLId
Fields
*SFString _sfVertexProgram
SFString _sfFragmentProgram
Parameter Access
*ShaderParameterAccess_parameter_access
Fields
*MFShaderParameterPtr _mfParameters
Fields
*SFBool _sfInternal
MFFieldContainerPtr _parents
Member
*UInt32 _shares

Private Types

typedef SHLChunkBase Inherited
typedef std::map< std::string,
paramtercbfp
userParameterCallbacksMap

Private Member Functions

void handleGL (Window *win, UInt32 id)
void operator= (const SHLChunk &source)
void updateProgram (Window *win)
void checkOSGParameters (void)
void updateOSGParameters (DrawActionBase *action, GLuint program)

Static Private Member Functions

static void initMethod (void)
static void updateCameraOrientation (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateCameraPosition (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateViewMatrix (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateInvViewMatrix (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateStereoLeftEye (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateClusterId (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateActiveLightsMask (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateLight0Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateLight1Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateLight2Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateLight3Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateLight4Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateLight5Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateLight6Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
static void updateLight7Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)

Private Attributes

std::vector< paramtercbfp_osgParametersCallbacks
UInt32 _oldParameterSize
userParameterCallbacksMap _userParameterCallbacks

Static Private Attributes

static StateChunkClass _class
OpenGL Extension Handling
*static UInt32 _shl_extension
static UInt32 _cg_extension
static UInt32 _funcCreateProgramObject = Window::invalidFunctionID
static UInt32 _funcCreateShaderObject = Window::invalidFunctionID
static UInt32 _funcDeleteObject = Window::invalidFunctionID
static UInt32 _funcDetachObject = Window::invalidFunctionID
static UInt32 _funcAttachObject = Window::invalidFunctionID
static UInt32 _funcShaderSource = Window::invalidFunctionID
static UInt32 _funcCompileShader = Window::invalidFunctionID
static UInt32 _funcLinkProgram = Window::invalidFunctionID
static UInt32 _funcGetInfoLog = Window::invalidFunctionID
static UInt32 _funcUseProgramObject = Window::invalidFunctionID
static UInt32 _funcGetObjectParameteriv = Window::invalidFunctionID
static UInt32 _funcGetObjectParameterfv = Window::invalidFunctionID
static UInt32 _funcGetUniformLocation = Window::invalidFunctionID
static UInt32 _funcBindAttribLocation = Window::invalidFunctionID
static UInt32 _funcGetAttribLocation = Window::invalidFunctionID
static UInt32 _funcUniform1i = Window::invalidFunctionID
static UInt32 _funcUniform2iv = Window::invalidFunctionID
static UInt32 _funcUniform3iv = Window::invalidFunctionID
static UInt32 _funcUniform4iv = Window::invalidFunctionID
static UInt32 _funcUniform1f = Window::invalidFunctionID
static UInt32 _funcUniform2fv = Window::invalidFunctionID
static UInt32 _funcUniform3fv = Window::invalidFunctionID
static UInt32 _funcUniform4fv = Window::invalidFunctionID
static UInt32 _funcUniformMatrix4fv = Window::invalidFunctionID
static UInt32 _funcGetUniformiv = Window::invalidFunctionID
static UInt32 _funcGetUniformfv = Window::invalidFunctionID
static Int32 _clusterId = -1

Friends

class FieldContainer
class SHLChunkBase

Detailed Description

Definition at line 62 of file OSGSHLChunk.h.


Member Typedef Documentation

typedef SHLChunkBase osg::SHLChunk::Inherited [private]
 

Reimplemented from osg::SHLChunkBase.

Definition at line 66 of file OSGSHLChunk.h.

typedef void(* osg::SHLChunk::paramtercbfp)(PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
 

Definition at line 129 of file OSGSHLChunk.h.

typedef std::map<std::string, paramtercbfp> osg::SHLChunk::userParameterCallbacksMap [private]
 

Definition at line 286 of file OSGSHLChunk.h.

typedef SHLChunkPtr osg::SHLChunkBase::Ptr [inherited]
 

Reimplemented from osg::ShaderChunkBase.

Definition at line 91 of file OSGSHLChunkBase.h.


Member Enumeration Documentation

anonymous enum [inherited]
 

Enumerator:
CgFrontEndFieldId 
GLIdFieldId 
NextFieldId 

Reimplemented from osg::ShaderChunkBase.

Definition at line 93 of file OSGSHLChunkBase.h.

00094     {
00095         CgFrontEndFieldId = Inherited::NextFieldId,
00096         GLIdFieldId       = CgFrontEndFieldId + 1,
00097         NextFieldId       = GLIdFieldId       + 1
00098     };


Constructor & Destructor Documentation

SHLChunk::SHLChunk void   )  [protected]
 

Definition at line 165 of file OSGSHLChunk.cpp.

References _cg_extension, _funcAttachObject, _funcBindAttribLocation, _funcCompileShader, _funcCreateProgramObject, _funcCreateShaderObject, _funcDeleteObject, _funcDetachObject, _funcGetAttribLocation, _funcGetInfoLog, _funcGetObjectParameterfv, _funcGetObjectParameteriv, _funcGetUniformfv, _funcGetUniformiv, _funcGetUniformLocation, _funcLinkProgram, _funcShaderSource, _funcUniform1f, _funcUniform1i, _funcUniform2fv, _funcUniform2iv, _funcUniform3fv, _funcUniform3iv, _funcUniform4fv, _funcUniform4iv, _funcUniformMatrix4fv, _funcUseProgramObject, _shl_extension, OSG_DLSYM_UNDERSCORE, osg::Window::registerExtension(), and osg::Window::registerFunction().

00165                        :
00166     Inherited(),
00167     _osgParametersCallbacks(),
00168     _oldParameterSize(0),
00169     _userParameterCallbacks()
00170 {
00171     _shl_extension = Window::registerExtension("GL_ARB_shading_language_100");
00172     _cg_extension = Window::registerExtension("GL_EXT_Cg_shader");
00173 
00174     _funcCreateProgramObject =
00175         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glCreateProgramObjectARB", 
00176                                   _shl_extension);
00177 
00178     _funcCreateShaderObject =
00179         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glCreateShaderObjectARB", 
00180                                   _shl_extension);
00181     _funcDeleteObject =
00182         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glDeleteObjectARB", 
00183                                   _shl_extension);
00184     
00185     _funcDetachObject =
00186         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glDetachObjectARB", 
00187                                   _shl_extension);
00188     
00189     _funcAttachObject =
00190         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glAttachObjectARB", 
00191                                   _shl_extension);
00192 
00193     _funcShaderSource =
00194         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glShaderSourceARB", 
00195                                   _shl_extension);
00196                                   
00197     _funcCompileShader =
00198         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glCompileShaderARB", 
00199                                   _shl_extension);
00200                                   
00201     _funcLinkProgram =
00202         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glLinkProgramARB", 
00203                                   _shl_extension);
00204                                   
00205     _funcGetInfoLog =
00206         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetInfoLogARB", 
00207                                   _shl_extension);
00208                                   
00209     _funcUseProgramObject =
00210         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUseProgramObjectARB", 
00211                                   _shl_extension);
00212     
00213     _funcGetObjectParameteriv =
00214         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetObjectParameterivARB", 
00215                                   _shl_extension);
00216 
00217     _funcGetObjectParameterfv =
00218         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetObjectParameterfvARB", 
00219                                   _shl_extension);
00220 
00221     _funcGetUniformLocation =
00222         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetUniformLocationARB", 
00223                                   _shl_extension);
00224     
00225     _funcBindAttribLocation =
00226         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glBindAttribLocationARB", 
00227                                   _shl_extension);
00228 
00229     _funcGetAttribLocation =
00230         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetAttribLocationARB", 
00231                                   _shl_extension);
00232     
00233     _funcUniform1i =
00234         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform1iARB", 
00235                                   _shl_extension);
00236 
00237     _funcUniform2iv =
00238         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform2ivARB", 
00239                                   _shl_extension);
00240                                   
00241     _funcUniform3iv =
00242         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform3ivARB", 
00243                                   _shl_extension);
00244                                   
00245     _funcUniform4iv =
00246         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform4ivARB", 
00247                                   _shl_extension);
00248 
00249     _funcUniform1f =
00250         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform1fARB", 
00251                                   _shl_extension);
00252 
00253     _funcUniform2fv =
00254         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform2fvARB", 
00255                                   _shl_extension);
00256 
00257     _funcUniform3fv =
00258         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform3fvARB", 
00259                                   _shl_extension);
00260 
00261     _funcUniform4fv =
00262         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform4fvARB", 
00263                                   _shl_extension);
00264 
00265     _funcUniformMatrix4fv =
00266         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniformMatrix4fvARB", 
00267                                   _shl_extension);
00268 
00269     _funcGetUniformiv =
00270         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetUniformivARB", 
00271                                   _shl_extension);
00272     
00273     _funcGetUniformfv =
00274         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetUniformfvARB", 
00275                                   _shl_extension);
00276 }

SHLChunk::SHLChunk const SHLChunk source  )  [protected]
 

Definition at line 278 of file OSGSHLChunk.cpp.

00278                                          :
00279     Inherited(source),
00280     _osgParametersCallbacks(source._osgParametersCallbacks),
00281     _oldParameterSize(source._oldParameterSize),
00282     _userParameterCallbacks(source._userParameterCallbacks)
00283 {
00284 }

SHLChunk::~SHLChunk void   )  [protected, virtual]
 

Definition at line 286 of file OSGSHLChunk.cpp.

00287 {
00288 }


Member Function Documentation

const StateChunkClass * SHLChunk::getClass void   )  const [virtual]
 

Reimplemented from osg::StateChunk.

Definition at line 318 of file OSGSHLChunk.cpp.

References _class.

00319 {
00320     return &_class;
00321 }

void SHLChunk::changed BitVector  whichField,
UInt32  origin
[virtual]
 

Reimplemented from osg::ShaderChunk.

Definition at line 325 of file OSGSHLChunk.cpp.

References osg::SHLChunkBase::CgFrontEndFieldMask, osg::ShaderChunk::changed(), osg::ShaderChunkBase::FragmentProgramFieldMask, osg::SHLChunkBase::getGLId(), osg::ShaderParameterChunkBase::ParametersFieldMask, osg::Window::refreshGLObject(), osg::Window::reinitializeGLObject(), and osg::ShaderChunkBase::VertexProgramFieldMask.

00326 {
00327     if((whichField & VertexProgramFieldMask) ||
00328        (whichField & FragmentProgramFieldMask) ||
00329        (whichField & CgFrontEndFieldMask))
00330     {
00331         Window::reinitializeGLObject(getGLId());
00332     }
00333 
00334     if(whichField & ParametersFieldMask)
00335     {
00336         Window::refreshGLObject(getGLId());
00337     }
00338 
00339     Inherited::changed(whichField, origin);
00340 }

void SHLChunk::dump UInt32  uiIndent = 0,
const BitVector  bvFlags = 0
const [virtual]
 

Reimplemented from osg::ShaderChunk.

Definition at line 342 of file OSGSHLChunk.cpp.

References SLOG.

00344 {
00345     SLOG << "Dump SHLChunk NI" << std::endl;
00346 }

void SHLChunk::updateParameters Window win,
const MFShaderParameterPtr parameters,
bool  useProgram = true,
bool  force = false,
bool  keepProgramActive = false
 

Definition at line 568 of file OSGSHLChunk.cpp.

References _funcGetUniformfv, _funcGetUniformLocation, _funcUniform1f, _funcUniform1i, _funcUniform2fv, _funcUniform3fv, _funcUniform4fv, _funcUniformMatrix4fv, _funcUseProgramObject, checkOSGParameters(), osg::AttachmentContainerPtr::dcast(), osg::MField< FieldTypeT, fieldNameSpace >::empty(), FWARNING, osg::Window::getFunction(), osg::SHLChunkBase::getGLId(), osg::Window::getGLObjectId(), GLint(), GLuint(), p, osg::ShaderParameter::SHPTypeBool, osg::ShaderParameter::SHPTypeInt, osg::ShaderParameter::SHPTypeMatrix, osg::ShaderParameter::SHPTypeReal, osg::ShaderParameter::SHPTypeVec2f, osg::ShaderParameter::SHPTypeVec3f, osg::ShaderParameter::SHPTypeVec4f, and osg::MField< FieldTypeT, fieldNameSpace >::size().

Referenced by handleGL(), and updateProgram().

00572 {
00573     GLuint program = (GLuint) win->getGLObjectId(getGLId());
00574 
00575     if(program == 0)
00576         return;
00577 
00578     checkOSGParameters();
00579 
00580     if(parameters.empty())
00581         return;
00582 
00583     // get "glUseProgramObjectARB" function pointer
00584     PFNGLUSEPROGRAMOBJECTARBPROC useProgramObject = (PFNGLUSEPROGRAMOBJECTARBPROC)
00585         win->getFunction(_funcUseProgramObject);
00586 
00587     if(useProgram)
00588         useProgramObject(program);
00589 
00590     // get "glGetUniformLocationARB" function pointer
00591     PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation = (PFNGLGETUNIFORMLOCATIONARBPROC)
00592         win->getFunction(_funcGetUniformLocation);
00593 
00594     // just a example showing how to get parameter values.
00595 #if 0
00596     // get "glGetUniformfvARB" function pointer
00597     PFNGLGETUNIFORMFVARBPROC getUniformfv = (PFNGLGETUNIFORMFVARBPROC)
00598         win->getFunction(_funcGetUniformfv);
00599     GLfloat values[2];
00600     getUniformfv(program, location, values);
00601 #endif
00602 
00603     for(UInt32 i = 0; i < parameters.size(); ++i)
00604     {
00605         ShaderParameterPtr parameter = parameters[i];