diff options
author | Brian Paul <[email protected]> | 2000-03-06 17:03:03 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2000-03-06 17:03:03 +0000 |
commit | 7fc29c5fa7b1fc2cc014c7128ac869d0d3c24c7f (patch) | |
tree | 9a78ca861a6bc01f0fbad9be13f2547ede5fb492 /src | |
parent | 3f600e47cf36080abbc00a1f08c7e80fd5137a67 (diff) |
fixed off-by-one errors in matrix stack setup/cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/context.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index eb3b7a8121b..b1d922f6515 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.44 2000/03/03 17:47:39 brianp Exp $ */ +/* $Id: context.c,v 1.45 2000/03/06 17:03:03 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -775,7 +775,7 @@ static void init_attrib_groups( GLcontext *ctx ) gl_matrix_alloc_inv( &ctx->ModelView ); ctx->ModelViewStackDepth = 0; - for (i = 0 ; i < MAX_MODELVIEW_STACK_DEPTH ; i++) { + for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) { gl_matrix_ctr( &ctx->ModelViewStack[i] ); gl_matrix_alloc_inv( &ctx->ModelViewStack[i] ); } @@ -792,7 +792,7 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->NearFarStack[0][0] = 1.0; /* These values seem weird by make */ ctx->NearFarStack[0][1] = 0.0; /* sense mathematically. */ - for (i = 0 ; i < MAX_PROJECTION_STACK_DEPTH ; i++) { + for (i = 0; i < MAX_PROJECTION_STACK_DEPTH - 1; i++) { gl_matrix_ctr( &ctx->ProjectionStack[i] ); gl_matrix_alloc_inv( &ctx->ProjectionStack[i] ); } @@ -801,7 +801,7 @@ static void init_attrib_groups( GLcontext *ctx ) for (i=0; i<MAX_TEXTURE_UNITS; i++) { gl_matrix_ctr( &ctx->TextureMatrix[i] ); ctx->TextureStackDepth[i] = 0; - for (j = 0 ; j < MAX_TEXTURE_STACK_DEPTH ; j++) { + for (j = 0; j < MAX_TEXTURE_STACK_DEPTH - 1; j++) { ctx->TextureStack[i][j].inv = 0; } } @@ -1446,8 +1446,8 @@ GLcontext *gl_create_context( GLvisual *visual, */ void gl_free_context_data( GLcontext *ctx ) { - GLuint i; struct gl_shine_tab *s, *tmps; + GLuint i, j; /* if we're destroying the current context, unbind it first */ if (ctx == gl_get_current_context()) { @@ -1461,13 +1461,19 @@ void gl_free_context_data( GLcontext *ctx ) #endif gl_matrix_dtr( &ctx->ModelView ); - for (i = 0 ; i < MAX_MODELVIEW_STACK_DEPTH ; i++) { + for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) { gl_matrix_dtr( &ctx->ModelViewStack[i] ); } gl_matrix_dtr( &ctx->ProjectionMatrix ); - for (i = 0 ; i < MAX_PROJECTION_STACK_DEPTH ; i++) { + for (i = 0; i < MAX_PROJECTION_STACK_DEPTH - 1; i++) { gl_matrix_dtr( &ctx->ProjectionStack[i] ); } + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + gl_matrix_dtr( &ctx->TextureMatrix[i] ); + for (j = 0; j < MAX_TEXTURE_STACK_DEPTH - 1; j++) { + gl_matrix_dtr( &ctx->TextureStack[i][j] ); + } + } FREE( ctx->PB ); |