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/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);

         }