diff --git a/src/framework/application.cpp b/src/framework/application.cpp index 85d09ee5..cb53299d 100644 --- a/src/framework/application.cpp +++ b/src/framework/application.cpp @@ -208,6 +208,7 @@ void Application::run() m_foregroundFrameCounter.processNextFrame(); // draw foreground + g_painter->clearScreen(); g_ui.render(true); // copy the foreground to a texture diff --git a/src/framework/graphics/graphics.cpp b/src/framework/graphics/graphics.cpp index 67d9fe2d..ea09d382 100644 --- a/src/framework/graphics/graphics.cpp +++ b/src/framework/graphics/graphics.cpp @@ -86,10 +86,6 @@ void Graphics::init() glEnable(GL_CULL_FACE); */ - // clear color buffer - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - // determine max texture size GLint maxTextureSize = 0; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); diff --git a/src/framework/graphics/painter.cpp b/src/framework/graphics/painter.cpp index 2f45b078..0496b1eb 100644 --- a/src/framework/graphics/painter.cpp +++ b/src/framework/graphics/painter.cpp @@ -86,6 +86,12 @@ void Painter::restoreSavedState() setTexture(m_olderStates[m_oldStateIndex].texture); } +void Painter::clearScreen() +{ + glClearColor(0,0,0,1); + glClear(GL_COLOR_BUFFER_BIT); +} + void Painter::setCompositionMode(Painter::CompositionMode compositionMode) { if(m_compositionMode == compositionMode) diff --git a/src/framework/graphics/painter.h b/src/framework/graphics/painter.h index 61c0016b..cba838a5 100644 --- a/src/framework/graphics/painter.h +++ b/src/framework/graphics/painter.h @@ -65,6 +65,7 @@ public: void saveState(); void saveAndResetState(); void restoreSavedState(); + void clearScreen(); virtual void drawCoords(CoordsBuffer& coordsBuffer, DrawMode drawMode = Triangles) = 0; virtual void drawTextureCoords(CoordsBuffer& coordsBuffer, const TexturePtr& texture) = 0; diff --git a/src/otclient/core/mapview.cpp b/src/otclient/core/mapview.cpp index 7b383ee9..25234251 100644 --- a/src/otclient/core/mapview.cpp +++ b/src/otclient/core/mapview.cpp @@ -75,13 +75,7 @@ void MapView::draw(const Rect& rect) if(m_mustCleanFramebuffer) { Rect clearRect = Rect(0, 0, m_drawDimension * m_tileSize); - - // drawing a black rect is actually faster than FrameBuffer::clear() - g_painter->setColor(Color::black); - g_painter->drawFilledRect(clearRect); - g_painter->setColor(Color::white); - - //m_framebuffer->clear(Color::black); + m_framebuffer->clear(Color::black, clearRect); } auto it = m_cachedVisibleTiles.begin();