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

osg::FatBorderChunk Class Reference

FatBorderChunk class. See PageMyExtensionFatBorderChunk for a description.

#include <OSGFatBorderChunk.h>

Inheritance diagram for osg::FatBorderChunk:

osg::FatBorderChunkBase osg::VertexProgramChunk osg::VertexProgramChunkBase osg::ProgramChunk osg::ProgramChunkBase osg::StateChunk osg::StateChunkBase osg::Attachment osg::FieldContainer List of all members.

Public Types

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

Public Member Functions

Sync
*virtual void changed (BitVector whichField, UInt32 origin)
Output
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
Helper Functions
*void activateWithStandardLighting ()
void activateWithFragmentBasedLighting ()
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
Chunk Class Access
*virtual const StateChunkClassgetClass (void) const
Chunk Class Access
*virtual const StateChunkClassgetClass (void) const

Static Public Member Functions

Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction
*static FatBorderChunkPtr create (void)
 create a new instance of the class
static FatBorderChunkPtr 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)
Static Chunk Class Access
*static UInt32 getStaticClassId (void)
static const StateChunkClassgetStaticClass (void)

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

Constructors
FatBorderChunk (void)
 FatBorderChunk (const FatBorderChunk &source)
void onCreate (const FatBorderChunk *source=NULL)
Destructors
*virtual ~FatBorderChunk (void)
Sync
*void executeSyncImpl (FatBorderChunkBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)
Sync
*void executeSyncImpl (VertexProgramChunkBase *pOther, const BitVector &whichField)
Init
*void onCreate (const VertexProgramChunk *source=NULL)
Program-Specific Methods
*virtual UInt32 getExtension (void) const
virtual GLenum getTarget (void) const
virtual const char * getTargetName (void) const
Init
*void onCreate (const VertexProgramChunk *source=NULL)
Program-Specific Methods
*virtual UInt32 getExtension (void) const
virtual GLenum getTarget (void) const
virtual const char * getTargetName (void) const

Private Types

typedef FatBorderChunkBase Inherited

Private Member Functions

void operator= (const FatBorderChunk &source)

Static Private Member Functions

static void initMethod (void)

Friends

class FieldContainer
class FatBorderChunkBase

Detailed Description

Definition at line 55 of file OSGFatBorderChunk.h.


Member Typedef Documentation

typedef FatBorderChunkBase osg::FatBorderChunk::Inherited [private]
 

Reimplemented from osg::FatBorderChunkBase.

Definition at line 59 of file OSGFatBorderChunk.h.

typedef FatBorderChunkPtr osg::FatBorderChunkBase::Ptr [inherited]
 

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 89 of file OSGFatBorderChunkBase.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

FatBorderChunk::FatBorderChunk void   )  [protected]
 

Definition at line 225 of file OSGFatBorderChunk.cpp.

00225                                    :
00226     Inherited()
00227 {
00228 // Don't do that in the constructor
00229 //  activateWithStandardLighting( );
00230 }

FatBorderChunk::FatBorderChunk const FatBorderChunk source  )  [protected]
 

Definition at line 232 of file OSGFatBorderChunk.cpp.

00232                                                            :
00233     Inherited(source)
00234 {
00235 }

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

Definition at line 247 of file OSGFatBorderChunk.cpp.

00248 {
00249 }


Member Function Documentation

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

Reimplemented from osg::VertexProgramChunk.

Definition at line 253 of file OSGFatBorderChunk.cpp.

References osg::VertexProgramChunk::changed().

00254 {
00255     Inherited::changed(whichField, origin);
00256 }

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

Reimplemented from osg::VertexProgramChunk.

Definition at line 258 of file OSGFatBorderChunk.cpp.

References SLOG.

00260 {
00261     SLOG << "Dump FatBorderChunk NI" << std::endl;
00262 }

void FatBorderChunk::activateWithStandardLighting  ) 
 

Definition at line 264 of file OSGFatBorderChunk.cpp.

References osg::beginEditCP(), osg::endEditCP(), osg::ProgramChunkBase::ProgramFieldMask, osg::ProgramChunkBase::setProgram(), and vertexProgStandard.

Referenced by onCreate().

00265 {
00266     beginEditCP( FatBorderChunkPtr( this ), ProgramFieldMask );
00267     {
00268         setProgram( vertexProgStandard );
00269 //      setProgram( "" );
00270     }
00271     endEditCP( FatBorderChunkPtr( this ), ProgramFieldMask );
00272 }

void FatBorderChunk::activateWithFragmentBasedLighting  ) 
 

Definition at line 274 of file OSGFatBorderChunk.cpp.

References osg::beginEditCP(), osg::endEditCP(), osg::ProgramChunkBase::ProgramFieldMask, osg::ProgramChunkBase::setProgram(), and vertexProgFBasedLight.

00275 {
00276     beginEditCP( FatBorderChunkPtr( this ), ProgramFieldMask );
00277     {
00278         setProgram( vertexProgFBasedLight );
00279 //      setProgram( "" );
00280     }
00281     endEditCP( FatBorderChunkPtr( this ), ProgramFieldMask );
00282 }

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

Definition at line 238 of file OSGFatBorderChunk.cpp.

References activateWithStandardLighting(), osg::GlobalSystemState, osg::VertexProgramChunk::onCreate(), and osg::Startup.

00239 {
00240     if(GlobalSystemState == Startup)
00241         return;
00242 
00243     Inherited::onCreate(NULL);
00244     activateWithStandardLighting();
00245 }

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

Reimplemented from osg::VertexProgramChunk.

Definition at line 210 of file OSGFatBorderChunk.cpp.

00211 {
00212 }

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

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

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 58 of file OSGFatBorderChunkBase.inl.

References osg::FatBorderChunkBase::_type.

Referenced by osg::FatBorderChunkBase::create().

00059 {
00060     return _type; 
00061 } 

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

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 65 of file OSGFatBorderChunkBase.inl.

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

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

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

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 86 of file OSGFatBorderChunkBase.cpp.

References osg::FatBorderChunkBase::_type.

00087 {
00088     return _type; 
00089 } 

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

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 91 of file OSGFatBorderChunkBase.cpp.

References osg::FatBorderChunkBase::_type.

00092 {
00093     return _type;
00094 } 

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

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 106 of file OSGFatBorderChunkBase.cpp.

00107 { 
00108     return sizeof(FatBorderChunk); 
00109 }

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

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 166 of file OSGFatBorderChunkBase.cpp.

References osg::VertexProgramChunkBase::getBinSize().

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

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

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 174 of file OSGFatBorderChunkBase.cpp.

References osg::VertexProgramChunkBase::copyToBin().

00176 {
00177     Inherited::copyToBin(pMem, whichField);
00178 
00179 
00180 }

void FatBorderChunkBase::copyFromBin BinaryDataHandler pMem,
const BitVector whichField
[virtual, inherited]
 

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 182 of file OSGFatBorderChunkBase.cpp.

References osg::VertexProgramChunkBase::copyFromBin().

00184 {
00185     Inherited::copyFromBin(pMem, whichField);
00186 
00187 
00188 }

FatBorderChunkPtr osg::FatBorderChunkBase::create void   )  [inline, static, inherited]
 

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 72 of file OSGFatBorderChunkBase.inl.

References osg::AttachmentPtr::dcast(), osg::FatBorderChunkBase::getClassType(), osg::FieldContainerType::getPrototype(), osg::NullFC, and osg::FatBorderChunkBase::shallowCopy().

00073 {
00074     FatBorderChunkPtr fc; 
00075 
00076     if(getClassType().getPrototype() != OSG::NullFC) 
00077     {
00078         fc = FatBorderChunkPtr::dcast(
00079             getClassType().getPrototype()-> shallowCopy()); 
00080     }
00081     
00082     return fc; 
00083 }

FatBorderChunkPtr osg::FatBorderChunkBase::createEmpty void   )  [inline, static, inherited]
 

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 87 of file OSGFatBorderChunkBase.inl.

References osg::FieldContainer::newPtr().

00088 { 
00089     FatBorderChunkPtr returnValue; 
00090     
00091     newPtr(returnValue); 
00092 
00093     return returnValue; 
00094 }

FieldContainerPtr FatBorderChunkBase::shallowCopy void   )  const [virtual, inherited]
 

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 97 of file OSGFatBorderChunkBase.cpp.

References osg::FieldContainer::newPtr().

Referenced by osg::FatBorderChunkBase::create().

00098 { 
00099     FatBorderChunkPtr returnValue; 
00100 
00101     newPtr(returnValue, dynamic_cast<const FatBorderChunk *>(this)); 
00102 
00103     return returnValue; 
00104 }

void FatBorderChunkBase::executeSyncImpl FatBorderChunkBase pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 191 of file OSGFatBorderChunkBase.cpp.

References osg::VertexProgramChunkBase::executeSyncImpl().

Referenced by osg::FatBorderChunkBase::executeSync().

00193 {
00194 
00195     Inherited::executeSyncImpl(pOther, whichField);
00196 
00197 
00198 }

void VertexProgramChunkBase::executeSyncImpl VertexProgramChunkBase pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 191 of file OSGVertexProgramChunkBase.cpp.

References osg::ProgramChunkBase::executeSyncImpl().

Referenced by osg::VertexProgramChunkBase::executeSync(), and osg::FatBorderChunkBase::executeSyncImpl().

00193 {
00194 
00195     Inherited::executeSyncImpl(pOther, whichField);
00196 
00197 
00198 }

void ProgramChunkBase::executeSyncImpl ProgramChunkBase pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 305 of file OSGProgramChunkBase.cpp.

References osg::ProgramChunkBase::_mfParamNames, osg::ProgramChunkBase::_mfParamValues, osg::ProgramChunkBase::_sfGLId, osg::ProgramChunkBase::_sfProgram, osg::StateChunkBase::executeSyncImpl(), osg::ProgramChunkBase::GLIdFieldMask, osg::FieldBits::NoField, osg::ProgramChunkBase::ParamNamesFieldMask, osg::ProgramChunkBase::ParamValuesFieldMask, osg::ProgramChunkBase::ProgramFieldMask, osg::MField< FieldTypeT, fieldNameSpace >::syncWith(), and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by osg::ProgramChunkBase::executeSync(), osg::VertexProgramChunkBase::executeSyncImpl(), and osg::FragmentProgramChunkBase::executeSyncImpl().

00307 {
00308 
00309     Inherited::executeSyncImpl(pOther, whichField);
00310 
00311     if(FieldBits::NoField != (ProgramFieldMask & whichField))
00312         _sfProgram.syncWith(pOther->_sfProgram);
00313 
00314     if(FieldBits::NoField != (ParamValuesFieldMask & whichField))
00315         _mfParamValues.syncWith(pOther->_mfParamValues);
00316 
00317     if(FieldBits::NoField != (ParamNamesFieldMask & whichField))
00318         _mfParamNames.syncWith(pOther->_mfParamNames);
00319 
00320     if(FieldBits::NoField != (GLIdFieldMask & whichField))
00321         _sfGLId.syncWith(pOther->_sfGLId);
00322 
00323 
00324 }

void StateChunkBase::executeSyncImpl StateChunkBase pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 182 of file OSGStateChunkBase.cpp.

References osg::Attachment::executeSyncImpl().

Referenced by osg::StateChunkBase::executeSync(), osg::TwoSidedLightingChunkBase::executeSyncImpl(), osg::TransformChunkBase::executeSyncImpl(), osg::TextureChunkBase::executeSyncImpl(), osg::TexGenChunkBase::executeSyncImpl(), osg::StencilChunkBase::executeSyncImpl(), osg::ShaderParameterChunkBase::executeSyncImpl(), osg::RegisterCombinersChunkBase::executeSyncImpl(), osg::ProgramChunkBase::executeSyncImpl(), osg::PolygonChunkBase::executeSyncImpl(), osg::PointChunkBase::executeSyncImpl(), osg::MaterialChunkBase::executeSyncImpl(), osg::LineChunkBase::executeSyncImpl(), osg::LightChunkBase::executeSyncImpl(), osg::DepthChunkBase::executeSyncImpl(), osg::ColorMaskChunkBase::executeSyncImpl(), osg::ClipPlaneChunkBase::executeSyncImpl(), and osg::BlendChunkBase::executeSyncImpl().

00184 {
00185 
00186     Inherited::executeSyncImpl(pOther, whichField);
00187 
00188 
00189 }

void Attachment::executeSyncImpl Attachment pOther,
const BitVector whichField
[protected, inherited]
 

Definition at line 306 of file OSGAttachment.cpp.

References osg::Attachment::_parents, osg::Attachment::_sfInternal, osg::FieldContainer::executeSyncImpl(), osg::Attachment::InternalFieldMask, osg::FieldBits::NoField, osg::Attachment::ParentsFieldMask, osg::MField< FieldTypeT, fieldNameSpace >::syncWith(), and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by osg::Attachment::executeSync(), osg::StateChunkBase::executeSyncImpl(), osg::DVRVolumeTextureBase::executeSyncImpl(), osg::DVRLookupTableBase::executeSyncImpl(), osg::DVRIsoSurfaceBase::executeSyncImpl(), osg::DVRClipObjectsBase::executeSyncImpl(), and osg::SimpleAttachment< AttachmentDescT >::executeSyncImpl().

00308 {
00309     Inherited::executeSyncImpl(pOther, whichField);
00310 
00311     if(FieldBits::NoField != (InternalFieldMask & whichField))
00312     {
00313         _sfInternal.syncWith(pOther->_sfInternal);
00314     }
00315 
00316     if(FieldBits::NoField != (ParentsFieldMask & whichField))
00317     {
00318         _parents.syncWith(pOther->_parents);
00319     }
00320 }

void osg::FieldContainer::executeSyncImpl FieldContainer pOther,
const BitVector whichField
[inline, protected, inherited]
 

Definition at line 333 of file OSGFieldContainerImpl.inl.

Referenced by osg::StateBase::executeSyncImpl(), osg::DVRShaderBase::executeSyncImpl(), osg::DVRClipGeometryBase::executeSyncImpl(), osg::AttachmentContainer::executeSyncImpl(), and osg::Attachment::executeSyncImpl().

00335 {
00336 }

void FatBorderChunkBase::executeSync FieldContainer other,
const BitVector whichField
[protected, virtual, inherited]
 

Reimplemented from osg::VertexProgramChunkBase.

Definition at line 113 of file OSGFatBorderChunkBase.cpp.

References osg::FatBorderChunkBase::executeSyncImpl().

00115 {
00116     this->executeSyncImpl((FatBorderChunkBase *) &other, whichField);
00117 }

const StateChunkClass * VertexProgramChunk::getClass void   )  const [virtual, inherited]
 

Reimplemented from osg::ProgramChunk.

Definition at line 138 of file OSGVertexProgramChunk.cpp.

References osg::VertexProgramChunk::_class.

00139 {
00140     return &_class;
00141 }

UInt32 osg::VertexProgramChunk::getStaticClassId void   )  [inline, static, inherited]
 

Reimplemented from osg::ProgramChunk.

Definition at line 46 of file OSGVertexProgramChunk.inl.

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

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

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

Reimplemented from osg::ProgramChunk.

Definition at line 52 of file OSGVertexProgramChunk.inl.

References osg::VertexProgramChunk::_class.

Referenced by osg::VertexProgramChunk::getStaticClassId().

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

void VertexProgramChunk::onCreate const VertexProgramChunk source = NULL  )  [protected, inherited]
 

Definition at line 111 of file OSGVertexProgramChunk.cpp.

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

Referenced by onCreate().

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

void ProgramChunk::onCreate const ProgramChunk source = NULL  )  [protected, inherited]
 

Definition at line 142 of file OSGProgramChunk.cpp.

00143 {
00144 }

void osg::FieldContainer::onCreate const FieldContainer source = NULL  )  [inline, protected, inherited]
 

Definition at line 318 of file OSGFieldContainerImpl.inl.

Referenced by osg::ShaderParameterChunk::onCreate().

00319 {
00320 }

UInt32 VertexProgramChunk::getExtension void   )  const [protected, virtual, inherited]
 

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 OSGVertexProgramChunk.cpp.

References osg::VertexProgramChunk::_arbVertexProgram.

00167 {
00168     return _arbVertexProgram;
00169 }

GLenum VertexProgramChunk::getTarget void   )  const [protected, virtual, inherited]
 

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 OSGVertexProgramChunk.cpp.

References GL_VERTEX_PROGRAM_ARB.

00172 {
00173     return GL_VERTEX_PROGRAM_ARB;
00174 }

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

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 OSGVertexProgramChunk.cpp.

00177 {
00178     return "Vertex Program";
00179 }

void ProgramChunk::handleGL Window win,
UInt32  idstatus,
GLenum  target,
UInt32  extension
[protected, inherited]
 

GL object handler create the program and destroy it

Definition at line 344 of file OSGProgramChunk.cpp.

References osg::ProgramChunk::_funcBindProgram, osg::ProgramChunk::_funcDeletePrograms, osg::ProgramChunk::_funcProgramLocalParameter4fv, osg::ProgramChunk::_funcProgramString, osg::Window::destroy, osg::endLog(), osg::Window::finaldestroy, osg::Window::getFunction(), osg::ProgramChunkBase::getParamValues(), osg::ProgramChunkBase::getProgram(), osg::PointInterface< ValueTypeT, StorageInterfaceT >::getValues(), GL_PROGRAM_FORMAT_ASCII_ARB, GLenum, glErr, GLsizei, GLuint(), osg::Window::hasExtension(), osg::Window::initialize, osg::Window::needrefresh, OSG_APIENTRY, osg::ProgramChunk::printCompileError(), osg::Window::reinitialize, osg::MField< FieldTypeT, fieldNameSpace >::size(), SWARNING, and osg::Window::unpackIdStatus().

Referenced by osg::VertexProgramChunk::handleGL(), and osg::FragmentProgramChunk::handleGL().

00345 {
00346     Window::GLObjectStatusE mode;
00347     UInt32 id;
00348     
00349     Window::unpackIdStatus(idstatus, id, mode);
00350     
00351     // get the program-specific specifics from the derived chunks
00352     // We can't call this member methods on Window::destroy because
00353     // the ProgramChunk instance is already destroyed.
00354     //GLenum target = getTarget();
00355     //UInt32 extension = getExtension();
00356     
00357     if(!win->hasExtension(extension))
00358         return;
00359 
00360     if(mode == Window::destroy)
00361     {
00362         // get "glDeleteProgramsARB" function pointer
00363         void (OSG_APIENTRY* deletePrograms)(GLsizei num, const GLuint *progs) =
00364             (void (OSG_APIENTRY*)(GLsizei num, const GLuint *progs))
00365             win->getFunction(_funcDeletePrograms);
00366 
00367         GLuint prog = id;
00368         deletePrograms(1, &prog);
00369     }
00370     else if(mode == Window::finaldestroy)
00371     {
00372         //SWARNING << "Last program user destroyed" << std::endl;
00373     }
00374     else if(mode == Window::initialize || mode == Window::reinitialize ||
00375             mode == Window::needrefresh)
00376     {
00377         // get "glBindProgramARB" function pointer
00378         void (OSG_APIENTRY* bindProgram)(GLenum target, GLuint prog) =
00379             (void (OSG_APIENTRY*)(GLenum target, GLuint prog))
00380             win->getFunction(_funcBindProgram);
00381              
00382         glErr("ProgramChunk::handleGL: bindProgram precheck");
00383         
00384         bindProgram(target, id);
00385              
00386         glErr("ProgramChunk::handleGL: bindProgram postcheck");
00387         
00388         if(mode != Window::needrefresh)
00389         {
00390             // get "glProgramStringARB" function pointer
00391             void (OSG_APIENTRY* programString)(GLenum target, GLenum format, 
00392                         GLsizei lesn, const void *string) =
00393                 (void (OSG_APIENTRY*)(GLenum target, GLenum format, 
00394                         GLsizei len, const void *string))
00395                 win->getFunction(_funcProgramString);
00396             
00397             glErr("ProgramChunk::handleGL: programString precheck");
00398             
00399             glEnable(target);
00400             
00401             glErr("ProgramChunk::handleGL: enable postcheck");
00402             
00403             programString(target, GL_PROGRAM_FORMAT_ASCII_ARB,
00404                             getProgram().size(), getProgram().c_str());
00405             
00406             GLenum err = glGetError();
00407             
00408             if(err == GL_INVALID_OPERATION)
00409             {
00410                 printCompileError(win, idstatus);
00411             }
00412             else if (err != GL_NO_ERROR)
00413             {
00414                 SWARNING << "ProgramChunk::programString postcheck failed:"
00415                          << gluErrorString(err) << endLog;
00416             }
00417             
00418             glDisable(target);
00419             
00420             glErr("ProgramChunk::handleGL: disable postcheck");
00421         }
00422         
00423         void (OSG_APIENTRY* programLocalParameter4fv)(GLenum target, 
00424                         GLuint index, const GLfloat *params) =
00425             (void (OSG_APIENTRY*)(GLenum target, 
00426                         GLuint index, const GLfloat *params))
00427             win->getFunction(_funcProgramLocalParameter4fv);
00428              
00429         glErr("ProgramChunk::handleGL: programLocalParameter precheck");
00430        
00431         for(UInt16 i = 0; i < getParamValues().size(); ++i)
00432         {
00433