From dee232be436909e84a39e9bc3e8949dbaba38e05 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 22 May 2014 20:13:25 +0300 Subject: Add to OpenGL renderers function for clear screen. --- src/render/graphics.h | 3 +++ src/render/mobileopenglgraphics.cpp | 5 +++++ src/render/normalopenglgraphics.cpp | 5 +++++ src/render/nullopenglgraphics.cpp | 4 ++++ src/render/openglgraphicsdef.hpp | 2 ++ src/render/safeopenglgraphics.cpp | 5 +++++ 6 files changed, 24 insertions(+) (limited to 'src') diff --git a/src/render/graphics.h b/src/render/graphics.h index d26f8a770..58e08888a 100644 --- a/src/render/graphics.h +++ b/src/render/graphics.h @@ -444,6 +444,9 @@ class Graphics virtual void endDraw() { } + virtual void clearScreen() const + { } + int mWidth; int mHeight; int mActualWidth; diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index 58760ce60..8150c4f66 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -1318,6 +1318,11 @@ void MobileOpenGLGraphics::calcImageRect(ImageVertexes *const vert, #include "render/graphics_calcImageRect.hpp" } +void MobileOpenGLGraphics::clearScreen() const +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); +} + #ifdef DEBUG_BIND_TEXTURE void MobileOpenGLGraphics::debugBindTexture(const Image *const image) { diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp index c8fe89c89..75064a435 100644 --- a/src/render/normalopenglgraphics.cpp +++ b/src/render/normalopenglgraphics.cpp @@ -1607,6 +1607,11 @@ void NormalOpenGLGraphics::calcImageRect(ImageVertexes *const vert, #include "render/graphics_calcImageRect.hpp" } +void NormalOpenGLGraphics::clearScreen() const +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); +} + #ifdef DEBUG_BIND_TEXTURE void NormalOpenGLGraphics::debugBindTexture(const Image *const image) { diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp index 40a952db8..ca6fa1660 100644 --- a/src/render/nullopenglgraphics.cpp +++ b/src/render/nullopenglgraphics.cpp @@ -1185,6 +1185,10 @@ void NullOpenGLGraphics::calcImageRect(ImageVertexes *const vert, #include "render/graphics_calcImageRect.hpp" } +void NullOpenGLGraphics::clearScreen() const +{ +} + #ifdef DEBUG_BIND_TEXTURE void NullOpenGLGraphics::debugBindTexture(const Image *const image) { diff --git a/src/render/openglgraphicsdef.hpp b/src/render/openglgraphicsdef.hpp index 4315d4115..1df90e3ee 100644 --- a/src/render/openglgraphicsdef.hpp +++ b/src/render/openglgraphicsdef.hpp @@ -49,6 +49,8 @@ public: bool isAllowScale() const override final { return true; } + void clearScreen() const override final; + static void bindTexture(const GLenum target, const GLuint texture); static GLuint mLastImage; diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp index 58ab99923..236e09841 100644 --- a/src/render/safeopenglgraphics.cpp +++ b/src/render/safeopenglgraphics.cpp @@ -722,6 +722,11 @@ void SafeOpenGLGraphics::restoreColor() mByteColor = mColor; } +void SafeOpenGLGraphics::clearScreen() const +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); +} + void SafeOpenGLGraphics::drawImageRect(const int x, const int y, const int w, const int h, const ImageRect &imgRect) -- cgit v1.2.3-60-g2f50