/*! \fn SoXipGLSLUniformGroup::doAction(SoAction * action) * Adds a node to the SoXipGLSLUniformGroupElement in the current state * \param action - the current state action, no action taken if input action is NULL * \return void */ void SoXipGLSLUniformGroup::groupUpdate(SoAction * action) { SoChildList * children = this->getChildren(); GLint prg = SoXipGLSLShaderProgramElement::get(action->getState()); if (mNumPrograms > GLSL_MAX_NUM_SHADERS) { SoDebugError::postWarning(__FUNCTION__, "supports %i shaders (requested %d)", GLSL_MAX_NUM_SHADERS, mNumPrograms); mNumPrograms = GLSL_MAX_NUM_SHADERS; } for (int i = 0; i < mNumPrograms; i++) { /* To prevent uniforms from updating every frame we only update the uniform if the time stamp of the selected shader is out of date or if anything has changed among the uniforms such as names or values. TODO: This fix do not work since we have no way of knowing if other instances of this node also changes the same uniforms. Since this will not change the timestamp in the manager the uniform remains as last updated and fix don't work. No solution to the problem yet! Stefan Lindholm */ #if 0 int handle = SoXipGLSLShaderProgramElement::getProgramID(action->getState(), prgTags[i].getString()); if (glIsProgram(handle)) { SoXipGLSLShaderProgramElement::set(action->getState(), prgTags[i].getString()); children->traverse(action); } #else __uint64 currTime = SoXipGLSLShaderProgramElement::getTimeStamp(action->getState(), prgTags[i].getString()); if (currTime != mProgramTimeStamps[i] || mNeedsUpdate) { SoXipGLSLShaderProgramElement::set(action->getState(), prgTags[i].getString()); children->traverse(action); mProgramTimeStamps[i] = currTime; } #endif } SoXipGLSLShaderProgramElement::set(action->getState(), prg); mNeedsUpdate = false; }
/*! \fn SoXipGLSLUniformGroup::doAction(SoAction * action) * Adds a node to the SoXipGLSLUniformGroupElement in the current state * \param action - the current state action, no action taken if input action is NULL * \return void */ void SoXipGLSLUniformGroup::doAction(SoAction * action) { SoChildList * children = this->getChildren(); children->traverse(action); }