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

osg::FragmentProgramChunk Class Reference
[OpenGL State Handling]

FragmentProgramChunk class. See FragmentProgramChunk for a description. More...

#include <OSGFragmentProgramChunk.h>

Inheritance diagram for osg::FragmentProgramChunk:

osg::FragmentProgramChunkBase osg::ProgramChunk osg::ProgramChunkBase osg::StateChunk osg::StateChunkBase osg::Attachment osg::FieldContainer List of all members.

Public Types

typedef FragmentProgramChunkPtr Ptr
enum  {
  ProgramFieldId = Inherited::NextFieldId, ParamValuesFieldId = ProgramFieldId + 1, ParamNamesFieldId = ParamValuesFieldId + 1, GLIdFieldId = ParamNamesFieldId + 1,
  NextFieldId = GLIdFieldId + 1
}

Public Member Functions

ProgamChunk Commands
*bool read (const char *file)
bool read (std::istream &stream)
bool addParameter (const char *name, Int16 index)
bool addParameter (const char *name, Int16 index, const Vec4f &value)
const Vec4fgetParameter (Int16 index)
const Vec4fgetParameter (const char *name)
const Vec4fgetParameter (const std::string &name)
bool setParameter (Int16 index, const Vec4f &value)
bool setParameter (const char *name, const Vec4f &value)
bool setParameter (const std::string &name, const Vec4f &value)
Int16 findParameter (const char *name)
Int16 findParameter (const std::string &name)
State Commands
*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)
virtual bool isTransparent (void) const
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
Field Get
*SFStringgetSFProgram (void)
 Get the ProgramChunk::_sfProgram field.
MFVec4fgetMFParamValues (void)
 Get the ProgramChunk::_mfParamValues field.
MFStringgetMFParamNames (void)
 Get the ProgramChunk::_mfParamNames field.
std::string & getProgram (void)
 Get the value of the ProgramChunk::_sfProgram field.
const std::string & getProgram (void) const
 Get the value of the ProgramChunk::_sfProgram field.
Vec4fgetParamValues (const UInt32 index)
 Get the value of the index element the ProgramChunk::_mfParamValues field.
MFVec4fgetParamValues (void)
 Get the ProgramChunk::_mfParamValues field.
const MFVec4fgetParamValues (void) const
 Get the ProgramChunk::_mfParamValues field.
std::string & getParamNames (const UInt32 index)
 Get the value of the index element the ProgramChunk::_mfParamNames field.
MFStringgetParamNames (void)
 Get the ProgramChunk::_mfParamNames field.
const MFStringgetParamNames (void) const
 Get the ProgramChunk::_mfParamNames field.
Field Set
*void setProgram (const std::string &value)
 Set the value of the ProgramChunk::_sfProgram field.
Chunk Class Access
*virtual const StateChunkClassgetClass (void) const
Sync
*virtual void changed (BitVector whichField, UInt32 origin)
Output
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
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
ProgamChunk Commands
*bool read (const char *file)
bool read (std::istream &stream)
bool addParameter (const char *name, Int16 index)
bool addParameter (const char *name, Int16 index, const Vec4f &value)
const Vec4fgetParameter (Int16 index)
const Vec4fgetParameter (const char *name)
const Vec4fgetParameter (const std::string &name)
bool setParameter (Int16 index, const Vec4f &value)
bool setParameter (const char *name, const Vec4f &value)
bool setParameter (const std::string &name, const Vec4f &value)
Int16 findParameter (const char *name)
Int16 findParameter (const std::string &name)
State Commands
*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)
virtual bool isTransparent (void) const
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
Field Get
*SFStringgetSFProgram (void)
 Get the ProgramChunk::_sfProgram field.
MFVec4fgetMFParamValues (void)
 Get the ProgramChunk::_mfParamValues field.
MFStringgetMFParamNames (void)
 Get the ProgramChunk::_mfParamNames field.
std::string & getProgram (void)
 Get the value of the ProgramChunk::_sfProgram field.
const std::string & getProgram (void) const
 Get the value of the ProgramChunk::_sfProgram field.
Vec4fgetParamValues (const UInt32 index)
 Get the value of the index element the ProgramChunk::_mfParamValues field.
MFVec4fgetParamValues (void)
 Get the ProgramChunk::_mfParamValues field.
const MFVec4fgetParamValues (void) const
 Get the ProgramChunk::_mfParamValues field.
std::string & getParamNames (const UInt32 index)
 Get the value of the index element the ProgramChunk::_mfParamNames field.
MFStringgetParamNames (void)
 Get the ProgramChunk::_mfParamNames field.
const MFStringgetParamNames (void) const
 Get the ProgramChunk::_mfParamNames field.
Field Set
*void setProgram (const std::string &value)
 Set the value of the ProgramChunk::_sfProgram field.
ProgamChunk Commands
*bool read (const char *file)
bool read (std::istream &stream)
bool addParameter (const char *name, Int16 index)
bool addParameter (const char *name, Int16 index, const Vec4f &value)
const Vec4fgetParameter (Int16 index)
const Vec4fgetParameter (const char *name)
const Vec4fgetParameter (const std::string &name)
bool setParameter (Int16 index, const Vec4f &value)
bool setParameter (const char *name, const Vec4f &value)
bool setParameter (const std::string &name, const Vec4f &value)
Int16 findParameter (const char *name)
Int16 findParameter (const std::string &name)
State Commands
*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)
virtual bool isTransparent (void) const
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
Field Get
*SFStringgetSFProgram (void)
 Get the ProgramChunk::_sfProgram field.
MFVec4fgetMFParamValues (void)
 Get the ProgramChunk::_mfParamValues field.
MFStringgetMFParamNames (void)
 Get the ProgramChunk::_mfParamNames field.
std::string & getProgram (void)
 Get the value of the ProgramChunk::_sfProgram field.
const std::string & getProgram (void) const
 Get the value of the ProgramChunk::_sfProgram field.
Vec4fgetParamValues (const UInt32 index)
 Get the value of the index element the ProgramChunk::_mfParamValues field.
MFVec4fgetParamValues (void)
 Get the ProgramChunk::_mfParamValues field.
const MFVec4fgetParamValues (void) const
 Get the ProgramChunk::_mfParamValues field.
std::string & getParamNames (const UInt32 index)
 Get the value of the index element the ProgramChunk::_mfParamNames field.
MFStringgetParamNames (void)
 Get the ProgramChunk::_mfParamNames field.
const MFStringgetParamNames (void) const
 Get the ProgramChunk::_mfParamNames field.
Field Set
*void setProgram (const std::string &value)
 Set the value of the ProgramChunk::_sfProgram field.

Static Public Member Functions

Static Chunk Class Access
*static UInt32 getStaticClassId (void)
static const StateChunkClassgetStaticClass (void)
Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction
*static FragmentProgramChunkPtr create (void)
 create a new instance of the class
static FragmentProgramChunkPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype

Static Public Attributes

static const osg::BitVector MTInfluenceMask
static const osg::BitVector ProgramFieldMask
static const osg::BitVector ParamValuesFieldMask
static const osg::BitVector ParamNamesFieldMask
static const osg::BitVector GLIdFieldMask
static const BitVector InternalFieldMask = (1 << Attachment::InternalFieldId)
static const BitVector ParentsFieldMask = (1 << Attachment::ParentsFieldId)
static const BitVector NextFieldMask

Protected Member Functions

Sync
*void executeSyncImpl (ProgramChunkBase *pOther, const BitVector &whichField)
Init
*void onCreate (const ProgramChunk *source=NULL)
GL
*void handleGL (Window *win, UInt32 id, GLenum target, UInt32 extension)
Program-Specific Methods
void printCompileError (Window *win, UInt32 idstatus)
Field Get
*SFUInt32getSFGLId (void)
 Get the ProgramChunk::_sfGLId field.
UInt32getGLId (void)
 Get the value of the ProgramChunk::_sfGLId field.
const UInt32getGLId (void) const
 Get the value of the ProgramChunk::_sfGLId field.
Field Set
*void setGLId (const UInt32 &value)
 Set the value of the ProgramChunk::_sfGLId field.
Init
*void onCreate (const FragmentProgramChunk *source=NULL)
Constructors
FragmentProgramChunk (void)
 FragmentProgramChunk (const FragmentProgramChunk &source)
Destructors
*virtual ~FragmentProgramChunk (void)
Program-Specific Methods
*virtual UInt32 getExtension (void) const
virtual GLenum getTarget (void) const
virtual const char * getTargetName (void) const
Sync
*void executeSyncImpl (FragmentProgramChunkBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)
Sync
*void executeSyncImpl (ProgramChunkBase *pOther, const BitVector &whichField)
Init
*void onCreate (const ProgramChunk *source=NULL)
Program-Specific Methods
void printCompileError (Window *win, UInt32 idstatus)
GL
*void handleGL (Window *win, UInt32 id, GLenum target, UInt32 extension)
Field Get
*SFUInt32getSFGLId (void)
 Get the ProgramChunk::_sfGLId field.
UInt32getGLId (void)
 Get the value of the ProgramChunk::_sfGLId field.
const UInt32getGLId (void) const
 Get the value of the ProgramChunk::_sfGLId field.
Field Set
*void setGLId (const UInt32 &value)
 Set the value of the ProgramChunk::_sfGLId field.
Sync
*void executeSyncImpl (ProgramChunkBase *pOther, const BitVector &whichField)
Init
*void onCreate (const ProgramChunk *source=NULL)
Program-Specific Methods
void printCompileError (Window *win, UInt32 idstatus)
GL
*void handleGL (Window *win, UInt32 id, GLenum target, UInt32 extension)
Field Get
*SFUInt32getSFGLId (void)
 Get the ProgramChunk::_sfGLId field.
UInt32getGLId (void)
 Get the value of the ProgramChunk::_sfGLId field.
const UInt32getGLId (void) const
 Get the value of the ProgramChunk::_sfGLId field.
Field Set
*void setGLId (const UInt32 &value)
 Set the value of the ProgramChunk::_sfGLId field.

Protected Attributes

Fields
*SFString _sfProgram
MFVec4f _mfParamValues
MFString _mfParamNames
SFUInt32 _sfGLId
Fields
*SFString _sfProgram
MFVec4f _mfParamValues
MFString _mfParamNames
SFUInt32 _sfGLId
Fields
*SFString _sfProgram
MFVec4f _mfParamValues
MFString _mfParamNames
SFUInt32 _sfGLId

Private Types

typedef FragmentProgramChunkBase Inherited

Private Member Functions

void operator= (const FragmentProgramChunk &source)
GL
*void handleGL (Window *win, UInt32 id)

Static Private Member Functions

static void initMethod (void)

Static Private Attributes

static StateChunkClass _class
OpenGL Extension Handling
*static UInt32 _arbFragmentProgram

Friends

class FieldContainer
class FragmentProgramChunkBase

Detailed Description

See FragmentProgramChunk for a description. The FragmentProgramChunk implements Fragment Programs as specified in the GL_ARB_fragment_program extension. It is just a special version of the osg::ProgramChunk, which contains the whole public interface.

Definition at line 55 of file OSGFragmentProgramChunk.h.


Member Typedef Documentation

typedef FragmentProgramChunkBase osg::FragmentProgramChunk::Inherited [private]
 

Reimplemented from osg::FragmentProgramChunkBase.

Definition at line 59 of file OSGFragmentProgramChunk.h.

typedef FragmentProgramChunkPtr osg::FragmentProgramChunkBase::Ptr [inherited]
 

Reimplemented from osg::ProgramChunkBase.

Definition at line 89 of file OSGFragmentProgramChunkBase.h.


Member Enumeration Documentation

anonymous enum [inherited]
 

Enumerator:
ProgramFieldId 
ParamValuesFieldId 
ParamNamesFieldId 
GLIdFieldId 
NextFieldId 

Reimplemented from osg::Attachment.

Definition at line 95 of file OSGProgramChunkBase.h.

00096     {
00097         ProgramFieldId     = Inherited::NextFieldId,
00098         ParamValuesFieldId = ProgramFieldId     + 1,
00099         ParamNamesFieldId  = ParamValuesFieldId + 1,
00100         GLIdFieldId        = ParamNamesFieldId  + 1,
00101         NextFieldId        = GLIdFieldId        + 1
00102     };


Constructor & Destructor Documentation

FragmentProgramChunk::FragmentProgramChunk void   )  [protected]
 

Definition at line 94 of file OSGFragmentProgramChunk.cpp.

References _arbFragmentProgram, and osg::Window::registerExtension().

00094                                                :
00095     Inherited()
00096 {
00097     _arbFragmentProgram = Window::registerExtension("GL_ARB_fragment_program");
00098 }

FragmentProgramChunk::FragmentProgramChunk const FragmentProgramChunk source  )  [protected]
 

Definition at line 100 of file OSGFragmentProgramChunk.cpp.

00100                                                                              :
00101     Inherited(source)
00102 {
00103 }

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

Definition at line 105 of file OSGFragmentProgramChunk.cpp.

00106 {
00107 }


Member Function Documentation

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

Reimplemented from osg::ProgramChunk.

Definition at line 138 of file OSGFragmentProgramChunk.cpp.

References _class.

00139 {
00140     return &_class;
00141 }

UInt32 osg::FragmentProgramChunk::getStaticClassId void   )  [inline, static]
 

Reimplemented from osg::ProgramChunk.

Definition at line 46 of file OSGFragmentProgramChunk.inl.

References osg::StateChunkClass::getId(), and getStaticClass().

00047 {
00048     return getStaticClass()->getId();
00049 }

const StateChunkClass * osg::FragmentProgramChunk::getStaticClass void   )  [inline, static]
 

Reimplemented from osg::ProgramChunk.

Definition at line 52 of file OSGFragmentProgramChunk.inl.

References _class.

Referenced by getStaticClassId().

00053 {
00054     return &FragmentProgramChunk::_class;
00055 }

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

Reimplemented from osg::ProgramChunk.

Definition at line 145 of file OSGFragmentProgramChunk.cpp.

References osg::ProgramChunk::changed().

00146 {
00147     Inherited::changed(whichField, origin);
00148 }

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

Reimplemented from osg::ProgramChunk.

Definition at line 150 of file OSGFragmentProgramChunk.cpp.

References SLOG.

00152 {
00153     SLOG << "Dump FragmentProgramChunk NI" << std::endl;
00154 }

void FragmentProgramChunk::onCreate const FragmentProgramChunk source = NULL  )  [protected]
 

Definition at line 111 of file OSGFragmentProgramChunk.cpp.

References osg::beginEditCP(), osg::endEditCP(), osg::ProgramChunkBase::GLIdFieldMask, osg::GlobalSystemState, handleGL(), osg::osgTypedMethodVoidFunctor2ObjCPtrPtr(), osg::Window::registerGLObject(), osg::ProgramChunkBase::setGLId(), and osg::Startup.

00112 {
00113     if(GlobalSystemState == Startup)
00114         return;
00115 
00116     // !!! this temporary is needed to work around compiler problems (sgi)
00117     // CHECK CHECK
00118     //  FragmentProgramChunkPtr tmpPtr = FieldContainer::getPtr<ProgramChunkPtr>(*this);
00119     FragmentProgramChunkPtr tmpPtr(*this);
00120 
00121     beginEditCP(tmpPtr, FragmentProgramChunk::GLIdFieldMask);
00122 
00123     setGLId(
00124         Window::registerGLObject(
00125             osgTypedMethodVoidFunctor2ObjCPtrPtr<FragmentProgramChunkPtr, 
00126                                                  Window , 
00127                                                  UInt32>(
00128                                                      tmpPtr, 
00129                                                      &FragmentProgramChunk::handleGL),
00130             1));
00131 
00132     endEditCP(tmpPtr, FragmentProgramChunk::GLIdFieldMask);
00133 }

UInt32 FragmentProgramChunk::getExtension void   )  const [protected, virtual]
 

Virtual helper function to let the derived chunks return the extension that they implement. Only if this extension is supproted on the current Window is the porgram called.

Reimplemented from osg::ProgramChunk.

Definition at line 166 of file OSGFragmentProgramChunk.cpp.

References _arbFragmentProgram.

00167 {
00168     return _arbFragmentProgram;
00169 }

GLenum FragmentProgramChunk::getTarget void   )  const [protected, virtual]
 

Virtual helper function to let the derived chunks return the target constant that they implement.

Reimplemented from osg::ProgramChunk.

Definition at line 171 of file OSGFragmentProgramChunk.cpp.

References GL_FRAGMENT_PROGRAM_ARB.

00172 {
00173     return GL_FRAGMENT_PROGRAM_ARB;
00174 }

const char * FragmentProgramChunk::getTargetName void   )  const [protected, virtual]
 

Virtual helper function to let the derived chunks return the name of the target constant that they implement, for debugging purposes.

Reimplemented from osg::ProgramChunk.

Definition at line 176 of file OSGFragmentProgramChunk.cpp.

00177 {
00178     return "Fragment Program";
00179 }

void FragmentProgramChunk::initMethod void   )  [static, private]
 

Reimplemented from osg::ProgramChunk.

Definition at line 79 of file OSGFragmentProgramChunk.cpp.

00080 {
00081 }

void FragmentProgramChunk::handleGL Window win,
UInt32  idstatus
[private]
 

GL object handler create the program and destroy it

Definition at line 161 of file OSGFragmentProgramChunk.cpp.

References _arbFragmentProgram, GL_FRAGMENT_PROGRAM_ARB, and osg::ProgramChunk::handleGL().

Referenced by onCreate().

00162 {
00163     Inherited::handleGL(win, idstatus, GL_FRAGMENT_PROGRAM_ARB, _arbFragmentProgram);
00164 }

void osg::FragmentProgramChunk::operator= const FragmentProgramChunk source  )  [private]
 

osg::FieldContainerType & osg::FragmentProgramChunkBase::getClassType void   )  [inline, static, inherited]
 

Reimplemented from osg::ProgramChunkBase.

Definition at line 58 of file OSGFragmentProgramChunkBase.inl.

References osg::FragmentProgramChunkBase::_type.

Referenced by osg::FragmentProgramChunkBase::create(), and osg::RemoteAspect::RemoteAspect().

00059 {
00060     return _type; 
00061 } 

osg::UInt32 osg::FragmentProgramChunkBase::getClassTypeId void   )  [inline, static, inherited]
 

Reimplemented from osg::ProgramChunkBase.

Definition at line 65 of file OSGFragmentProgramChunkBase.inl.

References osg::FragmentProgramChunkBase::_type, and osg::TypeBase::getId().

00066 {
00067     return _type.getId(); 
00068 } 

FieldContainerType & FragmentProgramChunkBase::getType void   )  [virtual, inherited]
 

Reimplemented from osg::ProgramChunkBase.

Definition at line 86 of file OSGFragmentProgramChunkBase.cpp.

References osg::FragmentProgramChunkBase::_type.

00087 {
00088     return _type; 
00089 } 

const FieldContainerType & FragmentProgramChunkBase::getType void   )  const [virtual, inherited]
 

Reimplemented from osg::ProgramChunkBase.

Definition at line 91 of file OSGFragmentProgramChunkBase.cpp.

References osg::FragmentProgramChunkBase::_type.

00092 {
00093     return _type;
00094 } 

UInt32 FragmentProgramChunkBase::getContainerSize void   )  const [virtual, inherited]
 

Reimplemented from osg::ProgramChunkBase.

Definition at line 106 of file OSGFragmentProgramChunkBase.cpp.

00107 { 
00108     return sizeof(FragmentProgramChunk); 
00109 }

UInt32 FragmentProgramChunkBase::getBinSize const BitVector whichField  )  [virtual, inherited]
 

Reimplemented from osg::ProgramChunkBase.

Definition at line 166 of file OSGFragmentProgramChunkBase.cpp.

References osg::ProgramChunkBase::getBinSize().

00167 {
00168     UInt32 returnValue = Inherited::getBinSize(whichField);
00169 
00170 
00171     return returnValue;
00172 }

void FragmentProgramChunkBase::copyToBin BinaryDataHandler pMem,
const BitVector whichField
[virtual, inherited]