Name the namespaces logically.

BUG=18110152

Change-Id: Ib9959d5a3d993048e61887254f42e7de342ec4fd
Reviewed-on: https://swiftshader-review.googlesource.com/1255
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/GLES2/common/debug.cpp b/src/GLES2/common/debug.cpp
index 82139a5..4937ef3 100644
--- a/src/GLES2/common/debug.cpp
+++ b/src/GLES2/common/debug.cpp
@@ -16,7 +16,7 @@
 #include <stdio.h>

 #include <stdarg.h>

 

-namespace gl2

+namespace es

 {

 	static void output(const char *format, va_list vararg)

 	{

diff --git a/src/GLES2/common/debug.h b/src/GLES2/common/debug.h
index 8907df4..492477a 100644
--- a/src/GLES2/common/debug.h
+++ b/src/GLES2/common/debug.h
@@ -21,7 +21,7 @@
 #define TRACE_OUTPUT_FILE "debug.txt"

 #endif

 

-namespace gl2

+namespace es

 {

     // Outputs text to the debugging log

     void trace(const char *format, ...);

@@ -31,21 +31,21 @@
 #if defined(ANGLE_DISABLE_TRACE)

 #define TRACE(message, ...) (void(0))

 #else

-#define TRACE(message, ...) gl2::trace("trace: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)

+#define TRACE(message, ...) es::trace("trace: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)

 #endif

 

 // A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.

 #if defined(ANGLE_DISABLE_TRACE)

 #define FIXME(message, ...) (void(0))

 #else

-#define FIXME(message, ...) do {gl2::trace("fixme: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false)

+#define FIXME(message, ...) do {es::trace("fixme: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false)

 #endif

 

 // A macro to output a function call and its arguments to the debugging log, in case of error.

 #if defined(ANGLE_DISABLE_TRACE)

 #define ERR(message, ...) (void(0))

 #else

-#define ERR(message, ...) do {gl2::trace("err: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false)

+#define ERR(message, ...) do {es::trace("err: %s(%d): "message"\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false)

 #endif

 

 // A macro asserting a condition and outputting failures to the debug log

diff --git a/src/GLES2/compiler/OutputASM.cpp b/src/GLES2/compiler/OutputASM.cpp
index c01b473..2ffc576 100644
--- a/src/GLES2/compiler/OutputASM.cpp
+++ b/src/GLES2/compiler/OutputASM.cpp
@@ -99,7 +99,7 @@
 		this->registerIndex = registerIndex;

 	}

 

-	OutputASM::OutputASM(TParseContext &context, gl2::Shader *shaderObject) : TIntermTraverser(true, true, true), mContext(context), shaderObject(shaderObject)

+	OutputASM::OutputASM(TParseContext &context, es2::Shader *shaderObject) : TIntermTraverser(true, true, true), mContext(context), shaderObject(shaderObject)

 	{

 		shader = 0;

 		pixelShader = 0;

@@ -2003,10 +2003,10 @@
 		{

 			const TType &type = varying->getType();

 			const char *name = varying->getAsSymbolNode()->getSymbol().c_str();

-			gl2::VaryingList &activeVaryings = shaderObject->varyings;

+			es2::VaryingList &activeVaryings = shaderObject->varyings;

 			

 			// Check if this varying has been declared before without having a register assigned

-			for(gl2::VaryingList::iterator v = activeVaryings.begin(); v != activeVaryings.end(); v++)

+			for(es2::VaryingList::iterator v = activeVaryings.begin(); v != activeVaryings.end(); v++)

 			{

 				if(v->name == name)

 				{

@@ -2020,7 +2020,7 @@
 				}

 			}

 			

-			activeVaryings.push_back(gl2::Varying(glVariableType(type), name, varying->getArraySize(), reg, 0));

+			activeVaryings.push_back(es2::Varying(glVariableType(type), name, varying->getArraySize(), reg, 0));

 		}

 	}

 

diff --git a/src/GLES2/compiler/OutputASM.h b/src/GLES2/compiler/OutputASM.h
index 2af4a10..ae6cfa7 100644
--- a/src/GLES2/compiler/OutputASM.h
+++ b/src/GLES2/compiler/OutputASM.h
@@ -24,7 +24,7 @@
 #include <set>

 #include <map>

 

-namespace gl2

+namespace es2

 {

 	class Shader;

 }

@@ -81,7 +81,7 @@
 	class OutputASM : public TIntermTraverser

 	{

 	public:

-		explicit OutputASM(TParseContext &context, gl2::Shader *shaderObject);

+		explicit OutputASM(TParseContext &context, es2::Shader *shaderObject);

 		~OutputASM();

 

 		void output();

@@ -144,7 +144,7 @@
 		static int dim2(TIntermNode *m);

 		static unsigned int loopCount(TIntermLoop *node);

 

-		gl2::Shader *const shaderObject;

+		es2::Shader *const shaderObject;

 		sw::Shader *shader;

 		sw::PixelShader *pixelShader;

 		sw::VertexShader *vertexShader;

diff --git a/src/GLES2/compiler/TranslatorASM.cpp b/src/GLES2/compiler/TranslatorASM.cpp
index 371b072..8749900 100644
--- a/src/GLES2/compiler/TranslatorASM.cpp
+++ b/src/GLES2/compiler/TranslatorASM.cpp
@@ -13,7 +13,7 @@
 

 #include "InitializeParseContext.h"

 

-TranslatorASM::TranslatorASM(gl2::Shader *shaderObject, ShShaderType type, ShShaderSpec spec) : TCompiler(type, spec), shaderObject(shaderObject)

+TranslatorASM::TranslatorASM(es2::Shader *shaderObject, ShShaderType type, ShShaderSpec spec) : TCompiler(type, spec), shaderObject(shaderObject)

 {

 }

 

diff --git a/src/GLES2/compiler/TranslatorASM.h b/src/GLES2/compiler/TranslatorASM.h
index 3eb1715..596c424 100644
--- a/src/GLES2/compiler/TranslatorASM.h
+++ b/src/GLES2/compiler/TranslatorASM.h
@@ -17,7 +17,7 @@
 #include "Shader/PixelShader.hpp"

 #include "Shader/VertexShader.hpp"

 

-namespace gl2

+namespace es2

 {

 	class Shader;

 }

@@ -25,13 +25,13 @@
 class TranslatorASM : public TCompiler

 {

 public:

-    TranslatorASM(gl2::Shader *shaderObject, ShShaderType type, ShShaderSpec spec);

+    TranslatorASM(es2::Shader *shaderObject, ShShaderType type, ShShaderSpec spec);

 

 protected:

     virtual bool translate(TIntermNode* root);

 

 private:

-	gl2::Shader *const shaderObject;

+	es2::Shader *const shaderObject;

 };

 

 #endif  // COMPILER_TRANSLATORASM_H_

diff --git a/src/GLES2/libEGL/Display.cpp b/src/GLES2/libEGL/Display.cpp
index f50fab1..3cabebe 100644
--- a/src/GLES2/libEGL/Display.cpp
+++ b/src/GLES2/libEGL/Display.cpp
@@ -390,16 +390,16 @@
 

 	if(clientVersion == 1 && config->mRenderableType & EGL_OPENGL_ES_BIT)

 	{

-		if(gl::createContext != 0)

+		if(es1::createContext != 0)

 		{

-			context = gl::createContext(config, shareContext);

+			context = es1::createContext(config, shareContext);

 		}

 	}

 	else if(clientVersion == 2 && config->mRenderableType & EGL_OPENGL_ES2_BIT)

 	{

-		if(gl2::createContext != 0)

+		if(es2::createContext != 0)

 		{

-			context = gl2::createContext(config, shareContext);

+			context = es2::createContext(config, shareContext);

 		}

 	}

 	else

diff --git a/src/GLES2/libEGL/Surface.cpp b/src/GLES2/libEGL/Surface.cpp
index 8492e6b..004dcb3 100644
--- a/src/GLES2/libEGL/Surface.cpp
+++ b/src/GLES2/libEGL/Surface.cpp
@@ -132,7 +132,7 @@
 

     if(mWindow)

     {

-		frameBuffer = gl2::createFrameBuffer(mDisplay->getNativeDisplay(), mWindow, backBufferWidth, backBufferHeight);

+		frameBuffer = es2::createFrameBuffer(mDisplay->getNativeDisplay(), mWindow, backBufferWidth, backBufferHeight);

 

 		if(!frameBuffer)

 		{

@@ -142,7 +142,7 @@
 		}

     }

 

-	backBuffer = gl2::createBackBuffer(backBufferWidth, backBufferHeight, mConfig);

+	backBuffer = es2::createBackBuffer(backBufferWidth, backBufferHeight, mConfig);

 	

     if(!backBuffer)

     {

@@ -153,7 +153,7 @@
 

     if(mConfig->mDepthStencilFormat != sw::FORMAT_NULL)

     {

-        mDepthStencil = gl2::createDepthStencil(backBufferWidth, backBufferHeight, mConfig->mDepthStencilFormat, 1, false);

+        mDepthStencil = es2::createDepthStencil(backBufferWidth, backBufferHeight, mConfig->mDepthStencilFormat, 1, false);

 

 		if(!mDepthStencil)

 		{

diff --git a/src/GLES2/libEGL/libEGL.cpp b/src/GLES2/libEGL/libEGL.cpp
index e5c92e3..1a9104d 100644
--- a/src/GLES2/libEGL/libEGL.cpp
+++ b/src/GLES2/libEGL/libEGL.cpp
@@ -1189,15 +1189,15 @@
             }

         }

 

-		if(gl2::getProcAddress != 0)

+		if(es2::getProcAddress != 0)

 		{

-			__eglMustCastToProperFunctionPointerType proc = gl2::getProcAddress(procname);

+			__eglMustCastToProperFunctionPointerType proc = es2::getProcAddress(procname);

 			if(proc) return proc;

 		}

 

-		if(gl::getProcAddress != 0)

+		if(es1::getProcAddress != 0)

 		{

-			__eglMustCastToProperFunctionPointerType proc =  gl::getProcAddress(procname);

+			__eglMustCastToProperFunctionPointerType proc =  es1::getProcAddress(procname);

 			if(proc) return proc;

 		}

     }

diff --git a/src/GLES2/libEGL/main.cpp b/src/GLES2/libEGL/main.cpp
index d77776f..7f6584a 100644
--- a/src/GLES2/libEGL/main.cpp
+++ b/src/GLES2/libEGL/main.cpp
@@ -89,11 +89,11 @@
 	#endif

 	

     libGLES_CM = loadLibrary(libGLES_CM_lib);

-    gl::createContext = (egl::Context *(*)(const egl::Config*, const egl::Context*))getProcAddress(libGLES_CM, "glCreateContext");

-    gl::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLES_CM, "glGetProcAddress");

-    gl::createBackBuffer = (egl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLES_CM, "createBackBuffer");

-	gl::createDepthStencil = (egl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLES_CM, "createDepthStencil");

-    gl::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLES_CM, "createFrameBuffer");

+    es1::createContext = (egl::Context *(*)(const egl::Config*, const egl::Context*))getProcAddress(libGLES_CM, "glCreateContext");

+    es1::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLES_CM, "glGetProcAddress");

+    es1::createBackBuffer = (egl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLES_CM, "createBackBuffer");

+	es1::createDepthStencil = (egl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLES_CM, "createDepthStencil");

+    es1::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLES_CM, "createFrameBuffer");

 

 	#if defined(_WIN32)

 	const char *libGLESv2_lib = "libGLESv2.dll";

@@ -102,11 +102,11 @@
 	#endif

 	

     libGLESv2 = loadLibrary(libGLESv2_lib);

-    gl2::createContext = (egl::Context *(*)(const egl::Config*, const egl::Context*))getProcAddress(libGLESv2, "glCreateContext");

-    gl2::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLESv2, "glGetProcAddress");

-    gl2::createBackBuffer = (egl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLESv2, "createBackBuffer");

-	gl2::createDepthStencil = (egl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLESv2, "createDepthStencil");

-    gl2::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLESv2, "createFrameBuffer");

+    es2::createContext = (egl::Context *(*)(const egl::Config*, const egl::Context*))getProcAddress(libGLESv2, "glCreateContext");

+    es2::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLESv2, "glGetProcAddress");

+    es2::createBackBuffer = (egl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLESv2, "createBackBuffer");

+	es2::createDepthStencil = (egl::Image *(*)(unsigned int, unsigned int, sw::Format, int, bool))getProcAddress(libGLESv2, "createDepthStencil");

+    es2::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLESv2, "createFrameBuffer");

 

 	return libGLES_CM != 0 || libGLESv2 != 0;

 }

@@ -270,7 +270,7 @@
     }

 }

 

-namespace gl

+namespace es1

 {

 	egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext) = 0;

 	__eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname) = 0;

@@ -279,7 +279,7 @@
 	sw::FrameBuffer *(*createFrameBuffer)(EGLNativeDisplayType display, EGLNativeWindowType window, int width, int height) = 0;

 }

 

-namespace gl2

+namespace es2

 {

 	egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext) = 0;

 	__eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname) = 0;

diff --git a/src/GLES2/libEGL/main.h b/src/GLES2/libEGL/main.h
index faf7a56..7705037 100644
--- a/src/GLES2/libEGL/main.h
+++ b/src/GLES2/libEGL/main.h
@@ -83,7 +83,7 @@
 }
 
 // libGLES_CM dependencies
-namespace gl
+namespace es1
 {
 	extern egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext);
 	extern __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname);
@@ -93,7 +93,7 @@
 }
 
 // libGLESv2 dependencies
-namespace gl2
+namespace es2
 {
 	extern egl::Context *(*createContext)(const egl::Config *config, const egl::Context *shareContext);
 	extern __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname);
diff --git a/src/GLES2/libGLES_CM/Buffer.cpp b/src/GLES2/libGLES_CM/Buffer.cpp
index fc535ac..0670722 100644
--- a/src/GLES2/libGLES_CM/Buffer.cpp
+++ b/src/GLES2/libGLES_CM/Buffer.cpp
@@ -19,7 +19,7 @@
 #include "VertexDataManager.h"
 #include "IndexDataManager.h"
 
-namespace gl
+namespace es1
 {
 
 Buffer::Buffer(GLuint id) : RefCountObject(id)
diff --git a/src/GLES2/libGLES_CM/Buffer.h b/src/GLES2/libGLES_CM/Buffer.h
index 538d366..c01ac4a 100644
--- a/src/GLES2/libGLES_CM/Buffer.h
+++ b/src/GLES2/libGLES_CM/Buffer.h
@@ -25,7 +25,7 @@
 #include <cstddef>

 #include <vector>

 

-namespace gl

+namespace es1

 {

 class Buffer : public RefCountObject

 {

diff --git a/src/GLES2/libGLES_CM/Context.cpp b/src/GLES2/libGLES_CM/Context.cpp
index a4f7a2b..e885d3f 100644
--- a/src/GLES2/libGLES_CM/Context.cpp
+++ b/src/GLES2/libGLES_CM/Context.cpp
@@ -9,7 +9,7 @@
 // or implied, including but not limited to any patent rights, are granted to you.

 //

 

-// Context.cpp: Implements the gl::Context class, managing all GL state and performing

+// Context.cpp: Implements the es1::Context class, managing all GL state and performing

 // rendering operations. It is the GLES2 specific implementation of EGLContext.

 

 #include "Context.h"

@@ -34,7 +34,7 @@
 #undef near

 #undef far

 

-namespace gl

+namespace es1

 {

 Device *Context::device = 0;

 

@@ -2214,7 +2214,7 @@
 

 void Context::bindTexImage(egl::Surface *surface)

 {

-	gl::Texture2D *textureObject = getTexture2D();

+	es1::Texture2D *textureObject = getTexture2D();

 

     if(textureObject)

     {

@@ -2286,13 +2286,13 @@
 {

     if(target == EGL_GL_TEXTURE_2D_KHR)

     {

-        gl::Texture *texture = getTexture(name);

+        es1::Texture *texture = getTexture(name);

 

         return texture->createSharedImage(GL_TEXTURE_2D, textureLevel);

     }

     else if(target == EGL_GL_RENDERBUFFER_KHR)

     {

-        gl::Renderbuffer *renderbuffer = getRenderbuffer(name);

+        es1::Renderbuffer *renderbuffer = getRenderbuffer(name);

 

         return renderbuffer->createSharedImage();

     }

@@ -2306,7 +2306,7 @@
 	if(!device)

 	{

 		sw::Context *context = new sw::Context();

-		device = new gl::Device(context);

+		device = new es1::Device(context);

 	}

 

 	return device;

@@ -2317,8 +2317,8 @@
 // Exported functions for use by EGL

 extern "C"

 {

-	gl::Context *glCreateContext(const egl::Config *config, const gl::Context *shareContext)

+	es1::Context *glCreateContext(const egl::Config *config, const es1::Context *shareContext)

 	{

-		return new gl::Context(config, shareContext);

+		return new es1::Context(config, shareContext);

 	}

 }

diff --git a/src/GLES2/libGLES_CM/Context.h b/src/GLES2/libGLES_CM/Context.h
index 962a410..ab74b3c 100644
--- a/src/GLES2/libGLES_CM/Context.h
+++ b/src/GLES2/libGLES_CM/Context.h
@@ -37,7 +37,7 @@
 class Config;

 }

 

-namespace gl

+namespace es1

 {

 struct TranslatedAttribute;

 struct TranslatedIndexData;

diff --git a/src/GLES2/libGLES_CM/Device.cpp b/src/GLES2/libGLES_CM/Device.cpp
index 387b8dd..a814bf6 100644
--- a/src/GLES2/libGLES_CM/Device.cpp
+++ b/src/GLES2/libGLES_CM/Device.cpp
@@ -27,7 +27,7 @@
 

 bool localShaderConstants = false;

 

-namespace gl

+namespace es1

 {

 	using namespace sw;

 

diff --git a/src/GLES2/libGLES_CM/Device.hpp b/src/GLES2/libGLES_CM/Device.hpp
index d8c4eff..9ccdeca 100644
--- a/src/GLES2/libGLES_CM/Device.hpp
+++ b/src/GLES2/libGLES_CM/Device.hpp
@@ -19,7 +19,7 @@
 	class Image;

 }

 

-namespace gl

+namespace es1

 {

 	class Texture;

 	class Image;

diff --git a/src/GLES2/libGLES_CM/Framebuffer.cpp b/src/GLES2/libGLES_CM/Framebuffer.cpp
index 3af1fcb..3692b83 100644
--- a/src/GLES2/libGLES_CM/Framebuffer.cpp
+++ b/src/GLES2/libGLES_CM/Framebuffer.cpp
@@ -19,7 +19,7 @@
 #include "Texture.h"
 #include "utilities.h"
 
-namespace gl
+namespace es1
 {
 
 Framebuffer::Framebuffer()
@@ -245,7 +245,7 @@
 
 		if(mColorbufferType == GL_RENDERBUFFER_OES)
 		{
-			if(!gl::IsColorRenderable(colorbuffer->getFormat()))
+			if(!es1::IsColorRenderable(colorbuffer->getFormat()))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
 			}
@@ -262,7 +262,7 @@
 				return GL_FRAMEBUFFER_UNSUPPORTED_OES;
 			}
 
-			if(gl::IsDepthTexture(format) || gl::IsStencilTexture(format))
+			if(es1::IsDepthTexture(format) || es1::IsStencilTexture(format))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
 			}
@@ -297,14 +297,14 @@
 
 		if(mDepthbufferType == GL_RENDERBUFFER_OES)
 		{
-			if(!gl::IsDepthRenderable(depthbuffer->getFormat()))
+			if(!es1::IsDepthRenderable(depthbuffer->getFormat()))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
 			}
 		}
 		else if(IsTextureTarget(mDepthbufferType))
 		{
-			if(!gl::IsDepthTexture(depthbuffer->getFormat()))
+			if(!es1::IsDepthTexture(depthbuffer->getFormat()))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
 			}
@@ -347,7 +347,7 @@
 
 		if(mStencilbufferType == GL_RENDERBUFFER_OES)
 		{
-			if(!gl::IsStencilRenderable(stencilbuffer->getFormat()))
+			if(!es1::IsStencilRenderable(stencilbuffer->getFormat()))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
 			}
@@ -356,7 +356,7 @@
 		{
 			GLenum internalformat = stencilbuffer->getFormat();
 
-			if(!gl::IsStencilTexture(internalformat))
+			if(!es1::IsStencilTexture(internalformat))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES;
 			}
diff --git a/src/GLES2/libGLES_CM/Framebuffer.h b/src/GLES2/libGLES_CM/Framebuffer.h
index 50c3920..7b038af 100644
--- a/src/GLES2/libGLES_CM/Framebuffer.h
+++ b/src/GLES2/libGLES_CM/Framebuffer.h
@@ -21,7 +21,7 @@
 #define GL_API

 #include <GLES/gl.h>

 

-namespace gl

+namespace es1

 {

 class Renderbuffer;

 class Colorbuffer;

diff --git a/src/GLES2/libGLES_CM/HandleAllocator.cpp b/src/GLES2/libGLES_CM/HandleAllocator.cpp
index 7db672a..52991c1 100644
--- a/src/GLES2/libGLES_CM/HandleAllocator.cpp
+++ b/src/GLES2/libGLES_CM/HandleAllocator.cpp
@@ -16,7 +16,7 @@
 
 #include "main.h"
 
-namespace gl
+namespace es1
 {
 
 HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1)
diff --git a/src/GLES2/libGLES_CM/HandleAllocator.h b/src/GLES2/libGLES_CM/HandleAllocator.h
index 82c94d6..448f82a 100644
--- a/src/GLES2/libGLES_CM/HandleAllocator.h
+++ b/src/GLES2/libGLES_CM/HandleAllocator.h
@@ -20,7 +20,7 @@
 

 #include <vector>

 

-namespace gl

+namespace es1

 {

 

 class HandleAllocator

diff --git a/src/GLES2/libGLES_CM/Image.cpp b/src/GLES2/libGLES_CM/Image.cpp
index a0d3895..5268845 100644
--- a/src/GLES2/libGLES_CM/Image.cpp
+++ b/src/GLES2/libGLES_CM/Image.cpp
@@ -19,7 +19,7 @@
 #define GL_GLEXT_PROTOTYPES
 #include <GLES/glext.h>
 
-namespace gl
+namespace es1
 {
 	static sw::Resource *getParentResource(Texture *texture)
 	{
diff --git a/src/GLES2/libGLES_CM/Image.hpp b/src/GLES2/libGLES_CM/Image.hpp
index f9ef9bb..8bc020e 100644
--- a/src/GLES2/libGLES_CM/Image.hpp
+++ b/src/GLES2/libGLES_CM/Image.hpp
@@ -18,7 +18,7 @@
 #define GL_API
 #include <GLES/gl.h>
 
-namespace gl
+namespace es1
 {
 	class Texture;
 
diff --git a/src/GLES2/libGLES_CM/IndexDataManager.cpp b/src/GLES2/libGLES_CM/IndexDataManager.cpp
index d4f7fac..25426dc 100644
--- a/src/GLES2/libGLES_CM/IndexDataManager.cpp
+++ b/src/GLES2/libGLES_CM/IndexDataManager.cpp
@@ -25,7 +25,7 @@
     enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };

 }

 

-namespace gl

+namespace es1

 {

 

 IndexDataManager::IndexDataManager()

diff --git a/src/GLES2/libGLES_CM/IndexDataManager.h b/src/GLES2/libGLES_CM/IndexDataManager.h
index 7d886a3..35306cd 100644
--- a/src/GLES2/libGLES_CM/IndexDataManager.h
+++ b/src/GLES2/libGLES_CM/IndexDataManager.h
@@ -20,7 +20,7 @@
 #define GL_API

 #include <GLES/gl.h>

 

-namespace gl

+namespace es1

 {

 

 struct TranslatedIndexData

diff --git a/src/GLES2/libGLES_CM/RefCountObject.cpp b/src/GLES2/libGLES_CM/RefCountObject.cpp
index b470ab2..8b26a16 100644
--- a/src/GLES2/libGLES_CM/RefCountObject.cpp
+++ b/src/GLES2/libGLES_CM/RefCountObject.cpp
@@ -18,7 +18,7 @@
 
 #include "Common/Thread.hpp"
 
-namespace gl
+namespace es1
 {
 
 RefCountObject::RefCountObject(GLuint id)
diff --git a/src/GLES2/libGLES_CM/RefCountObject.h b/src/GLES2/libGLES_CM/RefCountObject.h
index add878e..b391d4d 100644
--- a/src/GLES2/libGLES_CM/RefCountObject.h
+++ b/src/GLES2/libGLES_CM/RefCountObject.h
@@ -24,7 +24,7 @@
 
 #include <cstddef>
 
-namespace gl
+namespace es1
 {
 
 class RefCountObject
diff --git a/src/GLES2/libGLES_CM/Renderbuffer.cpp b/src/GLES2/libGLES_CM/Renderbuffer.cpp
index 4043a32..4d3dd9b 100644
--- a/src/GLES2/libGLES_CM/Renderbuffer.cpp
+++ b/src/GLES2/libGLES_CM/Renderbuffer.cpp
@@ -19,7 +19,7 @@
 #include "Texture.h"
 #include "utilities.h"
 
-namespace gl
+namespace es1
 {
 RenderbufferInterface::RenderbufferInterface()
 {
diff --git a/src/GLES2/libGLES_CM/Renderbuffer.h b/src/GLES2/libGLES_CM/Renderbuffer.h
index 17460b3..352bef9 100644
--- a/src/GLES2/libGLES_CM/Renderbuffer.h
+++ b/src/GLES2/libGLES_CM/Renderbuffer.h
@@ -23,7 +23,7 @@
 #define GL_API

 #include <GLES/gl.h>

 

-namespace gl

+namespace es1

 {

 class Texture2D;

 class Renderbuffer;

diff --git a/src/GLES2/libGLES_CM/ResourceManager.cpp b/src/GLES2/libGLES_CM/ResourceManager.cpp
index a25e085..a8689a3 100644
--- a/src/GLES2/libGLES_CM/ResourceManager.cpp
+++ b/src/GLES2/libGLES_CM/ResourceManager.cpp
@@ -18,7 +18,7 @@
 #include "Renderbuffer.h"
 #include "Texture.h"
 
-namespace gl
+namespace es1
 {
 ResourceManager::ResourceManager()
 {
diff --git a/src/GLES2/libGLES_CM/ResourceManager.h b/src/GLES2/libGLES_CM/ResourceManager.h
index 5e7be84..7fea42a 100644
--- a/src/GLES2/libGLES_CM/ResourceManager.h
+++ b/src/GLES2/libGLES_CM/ResourceManager.h
@@ -22,7 +22,7 @@
 

 #include <map>

 

-namespace gl

+namespace es1

 {

 class Buffer;

 class Texture;

diff --git a/src/GLES2/libGLES_CM/Texture.cpp b/src/GLES2/libGLES_CM/Texture.cpp
index 3898707..7f12933 100644
--- a/src/GLES2/libGLES_CM/Texture.cpp
+++ b/src/GLES2/libGLES_CM/Texture.cpp
@@ -25,7 +25,7 @@
 

 #include <algorithm>

 

-namespace gl

+namespace es1

 {

 

 Texture::Texture(GLuint id) : RefCountObject(id)

@@ -723,17 +723,17 @@
 // Exported functions for use by EGL

 extern "C"

 {

-	gl::Image *createBackBuffer(int width, int height, const egl::Config *config)

+	es1::Image *createBackBuffer(int width, int height, const egl::Config *config)

 	{

 		if(config)

 		{

-			return new gl::Image(0, width, height, config->mAlphaSize ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE);

+			return new es1::Image(0, width, height, config->mAlphaSize ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE);

 		}

 

 		return 0;

 	}

 

-	gl::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard)

+	es1::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard)

 	{

 		if(width == 0 || height == 0 || height > OUTLINE_RESOLUTION)

 		{

@@ -766,7 +766,7 @@
 			UNREACHABLE();

 		}

 

-		gl::Image *surface = new gl::Image(0, width, height, format, multiSampleDepth, lockable, true);

+		es1::Image *surface = new es1::Image(0, width, height, format, multiSampleDepth, lockable, true);

 

 		if(!surface)

 		{

diff --git a/src/GLES2/libGLES_CM/Texture.h b/src/GLES2/libGLES_CM/Texture.h
index a0d890d..553a00c 100644
--- a/src/GLES2/libGLES_CM/Texture.h
+++ b/src/GLES2/libGLES_CM/Texture.h
@@ -33,7 +33,7 @@
 class Config;

 }

 

-namespace gl

+namespace es1

 {

 class Framebuffer;

 

diff --git a/src/GLES2/libGLES_CM/VertexDataManager.cpp b/src/GLES2/libGLES_CM/VertexDataManager.cpp
index 3911fb2..65a7900 100644
--- a/src/GLES2/libGLES_CM/VertexDataManager.cpp
+++ b/src/GLES2/libGLES_CM/VertexDataManager.cpp
@@ -25,7 +25,7 @@
     enum {INITIAL_STREAM_BUFFER_SIZE = 1024 * 1024};

 }

 

-namespace gl

+namespace es1

 {

 

 VertexDataManager::VertexDataManager(Context *context) : mContext(context)

diff --git a/src/GLES2/libGLES_CM/VertexDataManager.h b/src/GLES2/libGLES_CM/VertexDataManager.h
index aae94b9..392e502 100644
--- a/src/GLES2/libGLES_CM/VertexDataManager.h
+++ b/src/GLES2/libGLES_CM/VertexDataManager.h
@@ -21,7 +21,7 @@
 #define GL_API

 #include <GLES/gl.h>

 

-namespace gl

+namespace es1

 {

 

 struct TranslatedAttribute

diff --git a/src/GLES2/libGLES_CM/libGLES_CM.cpp b/src/GLES2/libGLES_CM/libGLES_CM.cpp
index 650b93f..6d71b43 100644
--- a/src/GLES2/libGLES_CM/libGLES_CM.cpp
+++ b/src/GLES2/libGLES_CM/libGLES_CM.cpp
@@ -33,7 +33,7 @@
 

 static bool validImageSize(GLint level, GLsizei width, GLsizei height)

 {

-    if(level < 0 || level >= gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS || width < 0 || height < 0)

+    if(level < 0 || level >= es1::IMPLEMENTATION_MAX_TEXTURE_LEVELS || width < 0 || height < 0)

     {

         return false;

     }

@@ -41,7 +41,7 @@
     return true;

 }

 

-static bool validateSubImageParams(bool compressed, GLsizei width, GLsizei height, GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format, gl::Texture *texture)

+static bool validateSubImageParams(bool compressed, GLsizei width, GLsizei height, GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format, es1::Texture *texture)

 {

     if(!texture)

     {

@@ -101,10 +101,10 @@
             return false;

         }

         break;

-    case gl::IMPLEMENTATION_COLOR_READ_FORMAT:

+    case es1::IMPLEMENTATION_COLOR_READ_FORMAT:

         switch (type)

         {

-        case gl::IMPLEMENTATION_COLOR_READ_TYPE:

+        case es1::IMPLEMENTATION_COLOR_READ_TYPE:

             break;

         default:

             return false;

@@ -126,11 +126,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + gl::MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)

+            if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + es1::MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)

             {

                 return error(GL_INVALID_ENUM);

             }

@@ -160,7 +160,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -194,7 +194,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -218,7 +218,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -242,7 +242,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -262,11 +262,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::Texture *textureObject = context->getTexture(texture);

+            es1::Texture *textureObject = context->getTexture(texture);

 

             if(textureObject && textureObject->getTarget() != target && texture != 0)

             {

@@ -322,7 +322,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -417,7 +417,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -451,11 +451,11 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::Buffer *buffer;

+            es1::Buffer *buffer;

 

             switch(target)

             {

@@ -500,11 +500,11 @@
             return;

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::Buffer *buffer;

+            es1::Buffer *buffer;

 

             switch(target)

             {

@@ -548,11 +548,11 @@
             return error(GL_INVALID_ENUM, 0);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::Framebuffer *framebuffer = context->getFramebuffer();

+            es1::Framebuffer *framebuffer = context->getFramebuffer();

 

             return framebuffer->completeness();

         }

@@ -576,7 +576,7 @@
 			return error(GL_INVALID_VALUE);

 		}

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -596,7 +596,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -620,7 +620,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -644,7 +644,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -694,7 +694,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -749,11 +749,11 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-			if(level > gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

+			if(level > es1::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

             {

                 return error(GL_INVALID_VALUE);

             }

@@ -761,8 +761,8 @@
             switch(target)

             {

               case GL_TEXTURE_2D:

-                if(width > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

-                    height > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

+                if(width > (es1::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

+                    height > (es1::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

                 {

                     return error(GL_INVALID_VALUE);

                 }

@@ -771,14 +771,14 @@
                 return error(GL_INVALID_ENUM);

             }

 

-            if(imageSize != gl::ComputeCompressedSize(width, height, internalformat))

+            if(imageSize != es1::ComputeCompressedSize(width, height, internalformat))

             {

                 return error(GL_INVALID_VALUE);

             }

 

             if(target == GL_TEXTURE_2D)

             {

-                gl::Texture2D *texture = context->getTexture2D();

+                es1::Texture2D *texture = context->getTexture2D();

 

                 if(!texture)

                 {

@@ -806,7 +806,7 @@
 

     try

     {

-        if(!gl::IsTextureTarget(target))

+        if(!es1::IsTextureTarget(target))

         {

             return error(GL_INVALID_ENUM);

         }

@@ -834,16 +834,16 @@
             return;

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            if(level > gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

+            if(level > es1::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

             {

                 return error(GL_INVALID_VALUE);

             }

 

-            if(imageSize != gl::ComputeCompressedSize(width, height, format))

+            if(imageSize != es1::ComputeCompressedSize(width, height, format))

             {

                 return error(GL_INVALID_VALUE);

             }

@@ -856,7 +856,7 @@
 

             if(target == GL_TEXTURE_2D)

             {

-                gl::Texture2D *texture = context->getTexture2D();

+                es1::Texture2D *texture = context->getTexture2D();

 

                 if(validateSubImageParams(true, width, height, xoffset, yoffset, target, level, format, texture))

 				{

@@ -890,15 +890,15 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

             switch(target)

             {

               case GL_TEXTURE_2D:

-                if(width > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

-                   height > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

+                if(width > (es1::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

+                   height > (es1::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

                 {

                     return error(GL_INVALID_VALUE);

                 }

@@ -907,7 +907,7 @@
                 return error(GL_INVALID_ENUM);

             }

 

-            gl::Framebuffer *framebuffer = context->getFramebuffer();

+            es1::Framebuffer *framebuffer = context->getFramebuffer();

 

             if(framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE_OES)

             {

@@ -919,7 +919,7 @@
                 return error(GL_INVALID_OPERATION);

             }

 

-            gl::Renderbuffer *source = framebuffer->getColorbuffer();

+            es1::Renderbuffer *source = framebuffer->getColorbuffer();

             GLenum colorbufferFormat = source->getFormat();

 

             // [OpenGL ES 2.0.24] table 3.9

@@ -975,7 +975,7 @@
 

             if(target == GL_TEXTURE_2D)

             {

-                gl::Texture2D *texture = context->getTexture2D();

+                es1::Texture2D *texture = context->getTexture2D();

 

                 if(!texture)

                 {

@@ -1001,7 +1001,7 @@
 

     try

     {

-        if(!gl::IsTextureTarget(target))

+        if(!es1::IsTextureTarget(target))

         {

             return error(GL_INVALID_ENUM);

         }

@@ -1021,16 +1021,16 @@
             return;

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            if(level > gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

+            if(level > es1::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

             {

                 return error(GL_INVALID_VALUE);

             }

 

-            gl::Framebuffer *framebuffer = context->getFramebuffer();

+            es1::Framebuffer *framebuffer = context->getFramebuffer();

 

             if(framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE_OES)

             {

@@ -1042,9 +1042,9 @@
                 return error(GL_INVALID_OPERATION);

             }

 

-            gl::Renderbuffer *source = framebuffer->getColorbuffer();

+            es1::Renderbuffer *source = framebuffer->getColorbuffer();

             GLenum colorbufferFormat = source->getFormat();

-            gl::Texture *texture = NULL;

+            es1::Texture *texture = NULL;

 

             if(target == GL_TEXTURE_2D)

             {

@@ -1126,7 +1126,7 @@
           case GL_BACK:

           case GL_FRONT_AND_BACK:

             {

-                gl::Context *context = gl::getContext();

+                es1::Context *context = es1::getContext();

 

                 if(context)

                 {

@@ -1155,7 +1155,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1182,7 +1182,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1212,7 +1212,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1239,7 +1239,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1279,7 +1279,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1298,7 +1298,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1322,7 +1322,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1341,7 +1341,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1383,7 +1383,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1408,7 +1408,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1437,7 +1437,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1474,7 +1474,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1493,7 +1493,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1518,11 +1518,11 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::Framebuffer *framebuffer = context->getFramebuffer();

+            es1::Framebuffer *framebuffer = context->getFramebuffer();

             GLuint framebufferHandle = context->getFramebufferHandle();

             

             if(!framebuffer || (framebufferHandle == 0 && renderbuffer != 0))

@@ -1574,7 +1574,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1584,7 +1584,7 @@
             }

             else

             {

-                gl::Texture *tex = context->getTexture(texture);

+                es1::Texture *tex = context->getTexture(texture);

 

                 if(tex == NULL)

                 {

@@ -1614,7 +1614,7 @@
                 }

             }

 

-            gl::Framebuffer *framebuffer = context->getFramebuffer();

+            es1::Framebuffer *framebuffer = context->getFramebuffer();

             GLuint framebufferHandle = context->getFramebufferHandle();

 

             if(framebufferHandle == 0 || !framebuffer)

@@ -1667,7 +1667,7 @@
           case GL_CW:

           case GL_CCW:

             {

-                gl::Context *context = gl::getContext();

+                es1::Context *context = es1::getContext();

 

                 if(context)

                 {

@@ -1701,11 +1701,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::Texture *texture;

+            es1::Texture *texture;

 

             switch(target)

             {

@@ -1741,7 +1741,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1768,7 +1768,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1795,7 +1795,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1822,7 +1822,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1844,7 +1844,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1858,7 +1858,7 @@
                 return error(GL_INVALID_OPERATION);

             }

 

-            gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getRenderbufferHandle());

+            es1::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getRenderbufferHandle());

 

             switch(pname)

             {

@@ -1888,7 +1888,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -1955,11 +1955,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::Buffer *buffer;

+            es1::Buffer *buffer;

 

             switch(target)

             {

@@ -2010,7 +2010,7 @@
 {

     TRACE("()");

 

-    gl::Context *context = gl::getContext();

+    es1::Context *context = es1::getContext();

 

     if(context)

     {

@@ -2031,7 +2031,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -2096,7 +2096,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -2110,7 +2110,7 @@
                 return error(GL_INVALID_OPERATION);

             }

 

-            gl::Framebuffer *framebuffer = context->getFramebuffer();

+            es1::Framebuffer *framebuffer = context->getFramebuffer();

             

             GLenum attachmentType;

             GLuint attachmentHandle;

@@ -2137,7 +2137,7 @@
             {

                 attachmentObjectType = attachmentType;

             }

-            else if(gl::IsTextureTarget(attachmentType))

+            else if(es1::IsTextureTarget(attachmentType))

             {

                 attachmentObjectType = GL_TEXTURE;

             }

@@ -2185,7 +2185,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -2279,7 +2279,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         switch(name)

         {

@@ -2340,11 +2340,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::Texture *texture;

+            es1::Texture *texture;

 

             switch(target)

             {

@@ -2395,11 +2395,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::Texture *texture;

+            es1::Texture *texture;

 

             switch(target)

             {

@@ -2480,7 +2480,7 @@
             return error(GL_INVALID_ENUM); 

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

         switch(target)

         {

           case GL_GENERATE_MIPMAP_HINT:

@@ -2502,11 +2502,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context && buffer)

         {

-            gl::Buffer *bufferObject = context->getBuffer(buffer);

+            es1::Buffer *bufferObject = context->getBuffer(buffer);

 

             if(bufferObject)

             {

@@ -2528,7 +2528,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -2562,11 +2562,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context && framebuffer)

         {

-            gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer);

+            es1::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer);

 

             if(framebufferObject)

             {

@@ -2588,11 +2588,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context && texture)

         {

-            gl::Texture *textureObject = context->getTexture(texture);

+            es1::Texture *textureObject = context->getTexture(texture);

 

             if(textureObject)

             {

@@ -2614,11 +2614,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context && renderbuffer)

         {

-            gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);

+            es1::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);

 

             if(renderbufferObject)

             {

@@ -2685,7 +2685,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -2799,7 +2799,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -2870,7 +2870,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -2916,7 +2916,7 @@
             return error(GL_INVALID_OPERATION);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -2944,7 +2944,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        if(!gl::IsColorRenderable(internalformat) && !gl::IsDepthRenderable(internalformat) && !gl::IsStencilRenderable(internalformat))

+        if(!es1::IsColorRenderable(internalformat) && !es1::IsDepthRenderable(internalformat) && !es1::IsStencilRenderable(internalformat))

         {

             return error(GL_INVALID_ENUM);

         }

@@ -2954,12 +2954,12 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            if(width > gl::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE || 

-               height > gl::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE)

+            if(width > es1::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE || 

+               height > es1::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE)

             {

                 return error(GL_INVALID_VALUE);

             }

@@ -2973,20 +2973,20 @@
             switch(internalformat)

             {

             case GL_DEPTH_COMPONENT16_OES:

-                context->setRenderbufferStorage(new gl::Depthbuffer(width, height, 0));

+                context->setRenderbufferStorage(new es1::Depthbuffer(width, height, 0));

                 break;

             case GL_RGBA4_OES:

             case GL_RGB5_A1_OES:

             case GL_RGB565_OES:

             case GL_RGB8_OES:

             case GL_RGBA8_OES:

-                context->setRenderbufferStorage(new gl::Colorbuffer(width, height, internalformat, 0));

+                context->setRenderbufferStorage(new es1::Colorbuffer(width, height, internalformat, 0));

                 break;

             case GL_STENCIL_INDEX8_OES:

-                context->setRenderbufferStorage(new gl::Stencilbuffer(width, height, 0));

+                context->setRenderbufferStorage(new es1::Stencilbuffer(width, height, 0));

                 break;

             case GL_DEPTH24_STENCIL8_OES:

-                context->setRenderbufferStorage(new gl::DepthStencilbuffer(width, height, 0));

+                context->setRenderbufferStorage(new es1::DepthStencilbuffer(width, height, 0));

                 break;

             default:

                 return error(GL_INVALID_ENUM);

@@ -3015,11 +3015,11 @@
 

     try

     {

-        gl::Context* context = gl::getContext();

+        es1::Context* context = es1::getContext();

 

         if(context)

         {

-            context->setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE);

+            context->setSampleCoverageParams(es1::clamp01(value), invert == GL_TRUE);

         }

     }

     catch(std::bad_alloc&)

@@ -3054,7 +3054,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context* context = gl::getContext();

+        es1::Context* context = es1::getContext();

 

         if(context)

         {

@@ -3093,7 +3093,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -3112,7 +3112,7 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -3176,7 +3176,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -3310,15 +3310,15 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

             switch(target)

             {

               case GL_TEXTURE_2D:

-                if(width > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

-                   height > (gl::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

+                if(width > (es1::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

+                   height > (es1::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

                 {

                     return error(GL_INVALID_VALUE);

                 }

@@ -3342,7 +3342,7 @@
 			

             if(target == GL_TEXTURE_2D)

             {

-                gl::Texture2D *texture = context->getTexture2D();

+                es1::Texture2D *texture = context->getTexture2D();

 

                 if(!texture)

                 {

@@ -3366,11 +3366,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::Texture *texture;

+            es1::Texture *texture;

 

             switch(target)

             {

@@ -3438,11 +3438,11 @@
 

     try

     {

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::Texture *texture;

+            es1::Texture *texture;

 

             switch(target)

             {

@@ -3524,7 +3524,7 @@
 

     try

     {

-        if(!gl::IsTextureTarget(target))

+        if(!es1::IsTextureTarget(target))

         {

             return error(GL_INVALID_ENUM);

         }

@@ -3539,7 +3539,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        if(!gl::CheckTextureFormatType(format, type))

+        if(!es1::CheckTextureFormatType(format, type))

         {

             return error(GL_INVALID_ENUM);

         }

@@ -3549,18 +3549,18 @@
             return;

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            if(level > gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

+            if(level > es1::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

             {

                 return error(GL_INVALID_VALUE);

             }

 

             if(target == GL_TEXTURE_2D)

             {

-                gl::Texture2D *texture = context->getTexture2D();

+                es1::Texture2D *texture = context->getTexture2D();

 

                 if(validateSubImageParams(false, width, height, xoffset, yoffset, target, level, format, texture))

 				{

@@ -3602,7 +3602,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

@@ -3634,18 +3634,18 @@
             return error(GL_INVALID_OPERATION);

         }

 

-        gl::Context *context = gl::getContext();

+        es1::Context *context = es1::getContext();

 

         if(context)

         {

-            gl::TextureExternal *texture = context->getTextureExternal();

+            es1::TextureExternal *texture = context->getTextureExternal();

 

             if(!texture)

             {

                 return error(GL_INVALID_OPERATION);

             }

 

-            gl::Image *glImage = static_cast<gl::Image*>(image);

+            es1::Image *glImage = static_cast<es1::Image*>(image);

 

             texture->setImage(glImage);

         }

diff --git a/src/GLES2/libGLES_CM/main.cpp b/src/GLES2/libGLES_CM/main.cpp
index 050a29d..8de1b70 100644
--- a/src/GLES2/libGLES_CM/main.cpp
+++ b/src/GLES2/libGLES_CM/main.cpp
@@ -89,15 +89,15 @@
 }

 #endif

 

-namespace gl

+namespace es1

 {

-gl::Context *getContext()

+es1::Context *getContext()

 {

 	egl::Context *context = egl::getCurrentContext();

 	

 	if(context && context->getClientVersion() == 1)

 	{

-		return static_cast<gl::Context*>(context);

+		return static_cast<es1::Context*>(context);

 	}

 	

 	return 0;

@@ -119,7 +119,7 @@
 // Records an error code

 void error(GLenum errorCode)

 {

-    gl::Context *context = gl::getContext();

+    es1::Context *context = es1::getContext();

 

     if(context)

     {

diff --git a/src/GLES2/libGLES_CM/main.h b/src/GLES2/libGLES_CM/main.h
index 8aefa7e..4b5648a 100644
--- a/src/GLES2/libGLES_CM/main.h
+++ b/src/GLES2/libGLES_CM/main.h
@@ -24,7 +24,7 @@
 #define GL_GLEXT_PROTOTYPES
 #include <GLES/glext.h>
 
-namespace gl
+namespace es1
 {
 	Context *getContext();
 	egl::Display *getDisplay();
diff --git a/src/GLES2/libGLES_CM/mathutil.h b/src/GLES2/libGLES_CM/mathutil.h
index 61cbac9..8f93020 100644
--- a/src/GLES2/libGLES_CM/mathutil.h
+++ b/src/GLES2/libGLES_CM/mathutil.h
@@ -18,7 +18,7 @@
 
 #include <math.h>
 
-namespace gl
+namespace es1
 {
 inline bool isPow2(int x)
 {
diff --git a/src/GLES2/libGLES_CM/utilities.cpp b/src/GLES2/libGLES_CM/utilities.cpp
index 2517a73..8a6312f 100644
--- a/src/GLES2/libGLES_CM/utilities.cpp
+++ b/src/GLES2/libGLES_CM/utilities.cpp
@@ -20,7 +20,7 @@
 #include <limits>

 #include <stdio.h>

 

-namespace gl

+namespace es1

 {

 	GLsizei ComputePitch(GLsizei width, GLenum format, GLenum type, GLint alignment)

 	{

@@ -280,7 +280,7 @@
 		return sw::STENCIL_ALWAYS;

 	}

 

-	sw::Color<float> ConvertColor(gl::Color color)

+	sw::Color<float> ConvertColor(es1::Color color)

 	{

 		return sw::Color<float>(color.red, color.green, color.blue, color.alpha);

 	}

@@ -428,36 +428,36 @@
 		}

 	}

 

-	bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,  gl::PrimitiveType &swPrimitiveType, int &primitiveCount)

+	bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,  es1::PrimitiveType &swPrimitiveType, int &primitiveCount)

 	{

 		switch(primitiveType)

 		{

 		case GL_POINTS:

-			swPrimitiveType = gl::DRAW_POINTLIST;

+			swPrimitiveType = es1::DRAW_POINTLIST;

 			primitiveCount = elementCount;

 			break;

 		case GL_LINES:

-			swPrimitiveType = gl::DRAW_LINELIST;

+			swPrimitiveType = es1::DRAW_LINELIST;

 			primitiveCount = elementCount / 2;

 			break;

 		case GL_LINE_LOOP:

-			swPrimitiveType = gl::DRAW_LINELOOP;

+			swPrimitiveType = es1::DRAW_LINELOOP;

 			primitiveCount = elementCount;

 			break;

 		case GL_LINE_STRIP:

-			swPrimitiveType = gl::DRAW_LINESTRIP;

+			swPrimitiveType = es1::DRAW_LINESTRIP;

 			primitiveCount = elementCount - 1;

 			break;

 		case GL_TRIANGLES:

-			swPrimitiveType = gl::DRAW_TRIANGLELIST;

+			swPrimitiveType = es1::DRAW_TRIANGLELIST;

 			primitiveCount = elementCount / 3;

 			break;

 		case GL_TRIANGLE_STRIP:

-			swPrimitiveType = gl::DRAW_TRIANGLESTRIP;

+			swPrimitiveType = es1::DRAW_TRIANGLESTRIP;

 			primitiveCount = elementCount - 2;

 			break;

 		case GL_TRIANGLE_FAN:

-			swPrimitiveType = gl::DRAW_TRIANGLEFAN;

+			swPrimitiveType = es1::DRAW_TRIANGLEFAN;

 			primitiveCount = elementCount - 2;

 			break;

 		default:

diff --git a/src/GLES2/libGLES_CM/utilities.h b/src/GLES2/libGLES_CM/utilities.h
index 9a52ae3..4f6421f 100644
--- a/src/GLES2/libGLES_CM/utilities.h
+++ b/src/GLES2/libGLES_CM/utilities.h
@@ -25,7 +25,7 @@
 

 #include <string>

 

-namespace gl

+namespace es1

 {

 	struct Color;

 

@@ -50,7 +50,7 @@
 {

 	sw::DepthCompareMode ConvertDepthComparison(GLenum comparison);

 	sw::StencilCompareMode ConvertStencilComparison(GLenum comparison);

-	sw::Color<float> ConvertColor(gl::Color color);

+	sw::Color<float> ConvertColor(es1::Color color);

 	sw::BlendFactor ConvertBlendFunc(GLenum blend);

 	sw::BlendOperation ConvertBlendOp(GLenum blendOp);

 	sw::StencilOperation ConvertStencilOp(GLenum stencilOp);

@@ -59,7 +59,7 @@
 	unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha);

 	sw::FilterType ConvertMagFilter(GLenum magFilter);

 	void ConvertMinFilter(GLenum texFilter, sw::FilterType *minFilter, sw::MipmapType *mipFilter, float maxAnisotropy);

-	bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,  gl::PrimitiveType &swPrimitiveType, int &primitiveCount);

+	bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,  es1::PrimitiveType &swPrimitiveType, int &primitiveCount);

 	sw::Format ConvertRenderbufferFormat(GLenum format);

 }

 

diff --git a/src/GLES2/libGLESv2/Buffer.cpp b/src/GLES2/libGLESv2/Buffer.cpp
index b198c85..78411ac 100644
--- a/src/GLES2/libGLESv2/Buffer.cpp
+++ b/src/GLES2/libGLESv2/Buffer.cpp
@@ -19,7 +19,7 @@
 #include "VertexDataManager.h"
 #include "IndexDataManager.h"
 
-namespace gl2
+namespace es2
 {
 
 Buffer::Buffer(GLuint id) : RefCountObject(id)
diff --git a/src/GLES2/libGLESv2/Buffer.h b/src/GLES2/libGLESv2/Buffer.h
index 7fe913c..1c4b4b0 100644
--- a/src/GLES2/libGLESv2/Buffer.h
+++ b/src/GLES2/libGLESv2/Buffer.h
@@ -25,7 +25,7 @@
 #include <cstddef>

 #include <vector>

 

-namespace gl2

+namespace es2

 {

 class Buffer : public RefCountObject

 {

diff --git a/src/GLES2/libGLESv2/Context.cpp b/src/GLES2/libGLESv2/Context.cpp
index 9ef1f0b..6c05383 100644
--- a/src/GLES2/libGLESv2/Context.cpp
+++ b/src/GLES2/libGLESv2/Context.cpp
@@ -9,7 +9,7 @@
 // or implied, including but not limited to any patent rights, are granted to you.

 //

 

-// Context.cpp: Implements the gl2::Context class, managing all GL state and performing

+// Context.cpp: Implements the es2::Context class, managing all GL state and performing

 // rendering operations. It is the GLES2 specific implementation of EGLContext.

 

 #include "Context.h"

@@ -37,7 +37,7 @@
 #undef near

 #undef far

 

-namespace gl2

+namespace es2

 {

 Device *Context::device = 0;

 

@@ -3027,7 +3027,7 @@
 

 void Context::bindTexImage(egl::Surface *surface)

 {

-	gl2::Texture2D *textureObject = getTexture2D();

+	es2::Texture2D *textureObject = getTexture2D();

 

     if(textureObject)

     {

@@ -3058,14 +3058,14 @@
         return EGL_BAD_PARAMETER;

     }

 	

-    if(textureLevel >= gl2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

+    if(textureLevel >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

     {

         return EGL_BAD_MATCH;

     }

 

     if(textureTarget != GL_NONE)

     {

-        gl2::Texture *texture = getTexture(name);

+        es2::Texture *texture = getTexture(name);

 

         if(!texture || texture->getTarget() != textureTarget)

         {

@@ -3089,7 +3089,7 @@
     }

     else if(target == EGL_GL_RENDERBUFFER_KHR)

     {

-        gl2::Renderbuffer *renderbuffer = getRenderbuffer(name);

+        es2::Renderbuffer *renderbuffer = getRenderbuffer(name);

 

         if(!renderbuffer)

         {

@@ -3123,13 +3123,13 @@
 

     if(textureTarget != GL_NONE)

     {

-        gl2::Texture *texture = getTexture(name);

+        es2::Texture *texture = getTexture(name);

 

         return texture->createSharedImage(textureTarget, textureLevel);

     }

     else if(target == EGL_GL_RENDERBUFFER_KHR)

     {

-        gl2::Renderbuffer *renderbuffer = getRenderbuffer(name);

+        es2::Renderbuffer *renderbuffer = getRenderbuffer(name);

 

         return renderbuffer->createSharedImage();

     }

@@ -3143,7 +3143,7 @@
 	if(!device)

 	{

 		sw::Context *context = new sw::Context();

-		device = new gl2::Device(context);

+		device = new es2::Device(context);

 	}

 

 	return device;

@@ -3154,8 +3154,8 @@
 // Exported functions for use by EGL

 extern "C"

 {

-	gl2::Context *glCreateContext(const egl::Config *config, const gl2::Context *shareContext)

+	es2::Context *glCreateContext(const egl::Config *config, const es2::Context *shareContext)

 	{

-		return new gl2::Context(config, shareContext);

+		return new es2::Context(config, shareContext);

 	}

 }

diff --git a/src/GLES2/libGLESv2/Context.h b/src/GLES2/libGLESv2/Context.h
index 7eb8c90..073c97d 100644
--- a/src/GLES2/libGLESv2/Context.h
+++ b/src/GLES2/libGLESv2/Context.h
@@ -38,7 +38,7 @@
 class Config;

 }

 

-namespace gl2

+namespace es2

 {

 struct TranslatedAttribute;

 struct TranslatedIndexData;

diff --git a/src/GLES2/libGLESv2/Device.cpp b/src/GLES2/libGLESv2/Device.cpp
index da271cf..2ff7774 100644
--- a/src/GLES2/libGLESv2/Device.cpp
+++ b/src/GLES2/libGLESv2/Device.cpp
@@ -27,7 +27,7 @@
 

 bool localShaderConstants = false;

 

-namespace gl2

+namespace es2

 {

 	using namespace sw;

 

diff --git a/src/GLES2/libGLESv2/Device.hpp b/src/GLES2/libGLESv2/Device.hpp
index e5d2b98..92a3a11 100644
--- a/src/GLES2/libGLESv2/Device.hpp
+++ b/src/GLES2/libGLESv2/Device.hpp
@@ -19,7 +19,7 @@
 	class Image;

 }

 

-namespace gl2

+namespace es2

 {

 	class Texture;

 	class Image;

diff --git a/src/GLES2/libGLESv2/Fence.cpp b/src/GLES2/libGLESv2/Fence.cpp
index a54a2f1..e79077b 100644
--- a/src/GLES2/libGLESv2/Fence.cpp
+++ b/src/GLES2/libGLESv2/Fence.cpp
@@ -16,7 +16,7 @@
 #include "main.h"

 #include "Common/Thread.hpp"

 

-namespace gl2

+namespace es2

 {

 

 Fence::Fence()

diff --git a/src/GLES2/libGLESv2/Fence.h b/src/GLES2/libGLESv2/Fence.h
index bd438da..a2b5bab 100644
--- a/src/GLES2/libGLESv2/Fence.h
+++ b/src/GLES2/libGLESv2/Fence.h
@@ -17,7 +17,7 @@
 #define GL_APICALL

 #include <GLES2/gl2.h>

 

-namespace gl2

+namespace es2

 {

 

 class Fence

diff --git a/src/GLES2/libGLESv2/Framebuffer.cpp b/src/GLES2/libGLESv2/Framebuffer.cpp
index ead9a8d..c98973c 100644
--- a/src/GLES2/libGLESv2/Framebuffer.cpp
+++ b/src/GLES2/libGLESv2/Framebuffer.cpp
@@ -19,7 +19,7 @@
 #include "Texture.h"
 #include "utilities.h"
 
-namespace gl2
+namespace es2
 {
 
 Framebuffer::Framebuffer()
@@ -245,7 +245,7 @@
 
 		if(mColorbufferType == GL_RENDERBUFFER)
 		{
-			if(!gl2::IsColorRenderable(colorbuffer->getFormat()))
+			if(!es2::IsColorRenderable(colorbuffer->getFormat()))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
 			}
@@ -262,7 +262,7 @@
 				return GL_FRAMEBUFFER_UNSUPPORTED;
 			}
 
-			if(gl2::IsDepthTexture(format) || gl2::IsStencilTexture(format))
+			if(es2::IsDepthTexture(format) || es2::IsStencilTexture(format))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
 			}
@@ -297,14 +297,14 @@
 
 		if(mDepthbufferType == GL_RENDERBUFFER)
 		{
-			if(!gl2::IsDepthRenderable(depthbuffer->getFormat()))
+			if(!es2::IsDepthRenderable(depthbuffer->getFormat()))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
 			}
 		}
 		else if(IsTextureTarget(mDepthbufferType))
 		{
-			if(!gl2::IsDepthTexture(depthbuffer->getFormat()))
+			if(!es2::IsDepthTexture(depthbuffer->getFormat()))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
 			}
@@ -347,7 +347,7 @@
 
 		if(mStencilbufferType == GL_RENDERBUFFER)
 		{
-			if(!gl2::IsStencilRenderable(stencilbuffer->getFormat()))
+			if(!es2::IsStencilRenderable(stencilbuffer->getFormat()))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
 			}
@@ -356,7 +356,7 @@
 		{
 			GLenum internalformat = stencilbuffer->getFormat();
 
-			if(!gl2::IsStencilTexture(internalformat))
+			if(!es2::IsStencilTexture(internalformat))
 			{
 				return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
 			}
diff --git a/src/GLES2/libGLESv2/Framebuffer.h b/src/GLES2/libGLESv2/Framebuffer.h
index 2b0a839..df29240 100644
--- a/src/GLES2/libGLESv2/Framebuffer.h
+++ b/src/GLES2/libGLESv2/Framebuffer.h
@@ -21,7 +21,7 @@
 #define GL_APICALL

 #include <GLES2/gl2.h>

 

-namespace gl2

+namespace es2

 {

 class Renderbuffer;

 class Colorbuffer;

diff --git a/src/GLES2/libGLESv2/HandleAllocator.cpp b/src/GLES2/libGLESv2/HandleAllocator.cpp
index 38aeb92..85813f2 100644
--- a/src/GLES2/libGLESv2/HandleAllocator.cpp
+++ b/src/GLES2/libGLESv2/HandleAllocator.cpp
@@ -16,7 +16,7 @@
 
 #include "main.h"
 
-namespace gl2
+namespace es2
 {
 
 HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1)
diff --git a/src/GLES2/libGLESv2/HandleAllocator.h b/src/GLES2/libGLESv2/HandleAllocator.h
index 1259246..8079d12 100644
--- a/src/GLES2/libGLESv2/HandleAllocator.h
+++ b/src/GLES2/libGLESv2/HandleAllocator.h
@@ -20,7 +20,7 @@
 

 #include <vector>

 

-namespace gl2

+namespace es2

 {

 

 class HandleAllocator

diff --git a/src/GLES2/libGLESv2/Image.cpp b/src/GLES2/libGLESv2/Image.cpp
index 138253b..541923f 100644
--- a/src/GLES2/libGLESv2/Image.cpp
+++ b/src/GLES2/libGLESv2/Image.cpp
@@ -18,7 +18,7 @@
 
 #include <GLES2/gl2ext.h>
 
-namespace gl2
+namespace es2
 {
 	static sw::Resource *getParentResource(Texture *texture)
 	{
diff --git a/src/GLES2/libGLESv2/Image.hpp b/src/GLES2/libGLESv2/Image.hpp
index c07ba10..70baa6d 100644
--- a/src/GLES2/libGLESv2/Image.hpp
+++ b/src/GLES2/libGLESv2/Image.hpp
@@ -18,7 +18,7 @@
 #define GL_APICALL
 #include <GLES2/gl2.h>
 
-namespace gl2
+namespace es2
 {
 	class Texture;
 
diff --git a/src/GLES2/libGLESv2/IndexDataManager.cpp b/src/GLES2/libGLESv2/IndexDataManager.cpp
index 1493d70..a2b468c 100644
--- a/src/GLES2/libGLESv2/IndexDataManager.cpp
+++ b/src/GLES2/libGLESv2/IndexDataManager.cpp
@@ -25,7 +25,7 @@
     enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };

 }

 

-namespace gl2

+namespace es2

 {

 

 IndexDataManager::IndexDataManager()

diff --git a/src/GLES2/libGLESv2/IndexDataManager.h b/src/GLES2/libGLESv2/IndexDataManager.h
index 3feb36b..0bab66e 100644
--- a/src/GLES2/libGLESv2/IndexDataManager.h
+++ b/src/GLES2/libGLESv2/IndexDataManager.h
@@ -20,7 +20,7 @@
 #define GL_APICALL

 #include <GLES2/gl2.h>

 

-namespace gl2

+namespace es2

 {

 

 struct TranslatedIndexData

diff --git a/src/GLES2/libGLESv2/Program.cpp b/src/GLES2/libGLESv2/Program.cpp
index c1378d5..03042fa 100644
--- a/src/GLES2/libGLESv2/Program.cpp
+++ b/src/GLES2/libGLESv2/Program.cpp
@@ -24,7 +24,7 @@
 #include <string>

 #include <stdlib.h>

 

-namespace gl2

+namespace es2

 {

 	unsigned int Program::currentSerial = 1;

 

diff --git a/src/GLES2/libGLESv2/Program.h b/src/GLES2/libGLESv2/Program.h
index ac2d2cf..dd87fb2 100644
--- a/src/GLES2/libGLESv2/Program.h
+++ b/src/GLES2/libGLESv2/Program.h
@@ -24,7 +24,7 @@
 #include <vector>

 #include <set>

 

-namespace gl2

+namespace es2

 {

 	class Device;

 	class ResourceManager;

@@ -163,7 +163,7 @@
 		static unsigned int issueSerial();

 

 	private:

-		gl2::Device *device;

+		es2::Device *device;

 		FragmentShader *fragmentShader;

 		VertexShader *vertexShader;

 

diff --git a/src/GLES2/libGLESv2/Query.cpp b/src/GLES2/libGLESv2/Query.cpp
index a1ee93e..97c4efd 100644
--- a/src/GLES2/libGLESv2/Query.cpp
+++ b/src/GLES2/libGLESv2/Query.cpp
@@ -9,14 +9,14 @@
 // or implied, including but not limited to any patent rights, are granted to you.

 //

 

-// Query.cpp: Implements the gl2::Query class

+// Query.cpp: Implements the es2::Query class

 

 #include "Query.h"

 

 #include "main.h"

 #include "Common/Thread.hpp"

 

-namespace gl2

+namespace es2

 {

 

 Query::Query(GLuint id, GLenum type) : RefCountObject(id)

diff --git a/src/GLES2/libGLESv2/Query.h b/src/GLES2/libGLESv2/Query.h
index 5b674c0..6811939 100644
--- a/src/GLES2/libGLESv2/Query.h
+++ b/src/GLES2/libGLESv2/Query.h
@@ -9,7 +9,7 @@
 // or implied, including but not limited to any patent rights, are granted to you.

 //

 

-// Query.h: Defines the gl2::Query class

+// Query.h: Defines the es2::Query class

 

 #ifndef LIBGLESV2_QUERY_H_

 #define LIBGLESV2_QUERY_H_

@@ -20,7 +20,7 @@
 #define GL_APICALL

 #include <GLES2/gl2.h>

 

-namespace gl2

+namespace es2

 {

 

 class Query : public RefCountObject

diff --git a/src/GLES2/libGLESv2/RefCountObject.cpp b/src/GLES2/libGLESv2/RefCountObject.cpp
index e386c3e..3dfbf03 100644
--- a/src/GLES2/libGLESv2/RefCountObject.cpp
+++ b/src/GLES2/libGLESv2/RefCountObject.cpp
@@ -18,7 +18,7 @@
 
 #include "Common/Thread.hpp"
 
-namespace gl2
+namespace es2
 {
 
 RefCountObject::RefCountObject(GLuint id)
diff --git a/src/GLES2/libGLESv2/RefCountObject.h b/src/GLES2/libGLESv2/RefCountObject.h
index e064a56..25eae02 100644
--- a/src/GLES2/libGLESv2/RefCountObject.h
+++ b/src/GLES2/libGLESv2/RefCountObject.h
@@ -24,7 +24,7 @@
 
 #include <cstddef>
 
-namespace gl2
+namespace es2
 {
 
 class RefCountObject
diff --git a/src/GLES2/libGLESv2/Renderbuffer.cpp b/src/GLES2/libGLESv2/Renderbuffer.cpp
index e7e96cd..a88d222 100644
--- a/src/GLES2/libGLESv2/Renderbuffer.cpp
+++ b/src/GLES2/libGLESv2/Renderbuffer.cpp
@@ -19,7 +19,7 @@
 #include "Texture.h"
 #include "utilities.h"
 
-namespace gl2
+namespace es2
 {
 RenderbufferInterface::RenderbufferInterface()
 {
diff --git a/src/GLES2/libGLESv2/Renderbuffer.h b/src/GLES2/libGLESv2/Renderbuffer.h
index 1a70a82..53bae78 100644
--- a/src/GLES2/libGLESv2/Renderbuffer.h
+++ b/src/GLES2/libGLESv2/Renderbuffer.h
@@ -23,7 +23,7 @@
 #define GL_APICALL

 #include <GLES2/gl2.h>

 

-namespace gl2

+namespace es2

 {

 class Texture2D;

 class TextureCubeMap;

diff --git a/src/GLES2/libGLESv2/ResourceManager.cpp b/src/GLES2/libGLESv2/ResourceManager.cpp
index 9fab537..c2b945c 100644
--- a/src/GLES2/libGLESv2/ResourceManager.cpp
+++ b/src/GLES2/libGLESv2/ResourceManager.cpp
@@ -20,7 +20,7 @@
 #include "Shader.h"
 #include "Texture.h"
 
-namespace gl2
+namespace es2
 {
 ResourceManager::ResourceManager()
 {
diff --git a/src/GLES2/libGLESv2/ResourceManager.h b/src/GLES2/libGLESv2/ResourceManager.h
index 40cd8b3..6a7a8d5 100644
--- a/src/GLES2/libGLESv2/ResourceManager.h
+++ b/src/GLES2/libGLESv2/ResourceManager.h
@@ -22,7 +22,7 @@
 

 #include <map>

 

-namespace gl2

+namespace es2

 {

 class Buffer;

 class Shader;

diff --git a/src/GLES2/libGLESv2/Shader.cpp b/src/GLES2/libGLESv2/Shader.cpp
index 59d240e..d88e561 100644
--- a/src/GLES2/libGLESv2/Shader.cpp
+++ b/src/GLES2/libGLESv2/Shader.cpp
@@ -22,7 +22,7 @@
 
 #include <string>
 
-namespace gl2
+namespace es2
 {
 Shader::Shader(ResourceManager *manager, GLuint handle) : mHandle(handle), mResourceManager(manager)
 {
diff --git a/src/GLES2/libGLESv2/Shader.h b/src/GLES2/libGLESv2/Shader.h
index 914e222..adf1c96 100644
--- a/src/GLES2/libGLESv2/Shader.h
+++ b/src/GLES2/libGLESv2/Shader.h
@@ -32,7 +32,7 @@
 	class OutputASM;

 }

 

-namespace gl2

+namespace es2

 {

 struct Varying

 {

@@ -46,7 +46,7 @@
 		return arraySize >= 1;

 	}

 

-	int size() const   // Unify with gl2::Uniform?

+	int size() const   // Unify with es2::Uniform?

 	{

 		return arraySize > 0 ? arraySize : 1;

 	}

diff --git a/src/GLES2/libGLESv2/Texture.cpp b/src/GLES2/libGLESv2/Texture.cpp
index dd7a6c5..318ccaf 100644
--- a/src/GLES2/libGLESv2/Texture.cpp
+++ b/src/GLES2/libGLESv2/Texture.cpp
@@ -25,7 +25,7 @@
 

 #include <algorithm>

 

-namespace gl2

+namespace es2

 {

 

 Texture::Texture(GLuint id) : RefCountObject(id)

@@ -1156,17 +1156,17 @@
 // Exported functions for use by EGL

 extern "C"

 {

-	gl2::Image *createBackBuffer(int width, int height, const egl::Config *config)

+	es2::Image *createBackBuffer(int width, int height, const egl::Config *config)

 	{

 		if(config)

 		{

-			return new gl2::Image(0, width, height, config->mAlphaSize ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE);

+			return new es2::Image(0, width, height, config->mAlphaSize ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE);

 		}

 

 		return 0;

 	}

 

-	gl2::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard)

+	es2::Image *createDepthStencil(unsigned int width, unsigned int height, sw::Format format, int multiSampleDepth, bool discard)

 	{

 		if(width == 0 || height == 0 || height > OUTLINE_RESOLUTION)

 		{

@@ -1199,7 +1199,7 @@
 			UNREACHABLE();

 		}

 

-		gl2::Image *surface = new gl2::Image(0, width, height, format, multiSampleDepth, lockable, true);

+		es2::Image *surface = new es2::Image(0, width, height, format, multiSampleDepth, lockable, true);

 

 		if(!surface)

 		{

diff --git a/src/GLES2/libGLESv2/Texture.h b/src/GLES2/libGLESv2/Texture.h
index 3157fb5..2d1e2fe 100644
--- a/src/GLES2/libGLESv2/Texture.h
+++ b/src/GLES2/libGLESv2/Texture.h
@@ -33,7 +33,7 @@
 class Config;

 }

 

-namespace gl2

+namespace es2

 {

 class Framebuffer;

 

diff --git a/src/GLES2/libGLESv2/VertexDataManager.cpp b/src/GLES2/libGLESv2/VertexDataManager.cpp
index d60e72b..37875c0 100644
--- a/src/GLES2/libGLESv2/VertexDataManager.cpp
+++ b/src/GLES2/libGLESv2/VertexDataManager.cpp
@@ -24,7 +24,7 @@
     enum {INITIAL_STREAM_BUFFER_SIZE = 1024 * 1024};

 }

 

-namespace gl2

+namespace es2

 {

 

 VertexDataManager::VertexDataManager(Context *context) : mContext(context)

diff --git a/src/GLES2/libGLESv2/VertexDataManager.h b/src/GLES2/libGLESv2/VertexDataManager.h
index 50a2e9c..ee32c03 100644
--- a/src/GLES2/libGLESv2/VertexDataManager.h
+++ b/src/GLES2/libGLESv2/VertexDataManager.h
@@ -21,7 +21,7 @@
 #define GL_APICALL

 #include <GLES2/gl2.h>

 

-namespace gl2

+namespace es2

 {

 

 struct TranslatedAttribute

diff --git a/src/GLES2/libGLESv2/libGLESv2.cpp b/src/GLES2/libGLESv2/libGLESv2.cpp
index 657e7f0..d6a4904 100644
--- a/src/GLES2/libGLESv2/libGLESv2.cpp
+++ b/src/GLES2/libGLESv2/libGLESv2.cpp
@@ -35,7 +35,7 @@
 

 static bool validImageSize(GLint level, GLsizei width, GLsizei height)

 {

-    if(level < 0 || level >= gl2::IMPLEMENTATION_MAX_TEXTURE_LEVELS || width < 0 || height < 0)

+    if(level < 0 || level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS || width < 0 || height < 0)

     {

         return false;

     }

@@ -43,7 +43,7 @@
     return true;

 }

 

-static bool validateSubImageParams(bool compressed, GLsizei width, GLsizei height, GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format, gl2::Texture *texture)

+static bool validateSubImageParams(bool compressed, GLsizei width, GLsizei height, GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format, es2::Texture *texture)

 {

     if(!texture)

     {

@@ -103,10 +103,10 @@
             return false;

         }

         break;

-    case gl2::IMPLEMENTATION_COLOR_READ_FORMAT:

+    case es2::IMPLEMENTATION_COLOR_READ_FORMAT:

         switch (type)

         {

-        case gl2::IMPLEMENTATION_COLOR_READ_TYPE:

+        case es2::IMPLEMENTATION_COLOR_READ_TYPE:

             break;

         default:

             return false;

@@ -128,11 +128,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + gl2::MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)

+            if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + es2::MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)

             {

                 return error(GL_INVALID_ENUM);

             }

@@ -152,12 +152,12 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *programObject = context->getProgram(program);

-            gl2::Shader *shaderObject = context->getShader(shader);

+            es2::Program *programObject = context->getProgram(program);

+            es2::Shader *shaderObject = context->getShader(shader);

 

             if(!programObject)

             {

@@ -215,7 +215,7 @@
             return error(GL_INVALID_OPERATION);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -234,16 +234,16 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject)

             {

@@ -277,7 +277,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -311,7 +311,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -343,7 +343,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -362,11 +362,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Texture *textureObject = context->getTexture(texture);

+            es2::Texture *textureObject = context->getTexture(texture);

 

             if(textureObject && textureObject->getTarget() != target && texture != 0)

             {

@@ -402,11 +402,11 @@
 

     try

     {

-        gl2::Context* context = gl2::getContext();

+        es2::Context* context = es2::getContext();

 

         if(context)

         {

-            context->setBlendColor(gl2::clamp01(red), gl2::clamp01(green), gl2::clamp01(blue), gl2::clamp01(alpha));

+            context->setBlendColor(es2::clamp01(red), es2::clamp01(green), es2::clamp01(blue), es2::clamp01(alpha));

         }

     }

     catch(std::bad_alloc&)

@@ -450,7 +450,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -561,7 +561,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -596,11 +596,11 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Buffer *buffer;

+            es2::Buffer *buffer;

 

             switch(target)

             {

@@ -645,11 +645,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Buffer *buffer;

+            es2::Buffer *buffer;

 

             switch(target)

             {

@@ -693,11 +693,11 @@
             return error(GL_INVALID_ENUM, 0);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Framebuffer *framebuffer = NULL;

+            es2::Framebuffer *framebuffer = NULL;

             if(target == GL_READ_FRAMEBUFFER_ANGLE)

             {

                 framebuffer = context->getReadFramebuffer();

@@ -729,7 +729,7 @@
 			return error(GL_INVALID_VALUE);

 		}

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -749,7 +749,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -768,7 +768,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -787,7 +787,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -807,7 +807,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -826,11 +826,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Shader *shaderObject = context->getShader(shader);

+            es2::Shader *shaderObject = context->getShader(shader);

 

             if(!shaderObject)

             {

@@ -893,11 +893,11 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-			if(level > gl2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

+			if(level > es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

             {

                 return error(GL_INVALID_VALUE);

             }

@@ -905,8 +905,8 @@
             switch(target)

             {

               case GL_TEXTURE_2D:

-                if(width > (gl2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

-                    height > (gl2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

+                if(width > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

+                    height > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

                 {

                     return error(GL_INVALID_VALUE);

                 }

@@ -922,8 +922,8 @@
                     return error(GL_INVALID_VALUE);

                 }

 

-                if(width > (gl2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||

-                   height > (gl2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))

+                if(width > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||

+                   height > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))

                 {

                     return error(GL_INVALID_VALUE);

                 }

@@ -932,14 +932,14 @@
                 return error(GL_INVALID_ENUM);

             }

 

-            if(imageSize != gl2::ComputeCompressedSize(width, height, internalformat))

+            if(imageSize != es2::ComputeCompressedSize(width, height, internalformat))

             {

                 return error(GL_INVALID_VALUE);

             }

 

             if(target == GL_TEXTURE_2D)

             {

-                gl2::Texture2D *texture = context->getTexture2D();

+                es2::Texture2D *texture = context->getTexture2D();

 

                 if(!texture)

                 {

@@ -950,7 +950,7 @@
             }

             else

             {

-                gl2::TextureCubeMap *texture = context->getTextureCubeMap();

+                es2::TextureCubeMap *texture = context->getTextureCubeMap();

 

                 if(!texture)

                 {

@@ -988,7 +988,7 @@
 

     try

     {

-        if(!gl2::IsTextureTarget(target))

+        if(!es2::IsTextureTarget(target))

         {

             return error(GL_INVALID_ENUM);

         }

@@ -1018,16 +1018,16 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            if(level > gl2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

+            if(level > es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

             {

                 return error(GL_INVALID_VALUE);

             }

 

-            if(imageSize != gl2::ComputeCompressedSize(width, height, format))

+            if(imageSize != es2::ComputeCompressedSize(width, height, format))

             {

                 return error(GL_INVALID_VALUE);

             }

@@ -1040,16 +1040,16 @@
 

             if(target == GL_TEXTURE_2D)

             {

-                gl2::Texture2D *texture = context->getTexture2D();

+                es2::Texture2D *texture = context->getTexture2D();

 

                 if(validateSubImageParams(true, width, height, xoffset, yoffset, target, level, format, texture))

 				{

 					texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data);

 				}

             }

-            else if(gl2::IsCubemapTextureTarget(target))

+            else if(es2::IsCubemapTextureTarget(target))

             {

-                gl2::TextureCubeMap *texture = context->getTextureCubeMap();

+                es2::TextureCubeMap *texture = context->getTextureCubeMap();

 

                 if(validateSubImageParams(true, width, height, xoffset, yoffset, target, level, format, texture))

 				{

@@ -1086,15 +1086,15 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

             switch(target)

             {

               case GL_TEXTURE_2D:

-                if(width > (gl2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

-                   height > (gl2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

+                if(width > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

+                   height > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

                 {

                     return error(GL_INVALID_VALUE);

                 }

@@ -1110,8 +1110,8 @@
                     return error(GL_INVALID_VALUE);

                 }

 

-                if(width > (gl2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||

-                   height > (gl2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))

+                if(width > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||

+                   height > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))

                 {

                     return error(GL_INVALID_VALUE);

                 }

@@ -1120,7 +1120,7 @@
                 return error(GL_INVALID_ENUM);

             }

 

-            gl2::Framebuffer *framebuffer = context->getReadFramebuffer();

+            es2::Framebuffer *framebuffer = context->getReadFramebuffer();

 

             if(framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)

             {

@@ -1132,7 +1132,7 @@
                 return error(GL_INVALID_OPERATION);

             }

 

-            gl2::Renderbuffer *source = framebuffer->getColorbuffer();

+            es2::Renderbuffer *source = framebuffer->getColorbuffer();

             GLenum colorbufferFormat = source->getFormat();

 

             // [OpenGL ES 2.0.24] table 3.9

@@ -1190,7 +1190,7 @@
 

             if(target == GL_TEXTURE_2D)

             {

-                gl2::Texture2D *texture = context->getTexture2D();

+                es2::Texture2D *texture = context->getTexture2D();

 

                 if(!texture)

                 {

@@ -1199,9 +1199,9 @@
 

                 texture->copyImage(level, internalformat, x, y, width, height, framebuffer);

             }

-            else if(gl2::IsCubemapTextureTarget(target))

+            else if(es2::IsCubemapTextureTarget(target))

             {

-                gl2::TextureCubeMap *texture = context->getTextureCubeMap();

+                es2::TextureCubeMap *texture = context->getTextureCubeMap();

 

                 if(!texture)

                 {

@@ -1227,7 +1227,7 @@
 

     try

     {

-        if(!gl2::IsTextureTarget(target))

+        if(!es2::IsTextureTarget(target))

         {

             return error(GL_INVALID_ENUM);

         }

@@ -1247,16 +1247,16 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            if(level > gl2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

+            if(level > es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

             {

                 return error(GL_INVALID_VALUE);

             }

 

-            gl2::Framebuffer *framebuffer = context->getReadFramebuffer();

+            es2::Framebuffer *framebuffer = context->getReadFramebuffer();

 

             if(framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)

             {

@@ -1268,15 +1268,15 @@
                 return error(GL_INVALID_OPERATION);

             }

 

-            gl2::Renderbuffer *source = framebuffer->getColorbuffer();

+            es2::Renderbuffer *source = framebuffer->getColorbuffer();

             GLenum colorbufferFormat = source->getFormat();

-            gl2::Texture *texture = NULL;

+            es2::Texture *texture = NULL;

 

             if(target == GL_TEXTURE_2D)

             {

                 texture = context->getTexture2D();

             }

-            else if(gl2::IsCubemapTextureTarget(target))

+            else if(es2::IsCubemapTextureTarget(target))

             {

                 texture = context->getTextureCubeMap();

             }

@@ -1353,7 +1353,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1374,7 +1374,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1408,7 +1408,7 @@
           case GL_BACK:

           case GL_FRONT_AND_BACK:

             {

-                gl2::Context *context = gl2::getContext();

+                es2::Context *context = es2::getContext();

 

                 if(context)

                 {

@@ -1437,7 +1437,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1464,7 +1464,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1491,7 +1491,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1521,7 +1521,7 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1557,7 +1557,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1584,7 +1584,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1611,7 +1611,7 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1647,7 +1647,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1687,7 +1687,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1706,7 +1706,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1725,7 +1725,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1744,17 +1744,17 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

 

-            gl2::Program *programObject = context->getProgram(program);

-            gl2::Shader *shaderObject = context->getShader(shader);

+            es2::Program *programObject = context->getProgram(program);

+            es2::Shader *shaderObject = context->getShader(shader);

             

             if(!programObject)

             {

-                gl2::Shader *shaderByProgramHandle;

+                es2::Shader *shaderByProgramHandle;

                 shaderByProgramHandle = context->getShader(program);

                 if(!shaderByProgramHandle)

                 {

@@ -1768,7 +1768,7 @@
 

             if(!shaderObject)

             {

-                gl2::Program *programByShaderHandle = context->getProgram(shader);

+                es2::Program *programByShaderHandle = context->getProgram(shader);

                 if(!programByShaderHandle)

                 {

                     return error(GL_INVALID_VALUE);

@@ -1797,7 +1797,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1829,12 +1829,12 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1858,7 +1858,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1883,7 +1883,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1912,7 +1912,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1944,12 +1944,12 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1977,7 +1977,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -1996,11 +1996,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Fence* fenceObject = context->getFence(fence);

+            es2::Fence* fenceObject = context->getFence(fence);

 

             if(fenceObject == NULL)

             {

@@ -2022,7 +2022,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2041,7 +2041,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2067,11 +2067,11 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Framebuffer *framebuffer = NULL;

+            es2::Framebuffer *framebuffer = NULL;

             GLuint framebufferHandle = 0;

             if(target == GL_READ_FRAMEBUFFER_ANGLE)

             {

@@ -2133,7 +2133,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2143,7 +2143,7 @@
             }

             else

             {

-                gl2::Texture *tex = context->getTexture(texture);

+                es2::Texture *tex = context->getTexture(texture);

 

                 if(tex == NULL)

                 {

@@ -2186,7 +2186,7 @@
                 }

             }

 

-            gl2::Framebuffer *framebuffer = NULL;

+            es2::Framebuffer *framebuffer = NULL;

             GLuint framebufferHandle = 0;

             if(target == GL_READ_FRAMEBUFFER_ANGLE)

             {

@@ -2229,7 +2229,7 @@
           case GL_CW:

           case GL_CCW:

             {

-                gl2::Context *context = gl2::getContext();

+                es2::Context *context = es2::getContext();

 

                 if(context)

                 {

@@ -2258,7 +2258,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2280,11 +2280,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Texture *texture;

+            es2::Texture *texture;

 

             switch(target)

             {

@@ -2323,7 +2323,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2350,7 +2350,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2377,7 +2377,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2404,7 +2404,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2431,7 +2431,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2460,11 +2460,11 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject)

             {

@@ -2505,11 +2505,11 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject)

             {

@@ -2549,11 +2549,11 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject)

             {

@@ -2582,12 +2582,12 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

 

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject)

             {

@@ -2623,7 +2623,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2686,11 +2686,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Buffer *buffer;

+            es2::Buffer *buffer;

 

             switch(target)

             {

@@ -2731,7 +2731,7 @@
 {

     TRACE("()");

 

-    gl2::Context *context = gl2::getContext();

+    es2::Context *context = es2::getContext();

 

     if(context)

     {

@@ -2747,11 +2747,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Fence *fenceObject = context->getFence(fence);

+            es2::Fence *fenceObject = context->getFence(fence);

 

             if(fenceObject == NULL)

             {

@@ -2773,7 +2773,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2834,7 +2834,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -2843,7 +2843,7 @@
                 return error(GL_INVALID_ENUM);

             }

 

-            gl2::Framebuffer *framebuffer = NULL;

+            es2::Framebuffer *framebuffer = NULL;

             if(target == GL_READ_FRAMEBUFFER_ANGLE)

             {

                 if(context->getReadFramebufferHandle() == 0)

@@ -2887,7 +2887,7 @@
             {

                 attachmentObjectType = attachmentType;

             }

-            else if(gl2::IsTextureTarget(attachmentType))

+            else if(es2::IsTextureTarget(attachmentType))

             {

                 attachmentObjectType = GL_TEXTURE;

             }

@@ -2921,7 +2921,7 @@
               case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:

                 if(attachmentObjectType == GL_TEXTURE)

                 {

-                    if(gl2::IsCubemapTextureTarget(attachmentType))

+                    if(es2::IsCubemapTextureTarget(attachmentType))

                     {

                         *params = attachmentType;

                     }

@@ -2959,7 +2959,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -3024,11 +3024,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject)

             {

@@ -3087,11 +3087,11 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject)

             {

@@ -3121,7 +3121,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -3149,11 +3149,11 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Query *queryObject = context->getQuery(id, false, GL_NONE);

+            es2::Query *queryObject = context->getQuery(id, false, GL_NONE);

 

             if(!queryObject)

             {

@@ -3190,7 +3190,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -3204,7 +3204,7 @@
                 return error(GL_INVALID_OPERATION);

             }

 

-            gl2::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getRenderbufferHandle());

+            es2::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getRenderbufferHandle());

 

             switch(pname)

             {

@@ -3235,11 +3235,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Shader *shaderObject = context->getShader(shader);

+            es2::Shader *shaderObject = context->getShader(shader);

 

             if(!shaderObject)

             {

@@ -3286,11 +3286,11 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Shader *shaderObject = context->getShader(shader);

+            es2::Shader *shaderObject = context->getShader(shader);

 

             if(!shaderObject)

             {

@@ -3362,11 +3362,11 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Shader *shaderObject = context->getShader(shader);

+            es2::Shader *shaderObject = context->getShader(shader);

 

             if(!shaderObject)

             {

@@ -3388,7 +3388,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         switch(name)

         {

@@ -3450,11 +3450,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Texture *texture;

+            es2::Texture *texture;

 

             switch(target)

             {

@@ -3508,11 +3508,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Texture *texture;

+            es2::Texture *texture;

 

             switch(target)

             {

@@ -3572,7 +3572,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -3581,7 +3581,7 @@
                 return error(GL_INVALID_VALUE);

             }

 

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject || !programObject->isLinked())

             {

@@ -3606,7 +3606,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -3615,7 +3615,7 @@
                 return error(GL_INVALID_VALUE);

             }

 

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject || !programObject->isLinked())

             {

@@ -3646,7 +3646,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -3655,7 +3655,7 @@
                 return error(GL_INVALID_VALUE);

             }

 

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject || !programObject->isLinked())

             {

@@ -3685,7 +3685,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -3694,7 +3694,7 @@
                 return error(GL_INVALID_VALUE);

             }

 

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject || !programObject->isLinked())

             {

@@ -3724,7 +3724,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(strstr(name, "gl_") == name)

         {

@@ -3733,7 +3733,7 @@
 

         if(context)

         {

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject)

             {

@@ -3769,16 +3769,16 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            if(index >= gl2::MAX_VERTEX_ATTRIBS)

+            if(index >= es2::MAX_VERTEX_ATTRIBS)

             {

                 return error(GL_INVALID_VALUE);

             }

 

-            const gl2::VertexAttribute &attribState = context->getVertexAttribState(index);

+            const es2::VertexAttribute &attribState = context->getVertexAttribState(index);

 

             switch(pname)

             {

@@ -3822,16 +3822,16 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            if(index >= gl2::MAX_VERTEX_ATTRIBS)

+            if(index >= es2::MAX_VERTEX_ATTRIBS)

             {

                 return error(GL_INVALID_VALUE);

             }

 

-            const gl2::VertexAttribute &attribState = context->getVertexAttribState(index);

+            const es2::VertexAttribute &attribState = context->getVertexAttribState(index);

 

             switch(pname)

             {

@@ -3876,11 +3876,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            if(index >= gl2::MAX_VERTEX_ATTRIBS)

+            if(index >= es2::MAX_VERTEX_ATTRIBS)

             {

                 return error(GL_INVALID_VALUE);

             }

@@ -3915,7 +3915,7 @@
             return error(GL_INVALID_ENUM); 

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

         switch(target)

         {

           case GL_GENERATE_MIPMAP_HINT:

@@ -3940,11 +3940,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context && buffer)

         {

-            gl2::Buffer *bufferObject = context->getBuffer(buffer);

+            es2::Buffer *bufferObject = context->getBuffer(buffer);

 

             if(bufferObject)

             {

@@ -3966,7 +3966,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -4000,11 +4000,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Fence *fenceObject = context->getFence(fence);

+            es2::Fence *fenceObject = context->getFence(fence);

 

             if(fenceObject == NULL)

             {

@@ -4028,11 +4028,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context && framebuffer)

         {

-            gl2::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer);

+            es2::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer);

 

             if(framebufferObject)

             {

@@ -4054,11 +4054,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context && program)

         {

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(programObject)

             {

@@ -4085,11 +4085,11 @@
             return GL_FALSE;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Query *queryObject = context->getQuery(id, false, GL_NONE);

+            es2::Query *queryObject = context->getQuery(id, false, GL_NONE);

 

             if(queryObject)

             {

@@ -4111,11 +4111,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context && renderbuffer)

         {

-            gl2::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);

+            es2::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);

 

             if(renderbufferObject)

             {

@@ -4137,11 +4137,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context && shader)

         {

-            gl2::Shader *shaderObject = context->getShader(shader);

+            es2::Shader *shaderObject = context->getShader(shader);

 

             if(shaderObject)

             {

@@ -4163,11 +4163,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context && texture)

         {

-            gl2::Texture *textureObject = context->getTexture(texture);

+            es2::Texture *textureObject = context->getTexture(texture);

 

             if(textureObject)

             {

@@ -4194,7 +4194,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -4213,11 +4213,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject)

             {

@@ -4246,7 +4246,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -4287,7 +4287,7 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -4320,7 +4320,7 @@
             return error(GL_INVALID_OPERATION);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -4351,7 +4351,7 @@
             return error(GL_INVALID_OPERATION);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -4370,7 +4370,7 @@
 

     try

     {

-        gl2::Shader::releaseCompiler();

+        es2::Shader::releaseCompiler();

     }

     catch(std::bad_alloc&)

     {

@@ -4393,7 +4393,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        if(!gl2::IsColorRenderable(internalformat) && !gl2::IsDepthRenderable(internalformat) && !gl2::IsStencilRenderable(internalformat))

+        if(!es2::IsColorRenderable(internalformat) && !es2::IsDepthRenderable(internalformat) && !es2::IsStencilRenderable(internalformat))

         {

             return error(GL_INVALID_ENUM);

         }

@@ -4403,13 +4403,13 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            if(width > gl2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE || 

-               height > gl2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE ||

-               samples > gl2::IMPLEMENTATION_MAX_SAMPLES)

+            if(width > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE || 

+               height > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE ||

+               samples > es2::IMPLEMENTATION_MAX_SAMPLES)

             {

                 return error(GL_INVALID_VALUE);

             }

@@ -4423,20 +4423,20 @@
             switch(internalformat)

             {

               case GL_DEPTH_COMPONENT16:

-                context->setRenderbufferStorage(new gl2::Depthbuffer(width, height, samples));

+                context->setRenderbufferStorage(new es2::Depthbuffer(width, height, samples));

                 break;

               case GL_RGBA4:

               case GL_RGB5_A1:

               case GL_RGB565:

               case GL_RGB8_OES:

               case GL_RGBA8_OES:

-                context->setRenderbufferStorage(new gl2::Colorbuffer(width, height, internalformat, samples));

+                context->setRenderbufferStorage(new es2::Colorbuffer(width, height, internalformat, samples));

                 break;

               case GL_STENCIL_INDEX8:

-                context->setRenderbufferStorage(new gl2::Stencilbuffer(width, height, samples));

+                context->setRenderbufferStorage(new es2::Stencilbuffer(width, height, samples));

                 break;

               case GL_DEPTH24_STENCIL8_OES:

-                context->setRenderbufferStorage(new gl2::DepthStencilbuffer(width, height, samples));

+                context->setRenderbufferStorage(new es2::DepthStencilbuffer(width, height, samples));

                 break;

               default:

                 return error(GL_INVALID_ENUM);

@@ -4460,11 +4460,11 @@
 

     try

     {

-        gl2::Context* context = gl2::getContext();

+        es2::Context* context = es2::getContext();

 

         if(context)

         {

-            context->setSampleCoverageParams(gl2::clamp01(value), invert == GL_TRUE);

+            context->setSampleCoverageParams(es2::clamp01(value), invert == GL_TRUE);

         }

     }

     catch(std::bad_alloc&)

@@ -4484,11 +4484,11 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Fence *fenceObject = context->getFence(fence);

+            es2::Fence *fenceObject = context->getFence(fence);

 

             if(fenceObject == NULL)

             {

@@ -4515,7 +4515,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context* context = gl2::getContext();

+        es2::Context* context = es2::getContext();

 

         if(context)

         {

@@ -4557,11 +4557,11 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Shader *shaderObject = context->getShader(shader);

+            es2::Shader *shaderObject = context->getShader(shader);

 

             if(!shaderObject)

             {

@@ -4620,7 +4620,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -4662,7 +4662,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -4750,7 +4750,7 @@
             return error(GL_INVALID_ENUM);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -4777,11 +4777,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Fence *fenceObject = context->getFence(fence);

+            es2::Fence *fenceObject = context->getFence(fence);

 

             if(fenceObject == NULL)

             {

@@ -4900,15 +4900,15 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

             switch(target)

             {

               case GL_TEXTURE_2D:

-                if(width > (gl2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

-                   height > (gl2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

+                if(width > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||

+                   height > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))

                 {

                     return error(GL_INVALID_VALUE);

                 }

@@ -4924,8 +4924,8 @@
                     return error(GL_INVALID_VALUE);

                 }

 

-                if(width > (gl2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||

-                   height > (gl2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))

+                if(width > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||

+                   height > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))

                 {

                     return error(GL_INVALID_VALUE);

                 }

@@ -4951,7 +4951,7 @@
 			

             if(target == GL_TEXTURE_2D)

             {

-                gl2::Texture2D *texture = context->getTexture2D();

+                es2::Texture2D *texture = context->getTexture2D();

 

                 if(!texture)

                 {

@@ -4962,7 +4962,7 @@
             }

             else

             {

-                gl2::TextureCubeMap *texture = context->getTextureCubeMap();

+                es2::TextureCubeMap *texture = context->getTextureCubeMap();

 

                 if(!texture)

                 {

@@ -4985,11 +4985,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Texture *texture;

+            es2::Texture *texture;

 

             switch(target)

             {

@@ -5060,11 +5060,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Texture *texture;

+            es2::Texture *texture;

 

             switch(target)

             {

@@ -5139,7 +5139,7 @@
 

     try

     {

-        if(!gl2::IsTextureTarget(target))

+        if(!es2::IsTextureTarget(target))

         {

             return error(GL_INVALID_ENUM);

         }

@@ -5154,7 +5154,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        if(!gl2::CheckTextureFormatType(format, type))

+        if(!es2::CheckTextureFormatType(format, type))

         {

             return error(GL_INVALID_ENUM);

         }

@@ -5164,27 +5164,27 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            if(level > gl2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

+            if(level > es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)

             {

                 return error(GL_INVALID_VALUE);

             }

 

             if(target == GL_TEXTURE_2D)

             {

-                gl2::Texture2D *texture = context->getTexture2D();

+                es2::Texture2D *texture = context->getTexture2D();

 

                 if(validateSubImageParams(false, width, height, xoffset, yoffset, target, level, format, texture))

 				{

 					texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getUnpackAlignment(), pixels);

 				}

             }

-            else if(gl2::IsCubemapTextureTarget(target))

+            else if(es2::IsCubemapTextureTarget(target))

             {

-                gl2::TextureCubeMap *texture = context->getTextureCubeMap();

+                es2::TextureCubeMap *texture = context->getTextureCubeMap();

 				

 				if(validateSubImageParams(false, width, height, xoffset, yoffset, target, level, format, texture))

 				{

@@ -5224,11 +5224,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *program = context->getCurrentProgram();

+            es2::Program *program = context->getCurrentProgram();

 

             if(!program)

             {

@@ -5268,11 +5268,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *program = context->getCurrentProgram();

+            es2::Program *program = context->getCurrentProgram();

 

             if(!program)

             {

@@ -5314,11 +5314,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *program = context->getCurrentProgram();

+            es2::Program *program = context->getCurrentProgram();

 

             if(!program)

             {

@@ -5360,11 +5360,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *program = context->getCurrentProgram();

+            es2::Program *program = context->getCurrentProgram();

 

             if(!program)

             {

@@ -5406,11 +5406,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *program = context->getCurrentProgram();

+            es2::Program *program = context->getCurrentProgram();

 

             if(!program)

             {

@@ -5452,11 +5452,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *program = context->getCurrentProgram();

+            es2::Program *program = context->getCurrentProgram();

 

             if(!program)

             {

@@ -5498,11 +5498,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *program = context->getCurrentProgram();

+            es2::Program *program = context->getCurrentProgram();

 

             if(!program)

             {

@@ -5544,11 +5544,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *program = context->getCurrentProgram();

+            es2::Program *program = context->getCurrentProgram();

 

             if(!program)

             {

@@ -5584,11 +5584,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *program = context->getCurrentProgram();

+            es2::Program *program = context->getCurrentProgram();

 

             if(!program)

             {

@@ -5624,11 +5624,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *program = context->getCurrentProgram();

+            es2::Program *program = context->getCurrentProgram();

 

             if(!program)

             {

@@ -5664,11 +5664,11 @@
             return;

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *program = context->getCurrentProgram();

+            es2::Program *program = context->getCurrentProgram();

 

             if(!program)

             {

@@ -5693,11 +5693,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject && program != 0)

             {

@@ -5731,11 +5731,11 @@
 

     try

     {

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::Program *programObject = context->getProgram(program);

+            es2::Program *programObject = context->getProgram(program);

 

             if(!programObject)

             {

@@ -5764,12 +5764,12 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -5789,12 +5789,12 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -5814,12 +5814,12 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -5839,12 +5839,12 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -5864,12 +5864,12 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -5889,12 +5889,12 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -5914,12 +5914,12 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -5939,12 +5939,12 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -5965,7 +5965,7 @@
 

     try

     {

-        if(index >= gl2::MAX_VERTEX_ATTRIBS)

+        if(index >= es2::MAX_VERTEX_ATTRIBS)

         {

             return error(GL_INVALID_VALUE);

         }

@@ -5993,7 +5993,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -6017,7 +6017,7 @@
             return error(GL_INVALID_VALUE);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -6059,7 +6059,7 @@
             return error(GL_INVALID_OPERATION);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

@@ -6100,7 +6100,7 @@
 {

 	if(egl::getClientVersion() == 1)

 	{

-		static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)gl::getProcAddress("glEGLImageTargetTexture2DOES");

+		static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)es1::getProcAddress("glEGLImageTargetTexture2DOES");

 		return glEGLImageTargetTexture2DOES(target, image);

 	}

 

@@ -6121,18 +6121,18 @@
             return error(GL_INVALID_OPERATION);

         }

 

-        gl2::Context *context = gl2::getContext();

+        es2::Context *context = es2::getContext();

 

         if(context)

         {

-            gl2::TextureExternal *texture = context->getTextureExternal();

+            es2::TextureExternal *texture = context->getTextureExternal();

 

             if(!texture)

             {

                 return error(GL_INVALID_OPERATION);

             }

 

-            gl2::Image *glImage = static_cast<gl2::Image*>(image);

+            es2::Image *glImage = static_cast<es2::Image*>(image);

 

             texture->setImage(glImage);

         }

diff --git a/src/GLES2/libGLESv2/main.cpp b/src/GLES2/libGLESv2/main.cpp
index 6055850..14e4053 100644
--- a/src/GLES2/libGLESv2/main.cpp
+++ b/src/GLES2/libGLESv2/main.cpp
@@ -60,7 +60,7 @@
 	#endif

 

 	libGLES_CM = loadLibrary(libGLES_CM_lib);

-	gl::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLES_CM, "glGetProcAddress");

+	es1::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLES_CM, "glGetProcAddress");

 

     return libEGL != 0;

 }

@@ -99,15 +99,15 @@
 }

 #endif

 

-namespace gl2

+namespace es2

 {

-gl2::Context *getContext()

+es2::Context *getContext()

 {

 	egl::Context *context = egl::getCurrentContext();

 	

 	if(context && context->getClientVersion() == 2)

 	{

-		return static_cast<gl2::Context*>(context);

+		return static_cast<es2::Context*>(context);

 	}

 	

 	return 0;

@@ -139,7 +139,7 @@
 // Records an error code

 void error(GLenum errorCode)

 {

-    gl2::Context *context = gl2::getContext();

+    es2::Context *context = es2::getContext();

 

     if(context)

     {

@@ -176,7 +176,7 @@
 	egl::Display *(*getCurrentDisplay)() = 0;

 }

 

-namespace gl

+namespace es1

 {

 	__eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname) = 0;

 }

diff --git a/src/GLES2/libGLESv2/main.h b/src/GLES2/libGLESv2/main.h
index dea1c7d..d367390 100644
--- a/src/GLES2/libGLESv2/main.h
+++ b/src/GLES2/libGLESv2/main.h
@@ -23,7 +23,7 @@
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
 
-namespace gl2
+namespace es2
 {
 	Context *getContext();
 	egl::Display *getDisplay();
@@ -53,7 +53,7 @@
 }
 
 // libGLES_CM dependencies
-namespace gl
+namespace es1
 {
 	extern __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname);
 }
diff --git a/src/GLES2/libGLESv2/mathutil.h b/src/GLES2/libGLESv2/mathutil.h
index 1359a1a..6ac1f37 100644
--- a/src/GLES2/libGLESv2/mathutil.h
+++ b/src/GLES2/libGLESv2/mathutil.h
@@ -18,7 +18,7 @@
 
 #include <math.h>
 
-namespace gl2
+namespace es2
 {
 inline bool isPow2(int x)
 {
diff --git a/src/GLES2/libGLESv2/utilities.cpp b/src/GLES2/libGLESv2/utilities.cpp
index 98a5518..6d01e92 100644
--- a/src/GLES2/libGLESv2/utilities.cpp
+++ b/src/GLES2/libGLESv2/utilities.cpp
@@ -20,7 +20,7 @@
 #include <limits>

 #include <stdio.h>

 

-namespace gl2

+namespace es2

 {

 	int UniformComponentCount(GLenum type)

 	{

@@ -478,7 +478,7 @@
 		return sw::STENCIL_ALWAYS;

 	}

 

-	sw::Color<float> ConvertColor(gl2::Color color)

+	sw::Color<float> ConvertColor(es2::Color color)

 	{

 		return sw::Color<float>(color.red, color.green, color.blue, color.alpha);

 	}

@@ -630,36 +630,36 @@
 		}

 	}

 

-	bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,  gl2::PrimitiveType &swPrimitiveType, int &primitiveCount)

+	bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,  es2::PrimitiveType &swPrimitiveType, int &primitiveCount)

 	{

 		switch(primitiveType)

 		{

 		case GL_POINTS:

-			swPrimitiveType = gl2::DRAW_POINTLIST;

+			swPrimitiveType = es2::DRAW_POINTLIST;

 			primitiveCount = elementCount;

 			break;

 		case GL_LINES:

-			swPrimitiveType = gl2::DRAW_LINELIST;

+			swPrimitiveType = es2::DRAW_LINELIST;

 			primitiveCount = elementCount / 2;

 			break;

 		case GL_LINE_LOOP:

-			swPrimitiveType = gl2::DRAW_LINELOOP;

+			swPrimitiveType = es2::DRAW_LINELOOP;

 			primitiveCount = elementCount;

 			break;

 		case GL_LINE_STRIP:

-			swPrimitiveType = gl2::DRAW_LINESTRIP;

+			swPrimitiveType = es2::DRAW_LINESTRIP;

 			primitiveCount = elementCount - 1;

 			break;

 		case GL_TRIANGLES:

-			swPrimitiveType = gl2::DRAW_TRIANGLELIST;

+			swPrimitiveType = es2::DRAW_TRIANGLELIST;

 			primitiveCount = elementCount / 3;

 			break;

 		case GL_TRIANGLE_STRIP:

-			swPrimitiveType = gl2::DRAW_TRIANGLESTRIP;

+			swPrimitiveType = es2::DRAW_TRIANGLESTRIP;

 			primitiveCount = elementCount - 2;

 			break;

 		case GL_TRIANGLE_FAN:

-			swPrimitiveType = gl2::DRAW_TRIANGLEFAN;

+			swPrimitiveType = es2::DRAW_TRIANGLEFAN;

 			primitiveCount = elementCount - 2;

 			break;

 		default:

diff --git a/src/GLES2/libGLESv2/utilities.h b/src/GLES2/libGLESv2/utilities.h
index 51b0378..3404648 100644
--- a/src/GLES2/libGLESv2/utilities.h
+++ b/src/GLES2/libGLESv2/utilities.h
@@ -24,7 +24,7 @@
 

 #include <string>

 

-namespace gl2

+namespace es2

 {

 	struct Color;

 

@@ -57,7 +57,7 @@
 {

 	sw::DepthCompareMode ConvertDepthComparison(GLenum comparison);

 	sw::StencilCompareMode ConvertStencilComparison(GLenum comparison);

-	sw::Color<float> ConvertColor(gl2::Color color);

+	sw::Color<float> ConvertColor(es2::Color color);

 	sw::BlendFactor ConvertBlendFunc(GLenum blend);

 	sw::BlendOperation ConvertBlendOp(GLenum blendOp);

 	sw::StencilOperation ConvertStencilOp(GLenum stencilOp);

@@ -66,7 +66,7 @@
 	unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha);

 	sw::FilterType ConvertMagFilter(GLenum magFilter);

 	void ConvertMinFilter(GLenum texFilter, sw::FilterType *minFilter, sw::MipmapType *mipFilter, float maxAnisotropy);

-	bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,  gl2::PrimitiveType &swPrimitiveType, int &primitiveCount);

+	bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,  es2::PrimitiveType &swPrimitiveType, int &primitiveCount);

 	sw::Format ConvertRenderbufferFormat(GLenum format);

 }