tag 405803 patch thanks Cyril Brulebois <cyril.brulebois@enst-bretagne.fr> (22/02/2007): > With this patch, everything looks OK, many thanks! Hi, see the attached file for an unified diff. Cc-ing debian-x as requested by Julien Cristau. Cheers, -- Cyril Brulebois
--- mesa-6.5.1.orig/src/mesa/tnl/t_vb_cliptmp.h
+++ mesa-6.5.1/src/mesa/tnl/t_vb_cliptmp.h
@@ -125,6 +125,7 @@
GLfloat t0 = 0;
GLfloat t1 = 0;
GLuint p;
+ const GLuint v0_orig = v0;
if (mask & 0x3f) {
LINE_CLIP( CLIP_RIGHT_BIT, -1, 0, 0, 1 );
@@ -153,12 +154,18 @@
v0 = newvert;
newvert++;
}
- else
+ else {
ASSERT(t0 == 0.0);
+ }
if (VB->ClipMask[v1]) {
- INTERP_4F( t1, coord[newvert], coord[v1], coord[v0] );
- interp( ctx, t1, newvert, v1, v0, GL_FALSE );
+ /* Note: we need to use vertex v0_orig when computing the new
+ * interpolated/clipped vertex position, not the current v0 which
+ * may have got set when we clipped the other end of the line!
+ */
+
+ INTERP_4F( t1, coord[newvert], coord[v1], coord[v0_orig] );
+ interp( ctx, t1, newvert, v1, v0_orig, GL_FALSE );
if (ctx->Light.ShadeModel == GL_FLAT)
tnl->Driver.Render.CopyPV( ctx, newvert, v1 );
@@ -167,8 +174,9 @@
newvert++;
}
- else
+ else {
ASSERT(t1 == 0.0);
+ }
tnl->Driver.Render.ClippedLine( ctx, v0, v1 );
}
Attachment:
pgpyF3ONQ5aIz.pgp
Description: PGP signature