void Channel::frameViewFinish( const eq::uint128_t& frameID ) { if( stopRendering( )) return; applyBuffer(); const FrameData& frameData = _getFrameData(); Accum& accum = _accum[ lunchbox::getIndexOfLastBit( getEye()) ]; if( accum.buffer ) { const eq::PixelViewport& pvp = getPixelViewport(); const bool isResized = accum.buffer->resize( pvp ); if( isResized ) { const View* view = static_cast< const View* >( getView( )); accum.buffer->clear(); accum.step = view->getIdleSteps(); accum.stepsDone = 0; } else if( frameData.isIdle( )) { setupAssemblyState(); if( !_isDone() && accum.transfer ) accum.buffer->accum(); accum.buffer->display(); resetAssemblyState(); } } applyViewport(); _drawOverlay(); _drawHelp(); if( frameData.useStatistics()) drawStatistics(); int32_t steps = 0; if( frameData.isIdle( )) { for( size_t i = 0; i < eq::NUM_EYES; ++i ) steps = LB_MAX( steps, _accum[i].step ); } else { const View* view = static_cast< const View* >( getView( )); steps = view ? view->getIdleSteps() : 0; } // if _jitterStep == 0 and no user redraw event happened, the app will exit // FSAA idle mode and block on the next redraw event. eq::Config* config = getConfig(); config->sendEvent( IDLE_AA_LEFT ) << steps; eq::Channel::frameViewFinish( frameID ); }
void Channel::frameDraw( const eq::uint128_t& frameID ) { //----- setup GL state applyBuffer(); applyViewport(); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); applyFrustum(); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); applyHeadTransform(); setupAssemblyState(); _testFormats( 1.0f ); _testFormats( 0.5f ); _testFormats( 2.0f ); _testTiledOperations(); _testDepthAssemble(); resetAssemblyState(); }
void Channel::frameAssemble( const eq::uint128_t& frameID ) { if( stopRendering( )) return; if( _isDone( )) return; Accum& accum = _accum[ lunchbox::getIndexOfLastBit( getEye()) ]; if( getPixelViewport() != _currentPVP ) { accum.transfer = true; if( accum.buffer && !accum.buffer->usesFBO( )) { LBWARN << "Current viewport different from view viewport, " << "idle anti-aliasing not implemented." << std::endl; accum.step = 0; } eq::Channel::frameAssemble( frameID ); return; } // else accum.transfer = true; const eq::Frames& frames = getInputFrames(); for( eq::Frames::const_iterator i = frames.begin(); i != frames.end(); ++i ) { eq::Frame* frame = *i; const eq::SubPixel& curSubPixel = frame->getSubPixel(); if( curSubPixel != eq::SubPixel::ALL ) accum.transfer = false; accum.stepsDone = LB_MAX( accum.stepsDone, frame->getSubPixel().size*frame->getPeriod( )); } applyBuffer(); applyViewport(); setupAssemblyState(); try { eq::Compositor::assembleFrames( getInputFrames(), this, accum.buffer ); } catch( const co::Exception& e ) { LBWARN << e.what() << std::endl; } resetAssemblyState(); }
void Channel::frameAssemble( const eq::uint128_t& frameID, const eq::Frames& frames ) { if( stopRendering( )) return; if( _isDone( )) return; Accum& accum = _accum[ lunchbox::getIndexOfLastBit( getEye()) ]; if( getPixelViewport() != _currentPVP ) { accum.transfer = true; if( accum.buffer && !accum.buffer->usesFBO( )) { LBWARN << "Current viewport different from view viewport, " << "idle anti-aliasing not implemented." << std::endl; accum.step = 0; } eq::Channel::frameAssemble( frameID, frames ); return; } // else accum.transfer = true; for( eq::Frame* frame : frames ) { const eq::SubPixel& subPixel = frame->getFrameData()->getContext().subPixel; if( subPixel != eq::SubPixel::ALL ) accum.transfer = false; accum.stepsDone = LB_MAX( accum.stepsDone, subPixel.size * frame->getFrameData()->getContext().period ); } applyBuffer(); applyViewport(); setupAssemblyState(); try { eq::Compositor::assembleFrames( frames, this, accum.buffer.get( )); } catch( const co::Exception& e ) { LBWARN << e.what() << std::endl; } resetAssemblyState(); }
void Channel::_drawHelp() { const FrameData& frameData = _getFrameData(); std::string message = frameData.getMessage(); if( !frameData.showHelp() && message.empty( )) return; applyBuffer(); applyViewport(); setupAssemblyState(); glLogicOp( GL_XOR ); glEnable( GL_COLOR_LOGIC_OP ); glDisable( GL_LIGHTING ); glDisable( GL_DEPTH_TEST ); glColor3f( 1.f, 1.f, 1.f ); const eq::PixelViewport& pvp = getPixelViewport(); const eq::Viewport& vp = getViewport(); const float height = pvp.h / vp.h; if( !message.empty( )) { const eq::util::BitmapFont* font = getWindow()->getMediumFont(); const float width = pvp.w / vp.w; const float xOffset = vp.x * width; const float yOffset = vp.y * height; const float yPos = 0.618f * height; float y = yPos - yOffset; for( size_t pos = message.find( '\n' ); pos != std::string::npos; pos = message.find( '\n' )) { glRasterPos3f( 10.f - xOffset, y, 0.99f ); font->draw( message.substr( 0, pos )); message = message.substr( pos + 1 ); y -= 22.f; } // last line glRasterPos3f( 10.f - xOffset, y, 0.99f ); font->draw( message ); } glMatrixMode( GL_PROJECTION ); glLoadIdentity(); applyScreenFrustum(); glMatrixMode( GL_MODELVIEW ); if( frameData.showHelp( )) { const eq::util::BitmapFont* font = getWindow()->getSmallFont(); std::string help = EqPly::getHelp(); float y = height - 16.f; for( size_t pos = help.find( '\n' ); pos != std::string::npos; pos = help.find( '\n' )) { glRasterPos3f( 10.f, y, 0.99f ); font->draw( help.substr( 0, pos )); help = help.substr( pos + 1 ); y -= 16.f; } // last line glRasterPos3f( 10.f, y, 0.99f ); font->draw( help ); } resetAssemblyState(); }
void Channel::_drawHelp() { const FrameData& frameData = _getFrameData(); std::string message = frameData.getMessage(); if( !frameData.showHelp() && message.empty( )) return; applyBuffer(); applyViewport(); setupAssemblyState(); glDisable( GL_LIGHTING ); glDisable( GL_DEPTH_TEST ); glColor3f( 1.f, 1.f, 1.f ); if( frameData.showHelp( )) { const eq::Window::Font* font = getWindow()->getSmallFont(); std::string help = EVolve::getHelp(); float y = 340.f; for( size_t pos = help.find( '\n' ); pos != std::string::npos; pos = help.find( '\n' )) { glRasterPos3f( 10.f, y, 0.99f ); font->draw( help.substr( 0, pos )); help = help.substr( pos + 1 ); y -= 16.f; } // last line glRasterPos3f( 10.f, y, 0.99f ); font->draw( help ); } if( !message.empty( )) { const eq::Window::Font* font = getWindow()->getMediumFont(); const eq::Viewport& vp = getViewport(); const eq::PixelViewport& pvp = getPixelViewport(); const float width = pvp.w / vp.w; const float xOffset = vp.x * width; const float height = pvp.h / vp.h; const float yOffset = vp.y * height; const float yMiddle = 0.5f * height; float y = yMiddle - yOffset; for( size_t pos = message.find( '\n' ); pos != std::string::npos; pos = message.find( '\n' )) { glRasterPos3f( 10.f - xOffset, y, 0.99f ); font->draw( message.substr( 0, pos )); message = message.substr( pos + 1 ); y -= 22.f; } // last line glRasterPos3f( 10.f - xOffset, y, 0.99f ); font->draw( message ); } EQ_GL_CALL( resetAssemblyState( )); }
void Channel::_startAssemble() { applyBuffer(); applyViewport(); setupAssemblyState(); }