diff --git a/rsc/images/icons.dds b/rsc/images/icons.dds index 850dd05..6654a7b 100644 Binary files a/rsc/images/icons.dds and b/rsc/images/icons.dds differ diff --git a/src/DisplaysView.cpp b/src/DisplaysView.cpp index bd4a36a..acf4ce8 100644 --- a/src/DisplaysView.cpp +++ b/src/DisplaysView.cpp @@ -140,7 +140,7 @@ void DisplaysView::update(float dt) if (render) { output_ar = render->aspectRatio(); for (int i = 0; i < MAX_OUTPUT_WINDOW; ++i) - windows_[i].render_->setTextureIndex( render->texture() ); + windows_[i].render_->setTextureIndex( Rendering::manager().outputWindow(i).texture() ); } else output_ar = 1.f; @@ -395,6 +395,52 @@ void DisplaysView::draw() else ImGuiToolkit::Icon(19, 4, false); + // Modify current window + if (current_window_ > -1) { + + // Pattern output + ImGui::SameLine(0, 50); + if ( ImGuiToolkit::ButtonIconToggle(10,1,11,1, &Settings::application.windows[1+current_window_].show_pattern, "Test pattern") ) + View::need_deep_update_ += 2; // two frames update to get pattern initialized + +// // White ballance +// static DialogToolkit::ColorPickerDialog whitedialog; +// ImGui::SameLine(0, 30); +// ImGuiToolkit::Icon(5, 4); +// static ImVec4 white = ImVec4(1.f, 1.f, 1.f, 1.f); +// ImGui::SameLine(); +// ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT); +// if (ImGui::ColorButton("White", white, ImGuiColorEditFlags_NoAlpha)) { +// whitedialog.setRGB( std::make_tuple(white.x, white.y, white.z) ); +// whitedialog.open(); +// } +// ImGui::PopFont(); +// // get picked color if dialog finished +// if (whitedialog.closed()){ +// std::tuple c = whitedialog.RGB(); +// white.x = std::get<0>(c); +// white.y = std::get<1>(c); +// white.z = std::get<2>(c); +// } + +// ImGui::SameLine(); +// ImGuiToolkit::Icon(3,4); +// static ImVec4 grey = ImVec4(0.5f, 0.5f, 0.5f, 1.f); +// ImGui::SameLine(); +// ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT); +// ImGui::ColorButton("Grey", grey, ImGuiColorEditFlags_NoAlpha); +// ImGui::PopFont(); + +// ImGui::SameLine(); +// ImGuiToolkit::Icon(4,4); +// static ImVec4 black = ImVec4(0.f, 0.f, 0.f, 1.f); +// ImGui::SameLine(); +// ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT); +// ImGui::ColorButton("Black", black, ImGuiColorEditFlags_NoAlpha); +// ImGui::PopFont(); + + + } ImGui::PopStyleColor(14); // 14 colors diff --git a/src/Mixer.cpp b/src/Mixer.cpp index b5155bb..9c92998 100644 --- a/src/Mixer.cpp +++ b/src/Mixer.cpp @@ -1526,7 +1526,7 @@ void Mixer::setResolution(glm::vec3 res) { if (session_) { session_->setResolution(res); - ++View::need_deep_update_; + View::need_deep_update_+=2; std::ostringstream info; info << "Session resolution changed to " << res.x << "x" << res.y; Log::Info("%s", info.str().c_str()); diff --git a/src/RenderingManager.cpp b/src/RenderingManager.cpp index 8fc97c2..53a4eff 100644 --- a/src/RenderingManager.cpp +++ b/src/RenderingManager.cpp @@ -60,6 +60,7 @@ // vimix #include "defines.h" #include "Log.h" +#include "Stream.h" #include "Resource.h" #include "Settings.h" #include "ImageShader.h" @@ -693,6 +694,7 @@ WindowSurface::WindowSurface(Shader *s) : Primitive(s) RenderingWindow::RenderingWindow() : window_(NULL), master_(NULL), index_(-1), dpi_scale_(1.f), textureid_(0), fbo_(0), surface_(nullptr), request_change_fullscreen_(false) { + pattern_ = new Stream; } RenderingWindow::~RenderingWindow() @@ -1014,6 +1016,12 @@ bool RenderingWindow::init(int index, GLFWwindow *share) window_attributes_.clear_color = glm::vec4(COLOR_BGROUND, 1.f); } + // + // Stream pattern + // + pattern_->open("videotestsrc pattern=smpte", 1280, 720); + pattern_->play(true); + return true; } @@ -1108,10 +1116,11 @@ bool RenderingWindow::draw(FrameBuffer *fb) surface_ = new WindowSurface; // calculate scaling factor of frame buffer inside window - float windowAspectRatio = aspectRatio(); - float renderingAspectRatio = fb->aspectRatio(); + const float windowAspectRatio = aspectRatio(); + const float renderingAspectRatio = fb->aspectRatio(); glm::vec3 scale = glm::vec3(1.f, 1.f, 1.f); + // Display option: scaled or corrected aspect ratio if (!Settings::application.windows[index_].scaled) { if (windowAspectRatio < renderingAspectRatio) scale = glm::vec3(1.f, windowAspectRatio / renderingAspectRatio, 1.f); @@ -1119,12 +1128,17 @@ bool RenderingWindow::draw(FrameBuffer *fb) scale = glm::vec3(renderingAspectRatio / windowAspectRatio, 1.f, 1.f); } - // make sure previous shader in another glcontext is disabled - ShadingProgram::enduse(); + // Display option: draw calibration pattern + if ( Settings::application.windows[index_].show_pattern) { + pattern_->update(); + textureid_ = pattern_->texture(); + } + else + // draw normal texture + textureid_ = fb->texture(); - // draw - glBindTexture(GL_TEXTURE_2D, fb->texture()); - // surface->shader()->color.a = 0.4f; // TODO alpha blending ? + // actual render of the textured surface + glBindTexture(GL_TEXTURE_2D, textureid_); static glm::mat4 projection = glm::ortho(-1.f, 1.f, -1.f, 1.f, -1.f, 1.f); surface_->draw(glm::scale(glm::identity(), scale), projection); diff --git a/src/RenderingManager.h b/src/RenderingManager.h index 62a2f83..f39acdc 100644 --- a/src/RenderingManager.h +++ b/src/RenderingManager.h @@ -16,6 +16,7 @@ typedef struct GLFWmonitor GLFWmonitor; typedef struct GLFWwindow GLFWwindow; class FrameBuffer; +class Stream; struct RenderingAttrib { @@ -37,6 +38,7 @@ class RenderingWindow // objects to render uint textureid_; uint fbo_; + Stream *pattern_; class WindowSurface *surface_; protected: @@ -65,6 +67,7 @@ public: // draw a framebuffer bool draw(FrameBuffer *fb); + inline uint texture() const {return textureid_; } void swap(); // fullscreen diff --git a/src/Settings.h b/src/Settings.h index 887aabe..0342d8c 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -63,9 +63,10 @@ struct WindowConfig bool scaled; bool decorated; std::string monitor; + bool show_pattern; WindowConfig() : name(APP_TITLE), x(15), y(15), w(1280), h(720), - fullscreen(false), scaled(false), decorated(true), monitor("") { } + fullscreen(false), scaled(false), decorated(true), monitor(""), show_pattern(false) { } };