DEADSOFTWARE

Added glIsEnabled
[nanogl.git] / nanoWrap.cpp
index 5c5eec805314a6a8deb061897e67b88e7b0e7d54..9cf8c7c2055bc96645be154220b88f2da5c6119c 100644 (file)
@@ -789,12 +789,11 @@ void glEnable( GLenum cap )
        }
        case GL_STENCIL_TEST:
        {
-               return;
                if (!nanoglState.stencil_test)
-                {
-                nanoglState.stencil_test = GL_TRUE;
-                statechanged = GL_TRUE;
-                }
+               {
+                       nanoglState.stencil_test = GL_TRUE;
+                       statechanged = GL_TRUE;
+               }
                break;
        }
        case GL_TEXTURE_2D:
@@ -1095,12 +1094,11 @@ void glDisable( GLenum cap )
        }
        case GL_STENCIL_TEST:
        {
-               return;
                if (nanoglState.stencil_test)
-                {
-                nanoglState.stencil_test = GL_FALSE;
-                statechanged = GL_TRUE;
-                }
+               {
+                       nanoglState.stencil_test = GL_FALSE;
+                       statechanged = GL_TRUE;
+               }
                break;
        }
        case GL_TEXTURE_2D:
@@ -1281,7 +1279,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;
@@ -1858,12 +1856,18 @@ void glCallList( GLuint list )
 }
 void glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha )
 {
+       FlushOnStateChange( );
+       glEsImpl->glColorMask( red, green, blue, alpha );       
 }
 void glStencilFunc( GLenum func, GLint ref, GLuint mask )
 {
+       FlushOnStateChange( );
+       glEsImpl->glStencilFunc( func, ref, mask );     
 }
 void glStencilOp( GLenum fail, GLenum zfail, GLenum zpass )
 {
+       FlushOnStateChange( );
+       glEsImpl->glStencilOp( fail, zfail, zpass );
 }
 
 struct ptrstate vertex_array;
@@ -1913,6 +1917,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,
@@ -2189,9 +2196,13 @@ void glPolygonOffset( GLfloat factor, GLfloat units )
 }
 void glStencilMask( GLuint mask )
 {
+       FlushOnStateChange( );
+       glEsImpl->glStencilMask( mask );
 }
 void glClearStencil( GLint s )
 {
+       FlushOnStateChange( );
+       glEsImpl->glClearStencil( s );
 }
 
 #if defined( __MULTITEXTURE_SUPPORT__ )
@@ -2385,6 +2396,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,