本文整理汇总了C++中osg::RenderInfo::pushCamera方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderInfo::pushCamera方法的具体用法?C++ RenderInfo::pushCamera怎么用?C++ RenderInfo::pushCamera使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::RenderInfo
的用法示例。
在下文中一共展示了RenderInfo::pushCamera方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fboExt
void
SkyDomeStage::draw( osg::RenderInfo& renderInfo, osgUtil::RenderLeaf*& previous )
{
if( _stageDrawnThisFrame )
return;
_stageDrawnThisFrame = true;
osg::notify( osg::DEBUG_INFO ) << "backdropFX: SkyDomeStage::draw" << std::endl;
// Fix for redmine 434. Camera must be set in renderInfo.
// Required for any draw-time code that queries the camera
// from renderInfo, such as OcclusionQueryNode.
// The parent camera/RenderStage doesn't do this because we
// are pre-render stages; it hasn't had a chance yet.
if( _camera )
renderInfo.pushCamera( _camera );
osg::State& state( *renderInfo.getState() );
const unsigned int contextID( state.getContextID() );
osg::FBOExtensions* fboExt( osg::FBOExtensions::instance( contextID, true ) );
if( fboExt == NULL )
{
osg::notify( osg::WARN ) << "backdropFX: SDS: FBOExtensions == NULL." << std::endl;
return;
}
// Bind the FBO.
osg::FrameBufferObject* fbo( _backdropCommon->getFBO() );
if( fbo != NULL )
{
fbo->apply( state );
}
else
{
osgwTools::glBindFramebuffer( fboExt, GL_DRAW_FRAMEBUFFER_EXT, 0 );
osgwTools::glBindFramebuffer( fboExt, GL_READ_FRAMEBUFFER_EXT, 0 );
}
state.applyAttribute( getViewport() );
// Draw
{
UTIL_GL_ERROR_CHECK( "SDS pre performClear()" );
_backdropCommon->performClear( renderInfo );
if( _enable )
{
UTIL_GL_ERROR_CHECK( "SDS pre drawImplementation()" );
RenderBin::drawImplementation( renderInfo, previous );
}
// I believe this has the net result of restoring OpenGL to the
// current state at the corresponding SkyDome node.
//state.apply();
}
const bool dumpImages = (
( _backdropCommon->getDebugMode() & backdropFX::BackdropCommon::debugImages ) != 0 );
if( dumpImages )
{
osg::Viewport* vp = getViewport();
GLint x( 0 ), y( 0 );
GLsizei w, h;
if( vp != NULL )
{
w = vp->width();
h = vp->height();
}
else
{
osg::notify( osg::WARN ) << "BDFX: SkyDome: Null viewport dumping images. Using 512x512." << std::endl;
w = h = 512;
}
const std::string fileName( createFileName( contextID ) );
char* pixels = new char[ w * h * 4 ];
glReadPixels( x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)pixels );
backdropFX::debugDumpImage( fileName, pixels, w, h );
delete[] pixels;
}
if( state.getCheckForGLErrors() != osg::State::NEVER_CHECK_GL_ERRORS )
{
std::string msg( "at SDS draw end" );
UTIL_GL_ERROR_CHECK( msg );
UTIL_GL_FBO_ERROR_CHECK( msg, fboExt );
}
// Fix for redmine 434. See SkyDomeStage::draw() for more info.
if( _camera )
renderInfo.popCamera();
}