convert to reference space in media node

This commit is contained in:
itsmattkc
2019-08-29 12:43:52 +10:00
parent deff114241
commit 836943e58a
3 changed files with 36 additions and 6 deletions
+8 -6
View File
@@ -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();
+26
View File
@@ -21,6 +21,7 @@
#include "functions.h"
#include <QOpenGLFunctions>
#include <QOpenGLExtraFunctions>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
@@ -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);
}
+2
View File
@@ -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());
}
}