From 7282760f690c711b8280662907423076b57e8522 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Mon, 27 Apr 2020 19:56:30 +0200 Subject: [PATCH] cleanup image processing shader --- ImGuiVisitor.cpp | 8 ++++++-- ImageProcessingShader.cpp | 2 -- ImageProcessingShader.h | 2 +- main.cpp | 2 +- rsc/shaders/imageprocessing.fs | 3 +-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ImGuiVisitor.cpp b/ImGuiVisitor.cpp index 07f7ddc..1220518 100644 --- a/ImGuiVisitor.cpp +++ b/ImGuiVisitor.cpp @@ -149,9 +149,13 @@ void ImGuiVisitor::visit(ImageShader &n) ImGui::SameLine(0, 10); ImGui::SetNextItemWidth(RIGHT_ALIGN); // combo list of masks - if ( ImGui::Combo("Mask", &item_current, ImageShader::mask_names, ImageShader::mask_presets.size()) ) + if ( ImGui::Combo("Mask", &item_current, ImageShader::mask_names, ImageShader::mask_presets.size()+1 ) ) { - n.mask = ImageShader::mask_presets[item_current]; + if (item_current < ImageShader::mask_presets.size()) + n.mask = ImageShader::mask_presets[item_current]; + else { + // TODO ask for custom mask + } } ImGui::PopID(); diff --git a/ImageProcessingShader.cpp b/ImageProcessingShader.cpp index c800925..ffeb645 100644 --- a/ImageProcessingShader.cpp +++ b/ImageProcessingShader.cpp @@ -16,7 +16,6 @@ void ImageProcessingShader::use() Shader::use(); // program_->setUniform("iChannelResolution[0]", iChannelResolution[0].x, iChannelResolution[0].y, iChannelResolution[0].z); -// program_->setUniform("iChannelResolution[1]", iChannelResolution[1].x, iChannelResolution[1].y, iChannelResolution[1].z); program_->setUniform("brightness", brightness); program_->setUniform("contrast", contrast); @@ -43,7 +42,6 @@ void ImageProcessingShader::reset() // // no texture resolution yet // iChannelResolution[0] = glm::vec3(1.f); -// iChannelResolution[1] = glm::vec3(1.f); // default values for image processing brightness = 0.f; diff --git a/ImageProcessingShader.h b/ImageProcessingShader.h index 6fbb316..b4f2750 100644 --- a/ImageProcessingShader.h +++ b/ImageProcessingShader.h @@ -17,7 +17,7 @@ public: void accept(Visitor& v) override; // // textures resolution -// glm::vec3 iChannelResolution[2]; +// glm::vec3 iChannelResolution[1]; // color effects float brightness; // [-1 1] diff --git a/main.cpp b/main.cpp index 9ced7d3..a49bdc0 100644 --- a/main.cpp +++ b/main.cpp @@ -120,7 +120,7 @@ int main(int, char**) /// GStreamer /// #ifndef NDEBUG - gst_debug_set_default_threshold (GST_LEVEL_WARNING); + gst_debug_set_default_threshold (GST_LEVEL_ERROR); gst_debug_set_active(TRUE); #endif diff --git a/rsc/shaders/imageprocessing.fs b/rsc/shaders/imageprocessing.fs index a80b549..9417182 100644 --- a/rsc/shaders/imageprocessing.fs +++ b/rsc/shaders/imageprocessing.fs @@ -30,8 +30,7 @@ uniform vec4 color; // image processing specific uniform sampler2D iChannel0; // input channel (texture id). -uniform sampler2D iChannel1; -//uniform vec3 iChannelResolution[2]; // input channel resolution (in pixels) +//uniform vec3 iChannelResolution[1]; // replaced by textureSize(iChannel0, 0); uniform vec3 iResolution; // viewport resolution (in pixels) uniform float contrast;