From: mittorn Date: Sun, 18 Jun 2017 18:39:32 +0000 (+0000) Subject: Merge branch 'stupidglesbug-fix' of https://github.com/SDLash3D/nanogl X-Git-Url: http://deadsoftware.ru/gitweb?p=nanogl.git;a=commitdiff_plain;h=6896ce1e5f02d51b33223b1c22aad0818c32a4d8;hp=-c Merge branch 'stupidglesbug-fix' of https://github.com/SDLash3D/nanogl --- 6896ce1e5f02d51b33223b1c22aad0818c32a4d8 diff --combined GL/gl.h index d027d13,159d671..833e966 --- a/GL/gl.h +++ b/GL/gl.h @@@ -572,6 -572,8 +572,8 @@@ typedef int GLclampx #define glVertex3d glVertex3f //#define glColor4ub(x,y,z,p) glColor4f(x,y,z,p) //nicknekit: wtf??? #define glFogi glFogf + #define glActiveTextureARB glActiveTexture + #define glClientActiveTextureARB glClientActiveTexture // void glBegin( GLenum mode ); @@@ -665,15 -667,6 +667,15 @@@ void glTexParameterx( GLenum target, GL void glGenTextures( GLsizei n, GLuint *textures ); void glFrontFace( GLenum mode ); +// Rikku2000: Light +void glLightf( GLenum light, GLenum pname, GLfloat param ); +void glLightfv( GLenum light, GLenum pname, const GLfloat *params ); +void glLightModelf( GLenum pname, GLfloat param ); +void glLightModelfv( GLenum pname, const GLfloat *params ); +void glMaterialf( GLenum face, GLenum pname, GLfloat param ); +void glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); +void glColorMaterial( GLenum face, GLenum mode ); + //nicknekit: for xash3d void glColor3ub( GLubyte red, GLubyte green, GLubyte blue ); @@@ -724,6 -717,17 +726,17 @@@ void glMultiTexCoord2f( GLenum, GLfloat void glDrawArrays( GLenum mode, GLint first, GLsizei count ); + + void glBindBufferARB( GLuint target, GLuint index ); + + void glGenBuffersARB( GLuint count, GLuint *indexes ); + + void glDeleteBuffersARB( GLuint count, GLuint *indexes ); + + void glBufferDataARB( GLuint target, GLuint size, void *buffer, GLuint type ); + + void glBufferSubDataARB( GLuint target, GLsizei offset, GLsizei size, void *buffer ); + #ifdef __cplusplus } #endif diff --combined GL/glesinterface.h index 710dfd3,ce35d88..acb21be --- a/GL/glesinterface.h +++ b/GL/glesinterface.h @@@ -229,10 -229,6 +229,10 @@@ struct GlESInterfac void( APIENTRY *glOrtho )( double left, double right, double bottom, double top, double zNear, double zFar ) S; void( APIENTRY *glDepthRange )( double zNear, double zFar ) S; #endif + + // Rikku2000: Light + void( APIENTRY *glColorMaterial )( unsigned int face, unsigned int mode ) S; + void( APIENTRY *glGenFramebuffers )( unsigned int n, unsigned int *framebuffers ) S; void( APIENTRY *glGenRenderbuffers )( unsigned int n, unsigned int *renderbuffers ) S; void( APIENTRY *glRenderbufferStorage )( unsigned int target, unsigned int internalformat, unsigned int width, unsigned int height ) S; @@@ -242,6 -238,8 +242,8 @@@ void( APIENTRY *glDeleteRenderbuffers )( unsigned int n, const unsigned int *renderbuffers ) S; void( APIENTRY *glDeleteFramebuffers )( unsigned int n, const unsigned int *framebuffers ) S; void( APIENTRY *glFramebufferRenderbuffer )( unsigned int target, unsigned int attachment, unsigned int renderbuffertarget, unsigned int renderbuffer ) S; + void( APIENTRY *glTexGenfvOES )(unsigned int coord, unsigned int pname, const float *params); + void( APIENTRY *glTexGeniOES )(unsigned int coord, unsigned int pname, int param); }; #if !defined( __WINS__ ) #if defined( __TARGET_FPU_VFP ) diff --combined nanoWrap.cpp index 8fc8290,3a6fb38..41eb4dd --- a/nanoWrap.cpp +++ b/nanoWrap.cpp @@@ -44,14 -44,7 +44,14 @@@ struct nanoStat GLboolean depth_test; GLboolean dither; GLboolean fog; - GLboolean lighti; + GLboolean light0; + GLboolean light1; + GLboolean light2; + GLboolean light3; + GLboolean light4; + GLboolean light5; + GLboolean light6; + GLboolean light7; GLboolean lighting; GLboolean line_smooth; GLboolean matrix_palette_oes; @@@ -67,6 -60,7 +67,7 @@@ GLboolean scissor_test; GLboolean stencil_test; GLboolean depthmask; + GLboolean stupidglesbug; GLclampf depth_range_near; GLclampf depth_range_far; GLenum depth_func; @@@ -80,7 -74,7 +81,7 @@@ static struct nanoState nanoglState; static struct nanoState nanoglInitState = - { + { GL_FALSE, GL_FALSE, GL_FALSE, @@@ -94,13 -88,6 +95,13 @@@ GL_FALSE, GL_FALSE, GL_FALSE, + GL_FALSE, + GL_FALSE, + GL_FALSE, + GL_FALSE, + GL_FALSE, + GL_FALSE, + GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE, @@@ -113,6 -100,7 +114,7 @@@ GL_FALSE, GL_FALSE, GL_TRUE, + GL_FALSE, 0.0f, 1.0f, GL_LESS, @@@ -244,6 -232,8 +246,8 @@@ static GLushort *ptrIndexArray = NULL static GLboolean arraysValid = GL_FALSE; + static GLboolean skipnanogl; + void InitGLStructs( ) { ptrVertexAttribArray = vertexattribs; @@@ -329,7 -319,8 +333,8 @@@ void ResetNanoState( glEsImpl->glMatrixMode( nanoglState.matrixmode ); - glEsImpl->glColor4f( currentVertexAttrib.red, currentVertexAttrib.green, currentVertexAttrib.blue, currentVertexAttrib.alpha ); + glEsImpl->glColor4f( currentVertexAttrib.red/255.0f, currentVertexAttrib.green/255.0f, + currentVertexAttrib.blue/255.0f, currentVertexAttrib.alpha/255.0f ); glEsImpl->glBlendFunc( nanoglState.sfactor, nanoglState.dfactor ); @@@ -338,10 -329,13 +343,13 @@@ glEsImpl->glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, activetmuState->texture_env_mode.value ); arraysValid = GL_FALSE; + skipnanogl = GL_FALSE; } void FlushOnStateChange( ) { + if( skipnanogl ) + return; if ( delayedttmuchange ) { delayedttmuchange = GL_FALSE; @@@ -499,7 -493,7 +507,7 @@@ void glEnd( void *ptrIndexArray++ = indexCount++; *ptrIndexArray++ = indexCount++; *ptrIndexArray++ = indexCount++; - int vcount = ( ( vertexCount - vertexMark ) - 3 ); + int vcount = ( ( vertexCount - vertexMark ) - 3 ); for ( int count = 0; count < vcount; count++ ) { *ptrIndexArray++ = indexbase; @@@ -520,6 -514,11 +528,11 @@@ void glEnable( GLenum cap ) { + if( skipnanogl ) + { + glEsImpl->glEnable( cap ); + return; + } GLboolean statechanged = GL_FALSE; switch ( cap ) { @@@ -588,86 -587,15 +601,86 @@@ break; } case GL_FOG: - //case GL_LIGHTi + { + if ( !nanoglState.fog ) { - if ( !nanoglState.fog ) - { - nanoglState.fog = GL_TRUE; - statechanged = GL_TRUE; - } - break; + nanoglState.fog = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT0: + { + if ( !nanoglState.light0 ) + { + nanoglState.light0 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT1: + { + if ( !nanoglState.light1 ) + { + nanoglState.light1 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT2: + { + if ( !nanoglState.light2 ) + { + nanoglState.light2 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT3: + { + if ( !nanoglState.light3 ) + { + nanoglState.light3 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT4: + { + if ( !nanoglState.light4 ) + { + nanoglState.light4 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT5: + { + if ( !nanoglState.light5 ) + { + nanoglState.light5 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT6: + { + if ( !nanoglState.light6 ) + { + nanoglState.light6 = GL_TRUE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT7: + { + if ( !nanoglState.light7 ) + { + nanoglState.light7 = GL_TRUE; + statechanged = GL_TRUE; } + break; + } case GL_LIGHTING: { if ( !nanoglState.lighting ) @@@ -779,11 -707,11 +792,11 @@@ case GL_STENCIL_TEST: { return; - /* if (!nanoglState.stencil_test) + if (!nanoglState.stencil_test) { nanoglState.stencil_test = GL_TRUE; statechanged = GL_TRUE; - }*/ + } break; } case GL_TEXTURE_2D: @@@ -797,6 -725,17 +810,17 @@@ } break; } + #if 0 // todo: implement cubemap texgen + case GL_TEXTURE_GEN_S: + case GL_TEXTURE_GEN_T: + case GL_TEXTURE_GEN_R: + case GL_TEXTURE_GEN_Q: + { + FlushOnStateChange( ); + nanoglState.texgen = true; + return; + } + #endif default: break; } @@@ -810,6 -749,11 +834,11 @@@ void glDisable( GLenum cap ) { + if( skipnanogl ) + { + glEsImpl->glDisable( cap ); + return; + } GLboolean statechanged = GL_FALSE; switch ( cap ) { @@@ -878,86 -822,15 +907,86 @@@ break; } case GL_FOG: - //case GL_LIGHTi + { + if ( nanoglState.fog ) { - if ( nanoglState.fog ) - { - nanoglState.fog = GL_FALSE; - statechanged = GL_TRUE; - } - break; + nanoglState.fog = GL_FALSE; + statechanged = GL_TRUE; } + break; + } + case GL_LIGHT0: + { + if ( !nanoglState.light0 ) + { + nanoglState.light0 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT1: + { + if ( !nanoglState.light1 ) + { + nanoglState.light1 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT2: + { + if ( !nanoglState.light2 ) + { + nanoglState.light2 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT3: + { + if ( !nanoglState.light3 ) + { + nanoglState.light3 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT4: + { + if ( !nanoglState.light4 ) + { + nanoglState.light4 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT5: + { + if ( !nanoglState.light5 ) + { + nanoglState.light5 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT6: + { + if ( !nanoglState.light6 ) + { + nanoglState.light6 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } + case GL_LIGHT7: + { + if ( !nanoglState.light7 ) + { + nanoglState.light7 = GL_FALSE; + statechanged = GL_TRUE; + } + break; + } case GL_LIGHTING: { if ( nanoglState.lighting ) @@@ -1069,11 -942,11 +1098,11 @@@ case GL_STENCIL_TEST: { return; - /* if (nanoglState.stencil_test) + if (nanoglState.stencil_test) { nanoglState.stencil_test = GL_FALSE; statechanged = GL_TRUE; - }*/ + } break; } case GL_TEXTURE_2D: @@@ -1087,6 -960,17 +1116,17 @@@ } break; } + #if 0 + case GL_TEXTURE_GEN_S: + case GL_TEXTURE_GEN_T: + case GL_TEXTURE_GEN_R: + case GL_TEXTURE_GEN_Q: + { + FlushOnStateChange( ); + nanoglState.texgen = false; + return; + } + #endif default: break; } @@@ -1145,10 -1029,19 +1185,19 @@@ void glLoadIdentity( void } void glColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) - { - currentVertexAttrib.red = (unsigned char)ClampTo255( red * 255.0f ); - currentVertexAttrib.green = (unsigned char)ClampTo255( green * 255.0f ); - currentVertexAttrib.blue = (unsigned char)ClampTo255( blue * 255.0f ); + { + if( nanoglState.stupidglesbug ) + { + currentVertexAttrib.red = (unsigned char)ClampTo255( ( red * alpha ) * 255.0f ); + currentVertexAttrib.green = (unsigned char)ClampTo255( ( green * alpha ) * 255.0f ); + currentVertexAttrib.blue = (unsigned char)ClampTo255( ( blue * alpha ) * 255.0f ); + } + else + { + currentVertexAttrib.red = (unsigned char)ClampTo255( red * 255.0f ); + currentVertexAttrib.green = (unsigned char)ClampTo255( green * 255.0f ); + currentVertexAttrib.blue = (unsigned char)ClampTo255( blue * 255.0f ); + } currentVertexAttrib.alpha = (unsigned char)ClampTo255( alpha * 255.0f ); } @@@ -1162,50 -1055,6 +1211,50 @@@ void glOrtho( GLfloat left, GLfloat rig #endif } +// Rikku2000: Light +void glLightf( GLenum light, GLenum pname, GLfloat param ) +{ + FlushOnStateChange( ); + + glEsImpl->glLightf( light, pname, param ); +} +void glLightfv( GLenum light, GLenum pname, const GLfloat *params ) +{ + FlushOnStateChange( ); + + glEsImpl->glLightfv( light, pname, params ); +} +void glLightModelf( GLenum pname, GLfloat param ) +{ + FlushOnStateChange( ); + + glEsImpl->glLightModelf( pname, param ); +} +void glLightModelfv( GLenum pname, const GLfloat *params ) +{ + FlushOnStateChange( ); + + glEsImpl->glLightModelfv( pname, params ); +} +void glMaterialf( GLenum face, GLenum pname, GLfloat param ) +{ + FlushOnStateChange( ); + + glEsImpl->glMaterialf( face, pname, param ); +} +void glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ) +{ + FlushOnStateChange( ); + + glEsImpl->glMaterialfv( face, pname, params ); +} +void glColorMaterial( GLenum face, GLenum mode ) +{ + FlushOnStateChange( ); + + glEsImpl->glColorMaterial( face, mode ); +} + void glMatrixMode( GLenum mode ) { if ( nanoglState.matrixmode == mode ) @@@ -1344,7 -1193,7 +1393,7 @@@ void glVertex3f( GLfloat x, GLfloat y, GLfloat *vert = (GLfloat *)ptrVertexAttribArray++; *vert++ = x; *vert++ = y; - *vert++ = z; + *vert++ = z; #if defined( __MULTITEXTURE_SUPPORT__ ) memcpy( vert, ¤tVertexAttrib.red, 5 * sizeof( GLfloat ) ); #else @@@ -1353,11 -1202,23 +1402,23 @@@ } void glColor4fv( const GLfloat *v ) - { - currentVertexAttrib.red = (unsigned char)ClampTo255( v[0] * 255.0f ); - currentVertexAttrib.green = (unsigned char)ClampTo255( v[1] * 255.0f ); - currentVertexAttrib.blue = (unsigned char)ClampTo255( v[2] * 255.0f ); + { + if( nanoglState.stupidglesbug ) + { + currentVertexAttrib.red = (unsigned char)ClampTo255( ( v[0] * v[3] ) * 255.0f ); + currentVertexAttrib.green = (unsigned char)ClampTo255( ( v[1] * v[3] ) * 255.0f ); + currentVertexAttrib.blue = (unsigned char)ClampTo255( ( v[2] * v[3] ) * 255.0f ); + } + else + { + currentVertexAttrib.red = (unsigned char)ClampTo255( v[0] * 255.0f ); + currentVertexAttrib.green = (unsigned char)ClampTo255( v[1] * 255.0f ); + currentVertexAttrib.blue = (unsigned char)ClampTo255( v[2] * 255.0f ); + } currentVertexAttrib.alpha = (unsigned char)ClampTo255( v[3] * 255.0f ); + if( skipnanogl ) + glEsImpl->glColor4f( currentVertexAttrib.red/255.0f, currentVertexAttrib.green/255.0f, + currentVertexAttrib.blue/255.0f, currentVertexAttrib.alpha/255.0f ); } void glColor3ubv( const GLubyte *v ) @@@ -1366,15 -1227,30 +1427,30 @@@ currentVertexAttrib.green = v[1]; currentVertexAttrib.blue = v[2]; currentVertexAttrib.alpha = 255; + if( skipnanogl ) + glEsImpl->glColor4f( currentVertexAttrib.red/255.0f, currentVertexAttrib.green/255.0f, + currentVertexAttrib.blue/255.0f, currentVertexAttrib.alpha/255.0f ); } void glColor4ubv( const GLubyte *v ) { //*((unsigned int*)(¤tVertexAttrib.red)) = *((unsigned int*)(v)); - currentVertexAttrib.red = v[0]; - currentVertexAttrib.green = v[1]; - currentVertexAttrib.blue = v[2]; + if( nanoglState.stupidglesbug ) + { + currentVertexAttrib.red = (unsigned char)ClampTo255( v[0] * v[3] / 255.0f ); + currentVertexAttrib.green = (unsigned char)ClampTo255( v[1] * v[3] / 255.0f ); + currentVertexAttrib.blue = (unsigned char)ClampTo255( v[2] * v[3] / 255.0f ); + } + else + { + currentVertexAttrib.red = v[0]; + currentVertexAttrib.green = v[1]; + currentVertexAttrib.blue = v[2]; + } currentVertexAttrib.alpha = v[3]; + if( skipnanogl ) + glEsImpl->glColor4f( currentVertexAttrib.red/255.0f, currentVertexAttrib.green/255.0f, + currentVertexAttrib.blue/255.0f, currentVertexAttrib.alpha/255.0f ); } void glColor3fv( const GLfloat *v ) @@@ -1383,16 -1259,31 +1459,31 @@@ currentVertexAttrib.green = (unsigned char)ClampTo255( v[1] * 255.0f ); currentVertexAttrib.blue = (unsigned char)ClampTo255( v[2] * 255.0f ); currentVertexAttrib.alpha = 255; + if( skipnanogl ) + glEsImpl->glColor4f( currentVertexAttrib.red/255.0f, currentVertexAttrib.green/255.0f, + currentVertexAttrib.blue/255.0f, currentVertexAttrib.alpha/255.0f ); } //-- nicknekit: xash3d funcs -- void glColor4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) { - currentVertexAttrib.red = red; - currentVertexAttrib.green = green; - currentVertexAttrib.blue = blue; + if( nanoglState.stupidglesbug ) + { + currentVertexAttrib.red = (unsigned char)ClampTo255( red * alpha / 255.0f ); + currentVertexAttrib.green = (unsigned char)ClampTo255( green * alpha / 255.0f ); + currentVertexAttrib.blue = (unsigned char)ClampTo255( blue * alpha / 255.0f ); + } + else + { + currentVertexAttrib.red = red; + currentVertexAttrib.green = green; + currentVertexAttrib.blue = blue; + } currentVertexAttrib.alpha = alpha; + if( skipnanogl ) + glEsImpl->glColor4f( currentVertexAttrib.red/255.0f, currentVertexAttrib.green/255.0f, + currentVertexAttrib.blue/255.0f, currentVertexAttrib.alpha/255.0f ); } void glColor3ub( GLubyte red, GLubyte green, GLubyte blue ) @@@ -1401,6 -1292,9 +1492,9 @@@ currentVertexAttrib.green = green; currentVertexAttrib.blue = blue; currentVertexAttrib.alpha = 255; + if( skipnanogl ) + glEsImpl->glColor4f( currentVertexAttrib.red/255.0f, currentVertexAttrib.green/255.0f, + currentVertexAttrib.blue/255.0f, currentVertexAttrib.alpha/255.0f ); } void glNormal3fv( const GLfloat *v ) @@@ -1446,14 -1340,18 +1540,18 @@@ GLboolean glIsTexture( GLuint texture return glEsImpl->glIsTexture( texture ); } + // TODO: add native normal/reflection map texgen support + void glTexGeni( GLenum coord, GLenum pname, GLint param ) { - //for mirrors? not needed for original hl? + FlushOnStateChange(); + //glEsImpl->glTexGeniOES( coord, pname, param ); } void glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) { - //for mirrors? not needed for original hl? + FlushOnStateChange(); + //glEsImpl->glTexGenfvOES( coord, pname, params ); } //-- --// @@@ -1466,10 -1364,24 +1564,24 @@@ void glHint( GLenum target, GLenum mod void glBlendFunc( GLenum sfactor, GLenum dfactor ) { + if( skipnanogl ) + { + glEsImpl->glBlendFunc( sfactor, dfactor ); + return; + } if ( ( nanoglState.sfactor == sfactor ) && ( nanoglState.dfactor == dfactor ) ) { return; } + + if( sfactor == GL_SRC_ALPHA && dfactor == GL_ONE ) + { + sfactor = GL_ONE; // workaround gles bug + nanoglState.stupidglesbug = GL_TRUE; + } + else + nanoglState.stupidglesbug = GL_FALSE; + nanoglState.sfactor = sfactor; nanoglState.dfactor = dfactor; FlushOnStateChange( ); @@@ -1501,6 -1413,11 +1613,11 @@@ void glPushMatrix( void void glTexEnvf( GLenum target, GLenum pname, GLfloat param ) { + if( skipnanogl ) + { + glEsImpl->glTexEnvf( target, pname, param ); + return; + } if ( target == GL_TEXTURE_ENV ) { if ( pname == GL_TEXTURE_ENV_MODE ) @@@ -1535,17 -1452,25 +1652,25 @@@ void glVertex3fv( const GLfloat *v void glDepthMask( GLboolean flag ) { + if( !skipnanogl ) + { if ( nanoglState.depthmask == flag ) { return; } nanoglState.depthmask = flag; FlushOnStateChange( ); + } glEsImpl->glDepthMask( flag ); } void glBindTexture( GLenum target, GLuint texture ) { + if( skipnanogl ) + { + glEsImpl->glBindTexture( target,texture ); + return; + } if ( activetmuState->boundtexture.value == texture ) { return; @@@ -1631,6 -1556,11 +1756,11 @@@ GLenum glGetError( void void glActiveTexture( GLenum texture ) { + if( skipnanogl ) + { + glEsImpl->glActiveTexture( texture ); + return; + } if ( activetmu == texture ) { return; @@@ -1657,6 -1587,11 +1787,11 @@@ void glClientActiveTexture( GLenum texture ) { + if( skipnanogl ) + { + glEsImpl->glClientActiveTexture( texture ); + return; + } clientactivetmu = texture; } @@@ -1724,6 -1659,11 +1859,11 @@@ struct ptrstate texture_coord_array void glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) { + if( skipnanogl ) + { + glEsImpl->glDrawElements( mode, count, type, indices ); + return; + } // ensure that all primitives specified between glBegin/glEnd pairs // are rendered first, and that we have correct tmu in use.. FlushOnStateChange( ); @@@ -1821,8 -1761,17 +1961,17 @@@ glEsImpl->glDrawElements( mode, count, type, indices ); } + bool vboarray; + void glEnableClientState( GLenum array ) { + if( skipnanogl ) + { + glEsImpl->glEnableClientState( array ); + if( array == GL_VERTEX_ARRAY ) + vboarray = true; + return; + } struct nanotmuState *clientstate = NULL; if ( clientactivetmu == GL_TEXTURE0 ) { @@@ -1878,6 -1827,13 +2027,13 @@@ } void glDisableClientState( GLenum array ) { + if( skipnanogl ) + { + glEsImpl->glDisableClientState( array ); + if( array == GL_VERTEX_ARRAY ) + vboarray = false; + return; + } struct nanotmuState *clientstate = NULL; if ( clientactivetmu == GL_TEXTURE0 ) { @@@ -1933,6 -1889,12 +2089,12 @@@ } void glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) { + + if( skipnanogl ) + { + glEsImpl->glVertexPointer( size, type, stride, pointer ); + return; + } if ( tmuState0.vertex_array.size == size && tmuState0.vertex_array.stride == stride && tmuState0.vertex_array.type == type && @@@ -1948,6 -1910,11 +2110,11 @@@ } void glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) { + if( skipnanogl ) + { + glEsImpl->glTexCoordPointer( size, type, stride, pointer ); + return; + } struct nanotmuState *clientstate = NULL; if ( clientactivetmu == GL_TEXTURE0 ) { @@@ -2117,6 -2084,11 +2284,11 @@@ void glFrontFace( GLenum mode void glTexEnvi( GLenum target, GLenum pname, GLint param ) { + if( skipnanogl ) + { + glEsImpl->glTexEnvi( target, pname, param ); + return; + } if ( target == GL_TEXTURE_ENV ) { if ( pname == GL_TEXTURE_ENV_MODE ) @@@ -2144,12 -2116,18 +2316,18 @@@ void glMultiTexCoord3fARB( GLenum a, GL return glMultiTexCoord2fARB( a, b, c ); } - void glMultiTexCoord2f( GLenum, GLfloat, GLfloat ) + void glMultiTexCoord2f( GLenum a, GLfloat b, GLfloat c ) { + glMultiTexCoord2fARB(a,b,c); } #endif void glDrawArrays( GLenum mode, GLint first, GLsizei count ) { + if( skipnanogl ) + { + glEsImpl->glDrawArrays( mode, first, count ); + return; + } // ensure that all primitives specified between glBegin/glEnd pairs // are rendered first, and that we have correct tmu in use.. if ( mode == GL_QUADS ) @@@ -2311,3 -2289,42 +2489,42 @@@ void glRenderbufferStorage( GLenum targ FlushOnStateChange( ); glEsImpl->glRenderbufferStorage( target, internalformat, width, height ); } + + void glBindBufferARB( GLuint target, GLuint index ) + { + static int sindex; + + if( index && !sindex && !skipnanogl ) + FlushOnStateChange(); + glEsImpl->glDisableClientState( GL_COLOR_ARRAY ); + glEsImpl->glColor4f( currentVertexAttrib.red/255.0f, currentVertexAttrib.green/255.0f, + currentVertexAttrib.blue/255.0f, currentVertexAttrib.alpha/255.0f ); + + skipnanogl = (!!index) || vboarray; + glEsImpl->glBindBuffer( target, index ); + if( sindex && !index ) + { + arraysValid = GL_FALSE; + } + sindex = index; + } + + void glGenBuffersARB( GLuint count, GLuint *indexes ) + { + glEsImpl->glGenBuffers( count, indexes ); + } + + void glDeleteBuffersARB( GLuint count, GLuint *indexes ) + { + glEsImpl->glDeleteBuffers( count, indexes ); + } + + void glBufferDataARB( GLuint target, GLuint size, void *buffer, GLuint type ) + { + glEsImpl->glBufferData( target, size, buffer, type ); + } + + void glBufferSubDataARB( GLuint target, GLsizei offset, GLsizei size, void *buffer ) + { + glEsImpl->glBufferSubData( target, offset, size, buffer ); + }