diff --git a/app/widget/viewer/viewer.cpp b/app/widget/viewer/viewer.cpp index 370606301..8d9899c78 100644 --- a/app/widget/viewer/viewer.cpp +++ b/app/widget/viewer/viewer.cpp @@ -205,11 +205,7 @@ VideoRenderBackend *ViewerWidget::video_renderer() const void ViewerWidget::SetTexture(OpenGLTexturePtr tex) { - if (tex == nullptr) { - gl_widget_->SetTexture(0); - } else { - gl_widget_->SetTexture(tex->texture()); - } + gl_widget_->SetTexture(tex); } void ViewerWidget::UpdateTimeInternal(int64_t i) diff --git a/app/widget/viewer/viewerglwidget.cpp b/app/widget/viewer/viewerglwidget.cpp index 17fbced2a..c64fef5a4 100644 --- a/app/widget/viewer/viewerglwidget.cpp +++ b/app/widget/viewer/viewerglwidget.cpp @@ -96,7 +96,7 @@ void ViewerGLWidget::SetOCIOLook(const QString &look) update(); } -void ViewerGLWidget::SetTexture(GLuint tex) +void ViewerGLWidget::SetTexture(OpenGLTexturePtr tex) { // Update the texture texture_ = tex; @@ -124,7 +124,7 @@ void ViewerGLWidget::initializeGL() void ViewerGLWidget::paintGL() { // We only draw if we have a pipeline - if (!pipeline_) { + if (!pipeline_ || !texture_) { return; } @@ -135,17 +135,14 @@ void ViewerGLWidget::paintGL() f->glClearColor(0.0f, 0.0f, 0.0f, 0.0f); f->glClear(GL_COLOR_BUFFER_BIT); - // Check if we have a texture to draw - if (texture_ > 0) { - // Bind retrieved texture - f->glBindTexture(GL_TEXTURE_2D, texture_); + // Bind retrieved texture + f->glBindTexture(GL_TEXTURE_2D, texture_->texture()); - // Blit using the pipeline retrieved in initializeGL() - OpenGLRenderFunctions::OCIOBlit(pipeline_, ocio_lut_, true, matrix_); + // Blit using the pipeline retrieved in initializeGL() + OpenGLRenderFunctions::OCIOBlit(pipeline_, ocio_lut_, true, matrix_); - // Release retrieved texture - f->glBindTexture(GL_TEXTURE_2D, 0); - } + // Release retrieved texture + f->glBindTexture(GL_TEXTURE_2D, 0); } void ViewerGLWidget::RefreshColorPipeline() diff --git a/app/widget/viewer/viewerglwidget.h b/app/widget/viewer/viewerglwidget.h index 16ff87371..bbaa04b91 100644 --- a/app/widget/viewer/viewerglwidget.h +++ b/app/widget/viewer/viewerglwidget.h @@ -23,8 +23,9 @@ #include -#include "render/colormanager.h" #include "render/backend/opengl/openglshader.h" +#include "render/backend/opengl/opengltexture.h" +#include "render/colormanager.h" /** * @brief The inner display/rendering widget of a Viewer class. @@ -109,7 +110,7 @@ public slots: * * @param tex */ - void SetTexture(GLuint tex); + void SetTexture(OpenGLTexturePtr tex); void SetOCIOParameters(const QString& display, const QString& view, const QString& look); @@ -178,7 +179,7 @@ private: /** * @brief Internal reference to the OpenGL texture to draw. Set in SetTexture() and used in paintGL(). */ - GLuint texture_; + OpenGLTexturePtr texture_; /** * @brief Internal shader object to use as the pipeline shader