本文整理汇总了C++中osg::State::getUniformLocation方法的典型用法代码示例。如果您正苦于以下问题:C++ State::getUniformLocation方法的具体用法?C++ State::getUniformLocation怎么用?C++ State::getUniformLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::State
的用法示例。
在下文中一共展示了State::getUniformLocation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawFSTP
void DepthPeelBin::drawFSTP( osg::RenderInfo& renderInfo, osg::State& state, osg::GL2Extensions* ext, PerContextInfo& pci,
GLint& fstpLoc, GLint& texturePercentLoc )
{
TRACEDUMP("DepthPeelBin::drawFSTP");
// Set up the program and uniforms.
state.applyAttribute( _fstpProgram.get() );
if( fstpLoc < 0 )
#if OSG_SUPPORTS_UNIFORM_ID
fstpLoc = state.getUniformLocation( _fstpUniform->getNameID() );
#else
fstpLoc = state.getUniformLocation( _fstpUniform->getName() );
#endif
_fstpUniform->apply( ext, fstpLoc );
if( texturePercentLoc < 0 )
#if OSG_SUPPORTS_UNIFORM_ID
texturePercentLoc = state.getUniformLocation( _texturePercentUniform->getNameID() );
#else
texturePercentLoc = state.getUniformLocation( _texturePercentUniform->getName() );
#endif
_texturePercentUniform->apply( ext, texturePercentLoc );
state.setActiveTextureUnit( s_textureUnit+1 );
glBindTexture( GL_TEXTURE_2D, pci._colorTex );
state.applyAttribute( _fstpBlendFunc.get() );
state.applyMode( GL_BLEND, true );
state.applyMode( GL_DEPTH_TEST, false );
_fstp->draw( renderInfo );
state.setActiveTextureUnit( s_textureUnit+1 );
glBindTexture( GL_TEXTURE_2D, 0 );
}
示例2: applyAllGlobalUniforms
void RenderingEffects::applyAllGlobalUniforms( osg::State& state, osg::GL2Extensions* gl2Ext )
{
UniformVector::iterator it;
for( it = _globalUniformVector.begin(); it != _globalUniformVector.end(); it++ )
{
osg::Uniform* uniform = (*it).get();
#if OSG_SUPPORTS_UNIFORM_ID
GLint location = state.getUniformLocation( uniform->getNameID() );
#else
GLint location = state.getUniformLocation( uniform->getName() );
#endif
if( location >= 0 )
uniform->apply( gl2Ext, location );
}
}