opengl translator: fixed normalized vertex attribs

That fixes the alpha and GUI components artifacts in Cordy.
The translator has ignored the 'normalized' argument of
glVertexAttribPointer function in GLESv2.
We now use the supplied value when applying the vertex attributes
to the backend OpenGL so that non-float color vertex attributes
are now normalized.

Change-Id: Idffda33225748276144ed70d2dcf4da17219d1d2
diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.cpp b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.cpp
index 1df4b5d..67aef79 100644
--- a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.cpp
+++ b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.cpp
@@ -63,7 +63,7 @@
 
 
 //setting client side arr
-void GLEScmContext::setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,int index){
+void GLEScmContext::setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,GLboolean normalized, int index){
     if( arr == NULL) return;
     switch(arrayType) {
         case GL_VERTEX_ARRAY:
@@ -92,10 +92,10 @@
         if(needConvert(cArrs,first,count,type,indices,direct,p,array_id)){
             //conversion has occured
             ArrayData currentArr = cArrs.getCurrentArray();
-            setupArr(currentArr.data,array_id,currentArr.type,size,currentArr.stride,cArrs.getCurrentIndex());
+            setupArr(currentArr.data,array_id,currentArr.type,size,currentArr.stride,GL_FALSE, cArrs.getCurrentIndex());
             ++cArrs;
         } else {
-            setupArr(p->getData(),array_id,dataType,size,p->getStride());
+            setupArr(p->getData(),array_id,dataType,size,p->getStride(), GL_FALSE);
         }
 }
 
diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.h b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.h
index 2bc08c0..1785877 100644
--- a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.h
+++ b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmContext.h
@@ -55,7 +55,7 @@
     bool needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id);
 private:
     void setupArrayPointerHelper(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLenum array_id,GLESpointer* p);
-    void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,int pointsIndex = -1);
+    void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,GLboolean normalized, int pointsIndex = -1);
     void drawPoints(PointSizeIndices* points);
     void drawPointsData(GLESConversionArrays& arrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices_in,bool isElemsDraw);
     void initExtensionString();
diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.cpp b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.cpp
index 17dd049..bd52ee5 100644
--- a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.cpp
+++ b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.cpp
@@ -46,18 +46,19 @@
         if(needConvert(cArrs,first,count,type,indices,direct,p,array_id)){
             //conversion has occured
             ArrayData currentArr = cArrs.getCurrentArray();
-            setupArr(currentArr.data,array_id,currentArr.type,size,currentArr.stride);
+            setupArr(currentArr.data,array_id,currentArr.type,size,currentArr.stride, p->getNormalized());
             ++cArrs;
         } else {
-            setupArr(p->getData(),array_id,p->getType(),size,p->getStride());
+            setupArr(p->getData(),array_id,p->getType(),
+                     size,p->getStride(), p->getNormalized());
         }
     }
 }
 
 //setting client side arr
-void GLESv2Context::setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,int index){
+void GLESv2Context::setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,GLboolean normalized, int index){
      if(arr == NULL) return;
-     s_glDispatch.glVertexAttribPointer(arrayType,size,dataType,GL_FALSE,stride,arr);
+     s_glDispatch.glVertexAttribPointer(arrayType,size,dataType,normalized,stride,arr);
 }
 
 bool GLESv2Context::needConvert(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id) {
diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.h b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.h
index 28cdbe9..a8d7f3a 100644
--- a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.h
+++ b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.h
@@ -33,7 +33,7 @@
 protected:
     bool needConvert(GLESConversionArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct,GLESpointer* p,GLenum array_id);
 private:
-    void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,int pointsIndex = -1);
+    void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,GLboolean normalized, int pointsIndex = -1);
     void initExtensionString();
 };
 
diff --git a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLEScontext.h b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLEScontext.h
index a2d6f93..3b54007 100644
--- a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLEScontext.h
+++ b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLEScontext.h
@@ -159,7 +159,7 @@
 
 private:
 
-    virtual void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride,int pointsIndex = -1) = 0 ;
+    virtual void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride, GLboolean normalized, int pointsIndex = -1) = 0 ;
     GLuint getBuffer(GLenum target);
 
     ShareGroupPtr         m_shareGroup;
diff --git a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLESpointer.h b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLESpointer.h
index b39c103..851fe45 100644
--- a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLESpointer.h
+++ b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLESpointer.h
@@ -30,6 +30,7 @@
     const GLvoid* getArrayData() const;
     GLvoid*       getBufferData() const;
     GLuint        getBufferName() const;
+    GLboolean     getNormalized() const { return m_normalize ? GL_TRUE : GL_FALSE; }
     const GLvoid* getData() const;
     unsigned int  getBufferOffset() const;
     void          redirectPointerData();