void UIModel::render() const { if (!model) return; drawFBO(); drawTexture(); }
//-------------------------------------------------------------- void gamuzaMain::draw(){ if(splashFinish){ ofBackground(0,0,0); ////////////////////////////////////////////// // GUI draw if(!liveCodingMode && !autoPilot){ gui.draw(); drawGui(); } ////////////////////////////////////////////// ////////////////////////////////////////////// // FBO texture draw drawFBO(); ////////////////////////////////////////////// }else{ ofBackground(20,20,20); ofEnableAlphaBlending(); if(isFullscreen){ // image glColor4f(1.0,1.0,1.0,0.9); splashImage.draw((mainScreenW/2) - 256,(mainScreenH/2) - 153); // loading bar glColor4f(0.847,0.25,0.25,0.8); ofRect((mainScreenW/2) - 240,(mainScreenH/2) - 144,(ofGetElapsedTimeMillis()*1.0f/splashWait)*480.0f,6); ofDisableAlphaBlending(); }else{ // image glColor4f(1.0,1.0,1.0,0.9); splashImage.draw((MAIN_WINDOW_W/2) - 256,(MAIN_WINDOW_H/2) - 153); // loading bar glColor4f(0.847,0.25,0.25,0.8); ofRect((MAIN_WINDOW_W/2) - 240,(MAIN_WINDOW_H/2) - 144,(ofGetElapsedTimeMillis()*1.0f/splashWait)*480.0f,6); ofDisableAlphaBlending(); } } }
void display() { drawFBO(render_option); glutSwapBuffers(); }
//-------------------------------------------------------------- void gamuzaMain::draw(){ if(splashFinish){ ofBackground(0,0,0); ////////////////////////////////////////////// // GUI draw if(!liveCodingMode){ ofSetLineWidth(1.2); gui.draw(); drawGui(); ofSetLineWidth(1); } ////////////////////////////////////////////// ////////////////////////////////////////////// // FBO texture draw glColor4f(1.0,1.0,1.0,1.0); drawFBO(); ////////////////////////////////////////////// //////////////////////////////////// // TIMELINE if(showTimeline && !isFullscreen){ ofEnableAlphaBlending(); glColor4f(0.0,0.0,0.0,0.9); ofRect(0,0,MAIN_WINDOW_W-4,MAIN_WINDOW_H); ofDisableAlphaBlending(); }else if(showTimeline && isFullscreen){ ofEnableAlphaBlending(); glColor4f(0.0,0.0,0.0,0.9); ofRect(0,0,mainScreenW-1,mainScreenH); ofDisableAlphaBlending(); } timeline.draw(); //////////////////////////////////// }else{ ofBackground(20,20,20); ofEnableAlphaBlending(); if(isFullscreen){ // image glColor4f(1.0,1.0,1.0,1.0); splashImage.draw((mainScreenW/2) - 256,(mainScreenH/2) - 153); // loading bar ofSetColor(9,147,211,235); ofRect((mainScreenW/2) - 240,(mainScreenH/2) - 144,(ofGetElapsedTimeMillis()*1.0f/splashWait)*480.0f,6); ofDisableAlphaBlending(); }else{ // image glColor4f(1.0,1.0,1.0,1.0); splashImage.draw((MAIN_WINDOW_W/2) - 256,(MAIN_WINDOW_H/2) - 153); // loading bar ofSetColor(9,147,211,235); ofRect((MAIN_WINDOW_W/2) - 240,(MAIN_WINDOW_H/2) - 144,(ofGetElapsedTimeMillis()*1.0f/splashWait)*480.0f,6); ofDisableAlphaBlending(); } } }
virtual void operator()( osg::RenderInfo& renderInfo ) const { osg::State& state = *renderInfo.getState(); const unsigned int ctx = state.getContextID(); osg::FBOExtensions* fboExt = osg::FBOExtensions::instance( ctx, true ); PerContextInfo& ctxInfo( _contextInfo[ ctx ] ); if( ctxInfo.__glGetFramebufferAttachmentParameteriv == NULL ) { // Initialize function pointer for FBO query. osg::setGLExtensionFuncPtr( ctxInfo.__glGetFramebufferAttachmentParameteriv, "glGetFramebufferAttachmentParameteriv" ); if( ctxInfo.__glGetFramebufferAttachmentParameteriv == NULL ) osg::setGLExtensionFuncPtr( ctxInfo.__glGetFramebufferAttachmentParameteriv, "glGetFramebufferAttachmentParameterivEXT" ); if( ctxInfo.__glGetFramebufferAttachmentParameteriv == NULL ) { osg::notify( osg::ALWAYS ) << "Can't get function pointer glGetFramebufferAttachmentParameteriv" << std::endl; return; } } const GLint width = _cam->getViewport()->width(); const GLint height = _cam->getViewport()->height(); #if 0 // Make sure something is actually bound. GLint drawFBO( -1 ); glGetIntegerv( GL_DRAW_FRAMEBUFFER_BINDING, &drawFBO ); #endif // BlitFramebuffer blits to all attached color buffers in the // draw FBO. We only want to blit to attachment1, so aave // attachment0 and then unbind it. GLint destColorTex0( -1 ); ctxInfo.__glGetFramebufferAttachmentParameteriv( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &destColorTex0 ); osgwTools::glFramebufferTexture2D( fboExt, GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0 ); // Verification //osg::notify( osg::ALWAYS ) << "Dest " << std::hex << destColorTex0 << std::endl; // Set draw and read buffers to attachment1 to read from correct // buffer and avoid INVALID_FRAMEBUFFER_OPERATION error. glDrawBuffer( GL_COLOR_ATTACHMENT1 ); glReadBuffer( GL_COLOR_ATTACHMENT1 ); // Blit, from (multisampled read FBO) attachment1 to // (non-multisampled draw FBO) attachment1. osgwTools::glBlitFramebuffer( fboExt, 0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_NEAREST ); // Restore draw and read buffers glDrawBuffer( GL_COLOR_ATTACHMENT0 ); glReadBuffer( GL_COLOR_ATTACHMENT0 ); // Restore the draw FBO's attachment0. osgwTools::glFramebufferTexture2D( fboExt, GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, destColorTex0, 0 ); // We disabled FBO unbinding in the RenderStage, // so do it ourself here. /* TBD update to use FBOUtils.h */ osgwTools::glBindFramebuffer( fboExt, GL_FRAMEBUFFER, 0 ); }