本文整理汇总了C++中osg::State::applyMode方法的典型用法代码示例。如果您正苦于以下问题:C++ State::applyMode方法的具体用法?C++ State::applyMode怎么用?C++ State::applyMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::State
的用法示例。
在下文中一共展示了State::applyMode方法的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: exclusive
//.........这里部分代码省略.........
for(first = _layers.size()-1; first > 0; --first)
{
const Layer& layer = _layers[first];
if (layer._opaque &&
//Color filters can modify the opacity
layer._imageLayer->getColorFilters().empty() &&
layer._imageLayer->getVisible() &&
layer._imageLayer->getOpacity() >= 1.0f)
{
break;
}
}
// interate over all the image layers
for(unsigned i=first; i<_layers.size(); ++i)
{
const Layer& layer = _layers[i];
if ( layer._imageLayer->getVisible() && layer._imageLayer->getOpacity() > 0.0f )
{
// activate the visible unit if necessary:
if ( activeImageUnit != _imageUnit )
{
state.setActiveTextureUnit( _imageUnit );
activeImageUnit = _imageUnit;
}
// bind the texture for this layer:
layer._tex->apply( state );
// in FFP mode, we need to enable the GL mode for texturing:
if ( !pcp ) //!_supportsGLSL)
{
state.applyMode(GL_TEXTURE_2D, true);
}
// if we're using a parent texture for blending, activate that now
if ( texMatParentLocation >= 0 && layer._texParent.valid() )
{
state.setActiveTextureUnit( _imageUnitParent );
activeImageUnit = _imageUnitParent;
layer._texParent->apply( state );
usedTexParent = true;
}
// bind the texture coordinates for this layer.
// TODO: can probably optimize this by sharing or using texture matrixes.
// State::setTexCoordPointer does some redundant work under the hood.
state.setTexCoordPointer( _imageUnit, layer._texCoords.get() );
// apply uniform values:
if ( pcp )
{
// apply opacity:
if ( opacityLocation >= 0 )
{
float opacity = layer._imageLayer->getOpacity();
if ( opacity != prev_opacity )
{
ext->glUniform1f( opacityLocation, (GLfloat)opacity );
prev_opacity = opacity;
}
}
// assign the layer UID:
if ( uidLocation >= 0 )