diff --git a/project/jni/glshim/src/gl/gl.c b/project/jni/glshim/src/gl/gl.c index 227aea21c..59297bb27 100755 --- a/project/jni/glshim/src/gl/gl.c +++ b/project/jni/glshim/src/gl/gl.c @@ -700,7 +700,7 @@ void glshim_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid list = glstate.list.active; normalize_indices(sindices, &max, &min, count); - list = arrays_to_renderlist(list, mode, min, max + 1 + min); + list = arrays_to_renderlist(list, mode, 0, max + 1 - min); list->indices = sindices; list->ilen = count; list->indice_cap = count; @@ -715,7 +715,7 @@ void glshim_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid GLsizei min, max; normalize_indices(sindices, &max, &min, count); - list = arrays_to_renderlist(list, mode, min, max + 1 + min); + list = arrays_to_renderlist(list, mode, 0, max + 1 - min); list->indices = sindices; list->ilen = count; list->indice_cap = count; diff --git a/project/jni/glshim/src/gl/state.h b/project/jni/glshim/src/gl/state.h index 8c0ecb753..03ee69d6d 100755 --- a/project/jni/glshim/src/gl/state.h +++ b/project/jni/glshim/src/gl/state.h @@ -109,6 +109,7 @@ typedef enum { } statbatch_enabled_t; typedef struct { + int active_tex_changed; GLenum active_tex; // only 1 active texture for now GLenum bound_targ; GLenum bound_tex; diff --git a/project/jni/glshim/src/gl/texture.c b/project/jni/glshim/src/gl/texture.c index b9049542e..b39489b58 100755 --- a/project/jni/glshim/src/gl/texture.c +++ b/project/jni/glshim/src/gl/texture.c @@ -1494,13 +1494,13 @@ void glshim_glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type void glshim_glActiveTexture( GLenum texture ) { if (glstate.list.active && (glstate.gl_batch && !glstate.list.compiling)) { - if ((glstate.statebatch.active_tex == texture)) - return; // nothing to do... - if (!glstate.statebatch.active_tex) { - glstate.statebatch.active_tex = texture; - } else { + if (glstate.statebatch.active_tex_changed) { + if(glstate.statebatch.active_tex == texture) + return; // nothing to do... flush(); } + glstate.statebatch.active_tex = texture; + glstate.statebatch.active_tex_changed = 1; } if (glstate.list.active) { NewStage(glstate.list.active, STAGE_ACTIVETEX);