From: Brian Paul Date: Tue, 1 Apr 2003 18:16:33 +0000 (+0000) Subject: fix GL_LIST_MODE, GL_CURRENT_MATRIX_STACK_DEPTH_NV and GL_CURRENT_MATRIX_NV queries X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=525f04389f7f73ae2651f97590331d216b8ac10d;p=mesa.git fix GL_LIST_MODE, GL_CURRENT_MATRIX_STACK_DEPTH_NV and GL_CURRENT_MATRIX_NV queries --- diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 54f2832846e..68a95e9af0a 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.106 2003/03/01 01:50:21 brianp Exp $ */ +/* $Id: get.c,v 1.107 2003/04/01 18:16:33 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -475,8 +475,12 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL( ctx->CurrentListNum ); break; case GL_LIST_MODE: - *params = ENUM_TO_BOOL( ctx->ExecuteFlag - ? GL_COMPILE_AND_EXECUTE : GL_COMPILE ); + if (!ctx->CompileFlag) + *params = 0; + else if (ctx->ExecuteFlag) + *params = ENUM_TO_BOOL(GL_COMPILE_AND_EXECUTE); + else + *params = ENUM_TO_BOOL(GL_COMPILE); break; case GL_INDEX_LOGIC_OP: *params = ctx->Color.IndexLogicOpEnabled; @@ -1373,11 +1377,12 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_CURRENT_MATRIX_STACK_DEPTH_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); - *params = (ctx->CurrentStack->Depth > 0) ? GL_TRUE : GL_FALSE; + *params = GL_TRUE; break; case GL_CURRENT_MATRIX_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); - *params = (ctx->Transform.MatrixMode != 0) ? GL_TRUE : GL_FALSE; + for (i = 0; i < 16; i++) + params[i] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[i]); break; case GL_VERTEX_PROGRAM_BINDING_NV: CHECK_EXTENSION_B(NV_vertex_program, pname); @@ -1877,8 +1882,12 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->CurrentListNum; break; case GL_LIST_MODE: - *params = ctx->ExecuteFlag ? ENUM_TO_DOUBLE(GL_COMPILE_AND_EXECUTE) - : ENUM_TO_DOUBLE(GL_COMPILE); + if (!ctx->CompileFlag) + *params = 0.0; + else if (ctx->ExecuteFlag) + *params = ENUM_TO_DOUBLE(GL_COMPILE_AND_EXECUTE); + else + *params = ENUM_TO_DOUBLE(GL_COMPILE); break; case GL_INDEX_LOGIC_OP: *params = (GLdouble) ctx->Color.IndexLogicOpEnabled; @@ -2772,11 +2781,12 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; case GL_CURRENT_MATRIX_STACK_DEPTH_NV: CHECK_EXTENSION_D(NV_vertex_program, pname); - *params = (GLdouble) ctx->CurrentStack->Depth; + *params = (GLdouble) ctx->CurrentStack->Depth + 1; break; case GL_CURRENT_MATRIX_NV: CHECK_EXTENSION_D(NV_vertex_program, pname); - *params = (GLdouble) ctx->Transform.MatrixMode; + for (i = 0; i < 16; i++) + params[i] = (GLdouble) ctx->CurrentStack->Top->m[i]; break; case GL_VERTEX_PROGRAM_BINDING_NV: CHECK_EXTENSION_D(NV_vertex_program, pname); @@ -3274,8 +3284,12 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->CurrentListNum; break; case GL_LIST_MODE: - *params = ctx->ExecuteFlag ? ENUM_TO_FLOAT(GL_COMPILE_AND_EXECUTE) - : ENUM_TO_FLOAT(GL_COMPILE); + if (!ctx->CompileFlag) + *params = 0.0F; + else if (ctx->ExecuteFlag) + *params = ENUM_TO_FLOAT(GL_COMPILE_AND_EXECUTE); + else + *params = ENUM_TO_FLOAT(GL_COMPILE); break; case GL_INDEX_LOGIC_OP: *params = (GLfloat) ctx->Color.IndexLogicOpEnabled; @@ -4145,11 +4159,12 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_CURRENT_MATRIX_STACK_DEPTH_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); - *params = (GLfloat) ctx->CurrentStack->Depth; + *params = (GLfloat) ctx->CurrentStack->Depth + 1; break; case GL_CURRENT_MATRIX_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); - *params = (GLfloat) ctx->Transform.MatrixMode; + for (i = 0; i < 16; i++) + params[i] = ctx->CurrentStack->Top->m[i]; break; case GL_VERTEX_PROGRAM_BINDING_NV: CHECK_EXTENSION_F(NV_vertex_program, pname); @@ -4648,8 +4663,12 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = (GLint) ctx->CurrentListNum; break; case GL_LIST_MODE: - *params = ctx->ExecuteFlag ? (GLint) GL_COMPILE_AND_EXECUTE - : (GLint) GL_COMPILE; + if (!ctx->CompileFlag) + *params = 0; + else if (ctx->ExecuteFlag) + *params = (GLint) GL_COMPILE_AND_EXECUTE; + else + *params = (GLint) GL_COMPILE; break; case GL_INDEX_LOGIC_OP: *params = (GLint) ctx->Color.IndexLogicOpEnabled; @@ -5556,11 +5575,12 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_CURRENT_MATRIX_STACK_DEPTH_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); - *params = ctx->CurrentStack->Depth; + *params = ctx->CurrentStack->Depth + 1; break; case GL_CURRENT_MATRIX_NV: CHECK_EXTENSION_I(NV_vertex_program, pname); - *params = (GLint) ctx->Transform.MatrixMode; + for (i = 0; i < 16; i++) + params[i] = (GLint) ctx->CurrentStack->Top->m[i]; break; case GL_VERTEX_PROGRAM_BINDING_NV: CHECK_EXTENSION_I(NV_vertex_program, pname);