diff engine/core/gui/base/opengl/opengl_gui_graphics.cpp @ 620:853d25234671

* Moved the GLEnable and GLDisable structures from opengl_gui_graphics.cpp to fife_opengl.h as they may prove to be useful elsewhere. * Fixed the color mask definitions in fife_stdint.h * Added the nextPow2() function to calculate the nearest (greater) power of 2 * Removed a bunch of re-definitions of RGB masks * Modified GLImage to only generate one "texture chunk". I hope this makes better use of memory and speeds things up a hair * Made use of the GLEnable structure when clearing the screen
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 30 Sep 2010 21:24:55 +0000
parents 90005975cdbb
children
line wrap: on
line diff
--- a/engine/core/gui/base/opengl/opengl_gui_graphics.cpp	Wed Sep 29 15:15:45 2010 +0000
+++ b/engine/core/gui/base/opengl/opengl_gui_graphics.cpp	Thu Sep 30 21:24:55 2010 +0000
@@ -33,47 +33,16 @@
 #include "video/image.h"
 #include "gui/base/gui_image.h"
 #include "util/structures/rect.h"
+#include "video/opengl/fife_opengl.h"
 
 #include "opengl_gui_graphics.h"
 
 namespace FIFE {
-	struct GLEnable {
-		GLenum m_flag;
-		GLboolean m_oldval;
-		GLEnable(GLenum flag) : m_flag(flag) { 
-			glGetBooleanv(flag, &m_oldval);
-			if (!m_oldval) {
-				glEnable(flag);
-			}
-		}
-		~GLEnable() { 
-			if (!m_oldval) {
-				glDisable(m_flag);
-			}
-		}
-	};
-
-	struct GLDisable {
-		GLenum m_flag;
-		GLboolean m_oldval;
-		GLDisable(GLenum flag) : m_flag(flag) { 
-			glGetBooleanv(flag, &m_oldval);
-			if (m_oldval) {
-				glDisable(flag);
-			}
-		}
-		~GLDisable() { 
-			if (m_oldval) {
-				glEnable(m_flag);
-			}
-		}
-	};
-
 	OpenGLGuiGraphics::OpenGLGuiGraphics(ImagePool& pool): m_pool(pool) {
 		mTarget = SDL_GetVideoSurface();
 		assert(mTarget);
 		setTargetPlane(mTarget->w, mTarget->h);
-		
+
 	}
 
 	void OpenGLGuiGraphics::drawImage(const gcn::Image* image, int srcX, int srcY, int dstX, int dstY, int width, int height) {