Fixed output monitor disablling

This commit is contained in:
Bruno Herbelin
2021-09-19 11:07:13 +02:00
parent 5b1504c8f6
commit f4c52b7ed3
2 changed files with 58 additions and 59 deletions

View File

@@ -816,9 +816,6 @@ void RenderingWindow::draw(FrameBuffer *fb)
Rendering::manager().pushAttrib(window_attributes_); Rendering::manager().pushAttrib(window_attributes_);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// if not disabled
if (!Settings::application.render.disabled) {
// blit framebuffer // blit framebuffer
if (Settings::application.render.blit) { if (Settings::application.render.blit) {
@@ -834,11 +831,14 @@ void RenderingWindow::draw(FrameBuffer *fb)
// attach the 2D texture to local FBO // attach the 2D texture to local FBO
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureid_, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureid_, 0);
#ifndef NDEBUG #ifndef NDEBUG
Log::Info("Blit to output window enabled."); Log::Info("Blit to output window enabled.");
#endif #endif
} }
// if not disabled
if (!Settings::application.render.disabled) {
// calculate scaling factor of frame buffer inside window // calculate scaling factor of frame buffer inside window
int rx, ry, rw, rh; int rx, ry, rw, rh;
float renderingAspectRatio = fb->aspectRatio(); float renderingAspectRatio = fb->aspectRatio();
@@ -866,8 +866,10 @@ void RenderingWindow::draw(FrameBuffer *fb)
glBlitFramebuffer(0, fb->height(), fb->width(), 0, rx, ry, rw, rh, GL_COLOR_BUFFER_BIT, GL_LINEAR); glBlitFramebuffer(0, fb->height(), fb->width(), 0, rx, ry, rw, rh, GL_COLOR_BUFFER_BIT, GL_LINEAR);
} }
}
// draw geometry // draw geometry
else else if (!Settings::application.render.disabled)
{ {
// VAO is not shared between multiple contexts of different windows // 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 // so we have to create a new VAO for rendering the surface in this window
@@ -898,11 +900,10 @@ void RenderingWindow::draw(FrameBuffer *fb)
} }
} }
// restore attribs // restore attribs
Rendering::manager().popAttrib(); Rendering::manager().popAttrib();
}
// give back context ownership // give back context ownership
glfwMakeContextCurrent(master_); glfwMakeContextCurrent(master_);
} }

View File

@@ -1061,23 +1061,20 @@ void UserInterface::RenderPreview()
Settings::application.widget.preview = false; Settings::application.widget.preview = false;
if (ImGui::BeginMenu(IMGUI_TITLE_PREVIEW)) if (ImGui::BeginMenu(IMGUI_TITLE_PREVIEW))
{ {
if ( ImGui::MenuItem( ICON_FA_PLUS " Insert Rendering Source") ) // Output window menu
Mixer::manager().addSource( Mixer::manager().createSourceRender() ); if ( ImGui::MenuItem( ICON_FA_WINDOW_RESTORE " Show window") )
if ( ImGui::MenuItem( ICON_FA_WINDOW_RESTORE " Show output window") )
Rendering::manager().outputWindow().show(); Rendering::manager().outputWindow().show();
bool isfullscreen = Rendering::manager().outputWindow().isFullscreen(); bool isfullscreen = Rendering::manager().outputWindow().isFullscreen();
if ( ImGui::MenuItem( ICON_FA_EXPAND_ALT " Fullscreen output window", nullptr, &isfullscreen) ) { if ( ImGui::MenuItem( ICON_FA_EXPAND_ALT " Fullscreen window", nullptr, &isfullscreen) ) {
Rendering::manager().outputWindow().show(); Rendering::manager().outputWindow().show();
Rendering::manager().outputWindow().toggleFullscreen(); Rendering::manager().outputWindow().toggleFullscreen();
} }
ImGui::MenuItem( ICON_FA_EYE_SLASH " Disable output", NULL, &Settings::application.render.disabled); ImGui::MenuItem( ICON_FA_EYE_SLASH " Disable", NULL, &Settings::application.render.disabled);
// output manager menu
ImGui::Separator(); ImGui::Separator();
bool pinned = Settings::application.widget.preview_view == Settings::application.current_view; bool pinned = Settings::application.widget.preview_view == Settings::application.current_view;
if ( ImGui::MenuItem( ICON_FA_MAP_PIN " Pin window to view", nullptr, &pinned) ){ if ( ImGui::MenuItem( ICON_FA_MAP_PIN " Pin window to view", nullptr, &pinned) ){
if (pinned) if (pinned)
@@ -1163,8 +1160,9 @@ void UserInterface::RenderPreview()
// //
ImGui::EndMenu(); ImGui::EndMenu();
} }
if (ImGui::BeginMenu("Share stream")) if (ImGui::BeginMenu("Share"))
{ {
#if defined(LINUX_NOT_YET_WORKING) #if defined(LINUX_NOT_YET_WORKING)
bool on = webcam_emulator_ != nullptr; bool on = webcam_emulator_ != nullptr;
if ( ImGui::MenuItem( ICON_FA_CAMERA " Emulate video camera", NULL, &on) ) { if ( ImGui::MenuItem( ICON_FA_CAMERA " Emulate video camera", NULL, &on) ) {