DEADSOFTWARE

Apply glColor when disabling color array
[nanogl.git] / nanoWrap.cpp
index 5c5eec805314a6a8deb061897e67b88e7b0e7d54..b9097386b430fd2920a8f23e63a567b96f2292b1 100644 (file)
@@ -1281,7 +1281,7 @@ void glTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei wid
 {
        unsigned char *data = (unsigned char*)pixels;
 
-       if( internalformat == GL_RGB && format == GL_RGBA ) // strip alpha from texture
+       if( pixels && internalformat == GL_RGB && format == GL_RGBA ) // strip alpha from texture
        {
                unsigned char *in = data, *out;
                int i = 0, size = width * height * 4;
@@ -1913,6 +1913,9 @@ void glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indi
                else
                {
                        glEsImpl->glDisableClientState( GL_COLOR_ARRAY );
+                       glEsImpl->glColor4f( currentVertexAttrib.red/255.0f, currentVertexAttrib.green/255.0f,
+                                       currentVertexAttrib.blue/255.0f, currentVertexAttrib.alpha/255.0f );
+
                }
                glEsImpl->glColorPointer( tmuState0.color_array.size,
                                          tmuState0.color_array.type,
@@ -2385,6 +2388,9 @@ void glDrawArrays( GLenum mode, GLint first, GLsizei count )
                else
                {
                        glEsImpl->glDisableClientState( GL_COLOR_ARRAY );
+                       glEsImpl->glColor4f( currentVertexAttrib.red/255.0f, currentVertexAttrib.green/255.0f,
+                                       currentVertexAttrib.blue/255.0f, currentVertexAttrib.alpha/255.0f );
+
                }
                glEsImpl->glColorPointer( tmuState0.color_array.size,
                                          tmuState0.color_array.type,