From 596855abbbf446028865548da89c4f677a8df8a3 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 31 Mar 2010 13:40:19 -0400 Subject: [PATCH] Fix vertex attribute array toggling, again. --- mojoshader_opengl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mojoshader_opengl.c b/mojoshader_opengl.c index 97df8f17..11d84471 100644 --- a/mojoshader_opengl.c +++ b/mojoshader_opengl.c @@ -1593,7 +1593,7 @@ static void update_enabled_arrays(void) // Enable/disable vertex arrays to match our needs. // this happens to work in both ARB1 and GLSL, but if something alien // shows up, we'll have to split these into profile*() functions. - for (i = 0; i <= ctx->max_attrs; i++) + for (i = 0; i < ctx->max_attrs; i++) { const int want = (const int) ctx->want_attr[i]; const int have = (const int) ctx->have_attr[i]; @@ -1607,7 +1607,7 @@ static void update_enabled_arrays(void) } // if if (want) - highest_enabled = i; + highest_enabled = i + 1; } // for ctx->max_attrs = highest_enabled; // trim unneeded iterations next time. @@ -1801,8 +1801,8 @@ void MOJOSHADER_glSetVertexAttribute(MOJOSHADER_usage usage, // flag this array as in use, so we can enable it later. ctx->want_attr[gl_index] = 1; - if (ctx->max_attrs < gl_index) - ctx->max_attrs = gl_index; + if (ctx->max_attrs < (gl_index + 1)) + ctx->max_attrs = gl_index + 1; } // MOJOSHADER_glSetVertexAttribute