mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-14 11:49:59 +01:00
Fixed output monitor disablling
This commit is contained in:
@@ -816,28 +816,28 @@ 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
|
// blit framebuffer
|
||||||
if (!Settings::application.render.disabled) {
|
if (Settings::application.render.blit) {
|
||||||
|
|
||||||
// blit framebuffer
|
if ( textureid_ != fb->texture()) {
|
||||||
if (Settings::application.render.blit) {
|
|
||||||
|
|
||||||
if ( textureid_ != fb->texture()) {
|
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_);
|
||||||
|
|
||||||
// create a new fbo in this opengl context
|
// attach the 2D texture to local FBO
|
||||||
if (fbo_ != 0)
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureid_, 0);
|
||||||
glDeleteFramebuffers(1, &fbo_);
|
#ifndef NDEBUG
|
||||||
glGenFramebuffers(1, &fbo_);
|
Log::Info("Blit to output window enabled.");
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo_);
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// attach the 2D texture to local FBO
|
// if not disabled
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureid_, 0);
|
if (!Settings::application.render.disabled) {
|
||||||
#ifndef NDEBUG
|
|
||||||
Log::Info("Blit to output window enabled.");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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;
|
||||||
@@ -866,43 +866,44 @@ 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
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 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
|
|
||||||
if (surface_ == 0)
|
|
||||||
surface_ = new WindowSurface;
|
|
||||||
|
|
||||||
// calculate scaling factor of frame buffer inside window
|
|
||||||
float windowAspectRatio = aspectRatio();
|
|
||||||
float renderingAspectRatio = fb->aspectRatio();
|
|
||||||
glm::vec3 scale;
|
|
||||||
if (windowAspectRatio < renderingAspectRatio)
|
|
||||||
scale = glm::vec3(1.f, windowAspectRatio / renderingAspectRatio, 1.f);
|
|
||||||
else
|
|
||||||
scale = glm::vec3(renderingAspectRatio / windowAspectRatio, 1.f, 1.f);
|
|
||||||
|
|
||||||
// make sure previous shader in another glcontext is disabled
|
|
||||||
ShadingProgram::enduse();
|
|
||||||
|
|
||||||
// draw
|
|
||||||
glBindTexture(GL_TEXTURE_2D, fb->texture());
|
|
||||||
// surface->shader()->color.a = 0.4f; // TODO alpha blending ?
|
|
||||||
static glm::mat4 projection = glm::ortho(-1.f, 1.f, -1.f, 1.f, -1.f, 1.f);
|
|
||||||
surface_->draw(glm::scale(glm::identity<glm::mat4>(), scale), projection);
|
|
||||||
|
|
||||||
// done drawing (unload shader from this glcontext)
|
|
||||||
ShadingProgram::enduse();
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// restore attribs
|
|
||||||
Rendering::manager().popAttrib();
|
// draw geometry
|
||||||
|
else 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
|
||||||
|
if (surface_ == 0)
|
||||||
|
surface_ = new WindowSurface;
|
||||||
|
|
||||||
|
// calculate scaling factor of frame buffer inside window
|
||||||
|
float windowAspectRatio = aspectRatio();
|
||||||
|
float renderingAspectRatio = fb->aspectRatio();
|
||||||
|
glm::vec3 scale;
|
||||||
|
if (windowAspectRatio < renderingAspectRatio)
|
||||||
|
scale = glm::vec3(1.f, windowAspectRatio / renderingAspectRatio, 1.f);
|
||||||
|
else
|
||||||
|
scale = glm::vec3(renderingAspectRatio / windowAspectRatio, 1.f, 1.f);
|
||||||
|
|
||||||
|
// make sure previous shader in another glcontext is disabled
|
||||||
|
ShadingProgram::enduse();
|
||||||
|
|
||||||
|
// draw
|
||||||
|
glBindTexture(GL_TEXTURE_2D, fb->texture());
|
||||||
|
// surface->shader()->color.a = 0.4f; // TODO alpha blending ?
|
||||||
|
static glm::mat4 projection = glm::ortho(-1.f, 1.f, -1.f, 1.f, -1.f, 1.f);
|
||||||
|
surface_->draw(glm::scale(glm::identity<glm::mat4>(), scale), projection);
|
||||||
|
|
||||||
|
// done drawing (unload shader from this glcontext)
|
||||||
|
ShadingProgram::enduse();
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// restore attribs
|
||||||
|
Rendering::manager().popAttrib();
|
||||||
|
|
||||||
// give back context ownership
|
// give back context ownership
|
||||||
glfwMakeContextCurrent(master_);
|
glfwMakeContextCurrent(master_);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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) ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user