diff options
| author | Brian Paul <brian.paul@tungstengraphics.com> | 2001-03-19 22:45:52 +0000 | 
|---|---|---|
| committer | Brian Paul <brian.paul@tungstengraphics.com> | 2001-03-19 22:45:52 +0000 | 
| commit | 4e856077b798c70e14c2d0bb5ea27be9cc87e5c8 (patch) | |
| tree | 91a697b39afd9c45f0583f9bf29eef29776e96f5 | |
| parent | 6507d9249d8bd47bc6aad10b9b3bb570edf2b84f (diff) | |
fix for gl_ztrick bug (Ove Kaaven)
| -rw-r--r-- | src/mesa/main/matrix.c | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 466911c987..a2b7af02ba 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -1,4 +1,4 @@ -/* $Id: matrix.c,v 1.33 2001/03/03 20:33:27 brianp Exp $ */ +/* $Id: matrix.c,v 1.34 2001/03/19 22:45:52 brianp Exp $ */  /*   * Mesa 3-D graphics library @@ -449,6 +449,9 @@ void  _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,                      GLsizei width, GLsizei height )  { +   const GLfloat n = ctx->Viewport.Near; +   const GLfloat f = ctx->Viewport.Far; +     if (width < 0 || height < 0) {        _mesa_error( ctx,  GL_INVALID_VALUE, "glViewport" );        return; @@ -474,8 +477,8 @@ _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,     ctx->Viewport._WindowMap.m[MAT_TX] = ctx->Viewport._WindowMap.m[MAT_SX] + x;     ctx->Viewport._WindowMap.m[MAT_SY] = (GLfloat) height / 2.0F;     ctx->Viewport._WindowMap.m[MAT_TY] = ctx->Viewport._WindowMap.m[MAT_SY] + y; -   ctx->Viewport._WindowMap.m[MAT_SZ] = 0.5 * ctx->DepthMaxF; -   ctx->Viewport._WindowMap.m[MAT_TZ] = 0.5 * ctx->DepthMaxF; +   ctx->Viewport._WindowMap.m[MAT_SZ] = ctx->DepthMaxF * ((f - n) / 2.0); +   ctx->Viewport._WindowMap.m[MAT_TZ] = ctx->DepthMaxF * ((f - n) / 2.0 + n);     ctx->Viewport._WindowMap.flags = MAT_FLAG_GENERAL_SCALE|MAT_FLAG_TRANSLATION;     ctx->Viewport._WindowMap.type = MATRIX_3D_NO_ROT;     ctx->NewState |= _NEW_VIEWPORT; | 
