diff --git a/CImg.h b/CImg.h
index baca22dc08d189665525209c74bcd721b958e3f3..a0b12af0b6d2da029e802326801a61c16ca04043 100644
--- a/CImg.h
+++ b/CImg.h
@@ -47030,15 +47030,18 @@ namespace cimg_library_suffixed {
             tx1 = (int)primitive[6], ty1 = (int)primitive[7],
             tx2 = (int)primitive[8], ty2 = (int)primitive[9],
             tx3 = (int)primitive[10], ty3 = (int)primitive[11],
+            txc = (tx0 + tx1 + tx2 + tx3)/4, tyc = (ty0 + ty1 + ty2 + ty3)/4,
             x0 = (int)projections(n0,0), y0 = (int)projections(n0,1),
             x1 = (int)projections(n1,0), y1 = (int)projections(n1,1),
             x2 = (int)projections(n2,0), y2 = (int)projections(n2,1),
-            x3 = (int)projections(n3,0), y3 = (int)projections(n3,1);
+            x3 = (int)projections(n3,0), y3 = (int)projections(n3,1),
+            xc = (x0 + x1 + x2 + x3)/4, yc = (y0 + y1 + y2 + y3)/4;
           const float
             z0 = vertices(n0,2) + Z + _focale,
             z1 = vertices(n1,2) + Z + _focale,
             z2 = vertices(n2,2) + Z + _focale,
-            z3 = vertices(n3,2) + Z + _focale;
+            z3 = vertices(n3,2) + Z + _focale,
+            zc = (z0 + z1 + z2 + z3)/4;
 
           switch (render_type) {
           case 0 :
@@ -47126,7 +47129,8 @@ namespace cimg_library_suffixed {
           case 4 : {
             const float
               lightprop0 = lightprops(n0), lightprop1 = lightprops(n1),
-              lightprop2 = lightprops(n2), lightprop3 = lightprops(n3);
+              lightprop2 = lightprops(n2), lightprop3 = lightprops(n3),
+              lightpropc = (lightprop0 + lightprop1 + lightprop2 + lightprop3)/4;
             if (zbuffer)
               draw_triangle(zbuffer,x0,y0,z0,x1,y1,z1,x2,y2,z2,color,tx0,ty0,tx1,ty1,tx2,ty2,
                             lightprop0,lightprop1,lightprop2,opacity).