diff engine/core/video/opengl/renderbackendopengl.cpp @ 634:5f381fa34769

* Added the clearBackBuffer() function to the renderbackends. * Renamed setClearScreen() to setClearBackBuffer() * The SDL render backend now honors what was set with setClearBackBuffer() * Documented testRenderedViewPort() * The OpenGL backend no longer clears the screen every frame by default. testRenderedViewPort() takes care of clearing the screen for now. Note: if the user overrides the default and enables clearing of the backbuffer that it may be cleared twice in one frame (OpenGL only)!
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Wed, 06 Oct 2010 15:49:53 +0000
parents 46b95d06c8c2
children 855ad500f991
line wrap: on
line diff
--- a/engine/core/video/opengl/renderbackendopengl.cpp	Wed Oct 06 14:09:24 2010 +0000
+++ b/engine/core/video/opengl/renderbackendopengl.cpp	Wed Oct 06 15:49:53 2010 +0000
@@ -43,7 +43,7 @@
 
 		m_rgba_format = *(testsurface->format);
 		SDL_FreeSurface(testsurface);
-		m_clear = true;
+		m_clear = false;
 	}
 
 	const std::string& RenderBackendOpenGL::getName() const {
@@ -64,6 +64,11 @@
 		SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); // temporary hack
 	}
 
+	void RenderBackendOpenGL::clearBackBuffer() {
+		GLDisable flag(GL_SCISSOR_TEST);
+		glClear(GL_COLOR_BUFFER_BIT);
+	}
+
 	Image* RenderBackendOpenGL::createMainScreen(unsigned int width, unsigned int height, unsigned char bitsPerPixel, bool fs, const std::string& title, const std::string& icon) {
 		delete m_screen;
 		m_screen = 0;
@@ -134,8 +139,7 @@
 
 	void RenderBackendOpenGL::startFrame() {
 		if(m_clear) {
-			GLDisable flag(GL_SCISSOR_TEST);
-			glClear(GL_COLOR_BUFFER_BIT);
+			clearBackBuffer();
 		}
 	}