fixed bug that caused flickering textures

The ViewerGLWidget would receive raw GLuint textures while most of Olive uses
an OpenGLTexture C++ wrapper. Unfortunately this would lead to the C++ wrapper
getting destroyed since its instance wasn't kept in the ViewerGLWidget. This
meant by the time the ViewerGLWidget would re-draw, the texture would have
already been destroyed leading to some black frames. This is now fixed.
This commit is contained in:
itsmattkc
2019-12-27 05:11:42 +11:00
parent 549427353d
commit a4b3dc2ab4
3 changed files with 13 additions and 19 deletions
+8 -11
View File
@@ -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()