From ccdeb3fbc88ac0764dd5114da4a54b99b069ea00 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 3 Mar 2019 15:04:14 -0500 Subject: [PATCH] Ensures draw is a no-op prior to pipeline setup. --- Outputs/OpenGL/ScanTarget.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Outputs/OpenGL/ScanTarget.cpp b/Outputs/OpenGL/ScanTarget.cpp index a37408f63..ade949552 100644 --- a/Outputs/OpenGL/ScanTarget.cpp +++ b/Outputs/OpenGL/ScanTarget.cpp @@ -679,14 +679,16 @@ void ScanTarget::update(int output_width, int output_height) { void ScanTarget::draw(int output_width, int output_height) { while(is_drawing_.test_and_set()); - // Copy the accumulation texture to the target. - test_gl(glBindFramebuffer, GL_FRAMEBUFFER, target_framebuffer_); - test_gl(glViewport, 0, 0, (GLsizei)output_width, (GLsizei)output_height); + if(accumulation_texture_) { + // Copy the accumulation texture to the target. + test_gl(glBindFramebuffer, GL_FRAMEBUFFER, target_framebuffer_); + test_gl(glViewport, 0, 0, (GLsizei)output_width, (GLsizei)output_height); - test_gl(glClearColor, 0.0f, 0.0f, 0.0f, 0.0f); - test_gl(glClear, GL_COLOR_BUFFER_BIT); - accumulation_texture_->bind_texture(); - accumulation_texture_->draw(float(output_width) / float(output_height), 4.0f / 255.0f); + test_gl(glClearColor, 0.0f, 0.0f, 0.0f, 0.0f); + test_gl(glClear, GL_COLOR_BUFFER_BIT); + accumulation_texture_->bind_texture(); + accumulation_texture_->draw(float(output_width) / float(output_height), 4.0f / 255.0f); + } is_drawing_.clear(); }