From 75b784c1075d814a054bc0a347f47e451e651a7c Mon Sep 17 00:00:00 2001 From: Dennis-Z Date: Tue, 15 Aug 2017 21:38:12 +0200 Subject: [PATCH] Flush OpenGL command buffers before drawing a rectangle instead of after This fixes an issue causing the first rectangle that is being drawn to not be over whatever was previously drawn. --- .../drawing/engines/opengl/OpenGLDrawingEngine.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 3b7ed3ac9f..99a9b74709 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -561,6 +561,9 @@ void OpenGLDrawingContext::Clear(uint8 paletteIndex) void OpenGLDrawingContext::FillRect(uint32 colour, sint32 left, sint32 top, sint32 right, sint32 bottom) { + // Must be rendered in order, depends on already rendered contents + FlushCommandBuffers(); + left += _offsetX; top += _offsetY; right += _offsetX; @@ -601,13 +604,13 @@ void OpenGLDrawingContext::FillRect(uint32 colour, sint32 left, sint32 top, sint command.bounds[3] = bottom + 1; _commandBuffers.rectangles.push_back(command); - - // Must be rendered in order, depends on already rendered contents - FlushCommandBuffers(); } void OpenGLDrawingContext::FilterRect(FILTER_PALETTE_ID palette, sint32 left, sint32 top, sint32 right, sint32 bottom) { + // Must be rendered in order, depends on already rendered contents + FlushCommandBuffers(); + left += _offsetX; top += _offsetY; right += _offsetX; @@ -643,9 +646,6 @@ void OpenGLDrawingContext::FilterRect(FILTER_PALETTE_ID palette, sint32 left, si command.bounds[3] = bottom + 1; _commandBuffers.rectangles.push_back(command); - - // Must be rendered in order, depends on already rendered contents - FlushCommandBuffers(); } void OpenGLDrawingContext::DrawLine(uint32 colour, sint32 x1, sint32 y1, sint32 x2, sint32 y2)