summaryrefslogtreecommitdiff
path: root/xc/extras/Mesa/src/matrix.c
diff options
context:
space:
mode:
authordawes <dawes>2001-04-09 16:26:55 +0000
committerdawes <dawes>2001-04-09 16:26:55 +0000
commit98a17368797bb2c64d10b975d8c7222f700a17ed (patch)
tree98ad15ddc2af061115b61bb802da126d6332da7c /xc/extras/Mesa/src/matrix.c
parent7bf7bda7738b2029bc71015f9ea08304c15e7240 (diff)
Import -f XFree86 4.0.99.2X_4_0_99_2
Diffstat (limited to 'xc/extras/Mesa/src/matrix.c')
-rw-r--r--xc/extras/Mesa/src/matrix.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/xc/extras/Mesa/src/matrix.c b/xc/extras/Mesa/src/matrix.c
index 7fc3e9404..3df43f4fb 100644
--- a/xc/extras/Mesa/src/matrix.c
+++ b/xc/extras/Mesa/src/matrix.c
@@ -1451,6 +1451,9 @@ _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
void
gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height )
{
+ const GLfloat n = ctx->Viewport.Near;
+ const GLfloat f = ctx->Viewport.Far;
+
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glViewport");
if (width<0 || height<0) {
@@ -1476,8 +1479,8 @@ gl_Viewport( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height )
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->Visual->DepthMaxF;
- ctx->Viewport.WindowMap.m[MAT_TZ] = 0.5 * ctx->Visual->DepthMaxF;
+ ctx->Viewport.WindowMap.m[MAT_SZ] = ctx->Visual->DepthMaxF * ((f - n) / 2.0);
+ ctx->Viewport.WindowMap.m[MAT_TZ] = ctx->Visual->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;