当前位置: 首页>>代码示例>>C++>>正文


C++ State::getUniformLocation方法代码示例

本文整理汇总了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 );
}
开发者ID:yaroslav-tarasov,项目名称:backdropfx,代码行数:33,代码来源:DepthPeelBin.cpp

示例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 );
    }
}
开发者ID:yaroslav-tarasov,项目名称:backdropfx,代码行数:15,代码来源:RenderingEffects.cpp


注:本文中的osg::State::getUniformLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。