From bf348ccb96e526ad98fbafbcf7948c1a755b6833 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 5 Feb 2016 22:47:12 -0500 Subject: [PATCH] Fixed clearing logic. --- Outputs/CRT/CRTOpenGL.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Outputs/CRT/CRTOpenGL.cpp b/Outputs/CRT/CRTOpenGL.cpp index cdfb0e8f6..6fbabba30 100644 --- a/Outputs/CRT/CRTOpenGL.cpp +++ b/Outputs/CRT/CRTOpenGL.cpp @@ -90,13 +90,15 @@ void CRT::draw_frame(int output_width, int output_height, bool only_if_dirty) { _current_frame_mutex->lock(); - if(!_current_frame || !only_if_dirty) + if(!_current_frame && !only_if_dirty) { glClear(GL_COLOR_BUFFER_BIT); } - if(_current_frame && _current_frame != _last_drawn_frame) + if(_current_frame && (_current_frame != _last_drawn_frame || !only_if_dirty)) { + glClear(GL_COLOR_BUFFER_BIT); + if(!_openGL_state) { _openGL_state = new OpenGLState; @@ -127,10 +129,11 @@ void CRT::draw_frame(int output_width, int output_height, bool only_if_dirty) glTexImage2D(GL_TEXTURE_2D, 0, (GLint)format, _current_frame->size.width, _current_frame->size.height, 0, format, GL_UNSIGNED_BYTE, _current_frame->buffers[0].data); _openGL_state->textureSize = _current_frame->size; - if(_openGL_state->textureSizeUniform >= 0) glUniform2f(_openGL_state->textureSizeUniform, _current_frame->size.width, _current_frame->size.height); + if(_openGL_state->textureSizeUniform >= 0) + glUniform2f(_openGL_state->textureSizeUniform, _current_frame->size.width, _current_frame->size.height); } else - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _current_frame->dirty_size.width, _current_frame->dirty_size.height, formatForDepth(_current_frame->buffers[0].depth), GL_UNSIGNED_BYTE, _current_frame->buffers[0].data); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _current_frame->size.width, _current_frame->dirty_size.height, formatForDepth(_current_frame->buffers[0].depth), GL_UNSIGNED_BYTE, _current_frame->buffers[0].data); glDrawArrays(GL_TRIANGLES, 0, (GLsizei)_current_frame->number_of_vertices); }