diff --git a/app/node/input/media/media.cpp b/app/node/input/media/media.cpp index a01fbfef0..9363e7d5c 100644 --- a/app/node/input/media/media.cpp +++ b/app/node/input/media/media.cpp @@ -206,15 +206,13 @@ QVariant MediaInput::Value(NodeOutput *output, const rational &time) // Use an OCIO pipeline shader (which wraps in a default pipeline and will also handle alpha association) if (pipeline_ == nullptr) { - /*pipeline_ = olive::ShaderGenerator::OCIOPipeline(renderer->context(), + pipeline_ = olive::ShaderGenerator::OCIOPipeline(renderer->context(), ocio_texture_, // FIXME: A raw GLuint texture, should wrap this up color_service_->GetProcessor(), alpha_is_associated); // Used for cleanup later - ocio_ctx_ = renderer->context();*/ - - pipeline_ = olive::ShaderGenerator::DefaultPipeline(); + ocio_ctx_ = renderer->context(); } } else if (pipeline_ == nullptr) { // In online, the color transformation was performed on the CPU (see above), so we only need to blit @@ -232,8 +230,12 @@ QVariant MediaInput::Value(NodeOutput *output, const rational &time) internal_tex_.Bind(); // Use pipeline to blit using transformation matrix from input - QMatrix4x4 m; - olive::gl::Blit(pipeline_, false); + QMatrix4x4 transform; + if (renderer->mode() == olive::RenderMode::kOffline) { + olive::gl::OCIOBlit(pipeline_, ocio_texture_, false, transform); + } else { + olive::gl::Blit(pipeline_, false, transform); + } // Release everything internal_tex_.Release(); diff --git a/app/render/gl/functions.cpp b/app/render/gl/functions.cpp index 265a62ba5..ab138a82a 100644 --- a/app/render/gl/functions.cpp +++ b/app/render/gl/functions.cpp @@ -21,6 +21,7 @@ #include "functions.h" #include +#include #include #include @@ -114,3 +115,28 @@ void olive::gl::Blit(ShaderPtr pipeline, bool flipped, QMatrix4x4 matrix) { pipeline->release(); } + +void olive::gl::OCIOBlit(ShaderPtr pipeline, + GLuint lut, + bool flipped, + QMatrix4x4 matrix) +{ + QOpenGLContext* ctx = QOpenGLContext::currentContext(); + QOpenGLExtraFunctions* xf = ctx->extraFunctions(); + + xf->glActiveTexture(GL_TEXTURE2); + xf->glBindTexture(GL_TEXTURE_3D, lut); + xf->glActiveTexture(GL_TEXTURE0); + + pipeline->bind(); + + pipeline->setUniformValue("tex2", 2); + + olive::gl::Blit(pipeline, flipped, matrix); + + pipeline->release(); + + xf->glActiveTexture(GL_TEXTURE2); + xf->glBindTexture(GL_TEXTURE_3D, 0); + xf->glActiveTexture(GL_TEXTURE0); +} diff --git a/app/render/gl/functions.h b/app/render/gl/functions.h index c41f74401..9f417694e 100644 --- a/app/render/gl/functions.h +++ b/app/render/gl/functions.h @@ -45,6 +45,8 @@ namespace gl { */ void Blit(ShaderPtr pipeline, bool flipped = false, QMatrix4x4 matrix = QMatrix4x4()); +void OCIOBlit(ShaderPtr pipeline, GLuint lut, bool flipped = false, QMatrix4x4 matrix = QMatrix4x4()); + } }