diff --git a/app/render/backend/opengl/openglexporter.cpp b/app/render/backend/opengl/openglexporter.cpp index f14b1e307..6d08afb8a 100644 --- a/app/render/backend/opengl/openglexporter.cpp +++ b/app/render/backend/opengl/openglexporter.cpp @@ -64,7 +64,7 @@ FramePtr OpenGLExporter::TextureToFrame(const QVariant& texture) // Perform OpenGL read buffer_.Attach(texture_); - f->glBindFramebuffer(GL_READ_FRAMEBUFFER, buffer_.buffer()); + buffer_.Bind(); PixelFormatInfo format_info = PixelService::GetPixelFormatInfo(params_.format()); @@ -76,7 +76,7 @@ FramePtr OpenGLExporter::TextureToFrame(const QVariant& texture) format_info.gl_pixel_type, frame->data()); - f->glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + buffer_.Release(); buffer_.Detach(); return frame; diff --git a/app/render/backend/opengl/opengltexture.cpp b/app/render/backend/opengl/opengltexture.cpp index 2bed8574f..e8123608d 100644 --- a/app/render/backend/opengl/opengltexture.cpp +++ b/app/render/backend/opengl/opengltexture.cpp @@ -156,39 +156,6 @@ void OpenGLTexture::Upload(const void *data) Release(); } -uchar *OpenGLTexture::Download() const -{ - if (!IsCreated()) { - qWarning() << "OpenGLTexture::Download() called while it wasn't created"; - return nullptr; - } - - QOpenGLContext* context = QOpenGLContext::currentContext(); - QOpenGLFunctions* f = context->functions(); - - GLuint read_fbo; - - f->glGenFramebuffers(1, &read_fbo); - - f->glBindFramebuffer(GL_READ_FRAMEBUFFER, read_fbo); - - context->extraFunctions()->glFramebufferTexture2D( - GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture_, 0 - ); - - PixelFormatInfo format_info = PixelService::GetPixelFormatInfo(format_); - - uchar* data = new uchar[PixelService::GetBufferSize(format_, width_, height_)]; - - f->glReadPixels(0, 0, width_, height_, format_info.pixel_format, format_info.gl_pixel_type, data); - - f->glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); - - f->glDeleteFramebuffers(1, &read_fbo); - - return data; -} - void OpenGLTexture::CreateInternal(QOpenGLContext* create_ctx, GLuint* tex, const void *data) { QOpenGLFunctions* f = create_ctx->functions(); diff --git a/app/render/backend/opengl/opengltexture.h b/app/render/backend/opengl/opengltexture.h index c7a801729..92b061234 100644 --- a/app/render/backend/opengl/opengltexture.h +++ b/app/render/backend/opengl/opengltexture.h @@ -59,8 +59,6 @@ public: void Upload(const void *data); - uchar *Download() const; - public slots: void Destroy(); diff --git a/app/render/backend/opengl/openglworker.cpp b/app/render/backend/opengl/openglworker.cpp index 585155092..b3e3c5fc1 100644 --- a/app/render/backend/opengl/openglworker.cpp +++ b/app/render/backend/opengl/openglworker.cpp @@ -121,8 +121,6 @@ void OpenGLWorker::FrameToValue(StreamPtr stream, FramePtr frame, NodeValueTable buffer_.Detach(); footage_tex_ref = associated_tex_ref; - - functions_->glFinish(); } table->Push(NodeParam::kTexture, QVariant::fromValue(footage_tex_ref)); @@ -337,7 +335,6 @@ void OpenGLWorker::RunNodeAccelerated(const Node *node, const TimeRange &range, // Make sure all OpenGL functions are complete by this point before unlocking the shader (or another thread may // change its parameters before our drawing in this thread is done) - functions_->glFinish(); shader->Unlock(); // Release any textures we bound before @@ -362,7 +359,7 @@ void OpenGLWorker::TextureToBuffer(const QVariant &tex_in, QByteArray &buffer) QOpenGLFunctions* f = QOpenGLContext::currentContext()->functions(); buffer_.Attach(texture->texture()); - f->glBindFramebuffer(GL_READ_FRAMEBUFFER, buffer_.buffer()); + buffer_.Bind(); f->glReadPixels(0, 0, @@ -372,7 +369,7 @@ void OpenGLWorker::TextureToBuffer(const QVariant &tex_in, QByteArray &buffer) format_info.gl_pixel_type, buffer.data()); - f->glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + buffer_.Release(); buffer_.Detach(); }