diff --git a/src/RenderView.cpp b/src/RenderView.cpp index 699a6c9..ba34481 100644 --- a/src/RenderView.cpp +++ b/src/RenderView.cpp @@ -182,11 +182,8 @@ void RenderView::drawThumbnail() frame_thumbnail_ = new FrameBuffer( res_thumbnail ); // render - if (Settings::application.render.blit) { - if ( !frame_buffer_->blit(frame_thumbnail_) ) - throw std::runtime_error("no blit"); - } - else { + if ( !frame_buffer_->blit(frame_thumbnail_) ){ + // render anyway if blit failed FrameBufferSurface *thumb = new FrameBufferSurface(frame_buffer_); frame_thumbnail_->begin(); thumb->draw(glm::identity(), frame_thumbnail_->projection()); diff --git a/src/RenderingManager.cpp b/src/RenderingManager.cpp index 1a796be..8fc97c2 100644 --- a/src/RenderingManager.cpp +++ b/src/RenderingManager.cpp @@ -1096,69 +1096,11 @@ bool RenderingWindow::draw(FrameBuffer *fb) Rendering::manager().pushAttrib(window_attributes_); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - // blit framebuffer - if (Settings::application.render.blit) { - - if ( textureid_ != fb->texture()) { - - textureid_ = fb->texture(); - - // create a new fbo in this opengl context - if (fbo_ != 0) - glDeleteFramebuffers(1, &fbo_); - glGenFramebuffers(1, &fbo_); - glBindFramebuffer(GL_FRAMEBUFFER, fbo_); - - // attach the 2D texture to local FBO - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureid_, 0); -#ifndef NDEBUG - Log::Info("Blit to output window enabled."); -#endif - } - - // if not disabled - if (!Settings::application.render.disabled) { - - // calculate scaling factor of frame buffer inside window - int rx, ry, rw, rh; - float renderingAspectRatio = fb->aspectRatio(); - - if (Settings::application.windows[index_].scaled) { - rx = 0; - ry = 0; - rw = window_attributes_.viewport.x; - rh = window_attributes_.viewport.y; - } - else { - if (aspectRatio() < renderingAspectRatio) { - int nh = (int)( float(window_attributes_.viewport.x) / renderingAspectRatio); - rx = 0; - ry = (window_attributes_.viewport.y - nh) / 2; - rw = window_attributes_.viewport.x; - rh = (window_attributes_.viewport.y + nh) / 2; - } else { - int nw = (int)( float(window_attributes_.viewport.y) * renderingAspectRatio ); - rx = (window_attributes_.viewport.x - nw) / 2; - ry = 0; - rw = (window_attributes_.viewport.x + nw) / 2; - rh = window_attributes_.viewport.y; - } - } - - // select fbo texture read target - glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo_); - - // select screen target - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - - // blit operation from fbo (containing texture) to screen - glBlitFramebuffer(0, fb->height(), fb->width(), 0, rx, ry, rw, rh, GL_COLOR_BUFFER_BIT, GL_LINEAR); - - } - } + // make sure previous shader in another glcontext is disabled + ShadingProgram::enduse(); // draw geometry - else if (!Settings::application.render.disabled) + if (!Settings::application.render.disabled) { // VAO is not shared between multiple contexts of different windows // so we have to create a new VAO for rendering the surface in this window diff --git a/src/Settings.cpp b/src/Settings.cpp index 16781f9..3c245be 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -159,7 +159,6 @@ void Settings::Save(uint64_t runtime) XMLElement *RenderNode = xmlDoc.NewElement( "Render" ); RenderNode->SetAttribute("vsync", application.render.vsync); RenderNode->SetAttribute("multisampling", application.render.multisampling); - RenderNode->SetAttribute("blit", application.render.blit); RenderNode->SetAttribute("gpu_decoding", application.render.gpu_decoding); RenderNode->SetAttribute("ratio", application.render.ratio); RenderNode->SetAttribute("res", application.render.res); @@ -440,7 +439,6 @@ void Settings::Load() if (rendernode != nullptr) { rendernode->QueryIntAttribute("vsync", &application.render.vsync); rendernode->QueryIntAttribute("multisampling", &application.render.multisampling); - rendernode->QueryBoolAttribute("blit", &application.render.blit); rendernode->QueryBoolAttribute("gpu_decoding", &application.render.gpu_decoding); rendernode->QueryIntAttribute("ratio", &application.render.ratio); rendernode->QueryIntAttribute("res", &application.render.res); diff --git a/src/Settings.h b/src/Settings.h index 679aefe..887aabe 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -157,7 +157,6 @@ struct TransitionConfig struct RenderConfig { bool disabled; - bool blit; int vsync; int multisampling; int ratio; @@ -169,7 +168,6 @@ struct RenderConfig RenderConfig() { disabled = false; - blit = false; vsync = 1; multisampling = 2; ratio = 3; diff --git a/src/UserInterfaceManager.cpp b/src/UserInterfaceManager.cpp index c080d9b..9eccf21 100644 --- a/src/UserInterfaceManager.cpp +++ b/src/UserInterfaceManager.cpp @@ -8466,11 +8466,9 @@ void Navigator::RenderMainPannelSettings() static bool need_restart = false; static bool vsync = (Settings::application.render.vsync > 0); - static bool blit = Settings::application.render.blit; static bool multi = (Settings::application.render.multisampling > 0); static bool gpu = Settings::application.render.gpu_decoding; bool change = false; - change |= ImGuiToolkit::ButtonSwitch( "Blit framebuffer", &blit); #ifndef NDEBUG change |= ImGuiToolkit::ButtonSwitch( "Vertical synchronization", &vsync); change |= ImGuiToolkit::ButtonSwitch( "Antialiasing framebuffer", &multi); @@ -8486,7 +8484,6 @@ void Navigator::RenderMainPannelSettings() if (change) { need_restart = ( vsync != (Settings::application.render.vsync > 0) || - blit != Settings::application.render.blit || multi != (Settings::application.render.multisampling > 0) || gpu != Settings::application.render.gpu_decoding ); } @@ -8494,7 +8491,6 @@ void Navigator::RenderMainPannelSettings() ImGuiToolkit::Spacing(); if (ImGui::Button( ICON_FA_POWER_OFF " Restart to apply", ImVec2(ImGui::GetContentRegionAvail().x - 50, 0))) { Settings::application.render.vsync = vsync ? 1 : 0; - Settings::application.render.blit = blit; Settings::application.render.multisampling = multi ? 3 : 0; Settings::application.render.gpu_decoding = gpu; if (UserInterface::manager().TryClose())