mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-15 20:29:58 +01:00
DRAFT feature for showing test pattern on output window
This commit is contained in:
Binary file not shown.
@@ -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<float, float, float> 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
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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<glm::mat4>(), scale), projection);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) { }
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user