+
+ /* Put it back */
+ for (i = 0; i < o; i += 3)
+ {
+ GLdouble *p = pts + i;
+ p[2] = -p[2];
+ }
+
+# else /* !HAVE_TESS */
+
+ GLfloat *tri = (GLfloat *)
+ (GLfloat *) malloc (s->n_points * 4 * 3 * 3 * sizeof(*pts));
+ GLfloat *otri = tri;
+ int count;
+ GLdouble zz;
+
+ tri += make_piece_eighth (jc, s, resolution, top_type, tri, 0, 0, 0);
+ tri += make_piece_eighth (jc, s, resolution, top_type, tri, 1, 0, 0);
+ tri += make_piece_eighth (jc, s, resolution, left_type, tri, 0, 1, 1);
+ tri += make_piece_eighth (jc, s, resolution, left_type, tri, 1, 1, 1);
+ tri += make_piece_eighth (jc, s, resolution, bottom_type, tri, 0, 1, 0);
+ tri += make_piece_eighth (jc, s, resolution, bottom_type, tri, 1, 1, 0);
+ tri += make_piece_eighth (jc, s, resolution, right_type, tri, 0, 0, 1);
+ tri += make_piece_eighth (jc, s, resolution, right_type, tri, 1, 0, 1);
+ count = (tri - otri) / 9;
+
+ if (! wire)
+ {
+ glEnable (GL_TEXTURE_2D);
+ glEnable (GL_BLEND);
+ glEnable (GL_LIGHTING);
+ glBindTexture(GL_TEXTURE_2D, jc->texid);
+ }
+
+ for (zz = z; zz >= -z; zz -= 2*z)
+ {
+ int i;
+ glFrontFace (zz > 0 ? GL_CCW : GL_CW);
+ glNormal3f (0, 0, (zz > 0 ? 1 : -1));
+
+ if (zz < 0)
+ glDisable (GL_TEXTURE_2D); /* back face */
+
+ glPushMatrix();
+ glTranslatef (0, 0, zz);
+
+ tri = otri;
+ if (wire)
+ {
+ for (i = 0; i < count; i++)
+ {
+ glBegin (GL_LINE_LOOP);
+ glVertex3f (tri[0], tri[1], tri[2]); tri += 3;
+ glVertex3f (tri[0], tri[1], tri[2]); tri += 3;
+ glVertex3f (tri[0], tri[1], tri[2]); tri += 3;
+ glEnd();
+ }
+ }
+ else
+ {
+ GLfloat pw = p->jc->puzzle_width;
+ GLfloat ph = p->jc->puzzle_height;
+ GLfloat r = resolution;
+
+ glBegin (GL_TRIANGLES);
+ for (i = 0; i < count * 3; i++)
+ {
+ GLfloat x = *tri++;
+ GLfloat y = *tri++;
+ GLfloat z = *tri++;
+
+ /* 0-1 from piece origin */
+ GLfloat xx = x / r;
+ GLfloat yy = y / r;
+
+ /* 0-1 from puzzle origin */
+ GLfloat tx = (p->home.x + xx) / pw;
+ GLfloat ty = (ph - p->home.y - yy) / ph;
+
+ tx = p->jc->tex_x + (tx * p->jc->tex_width);
+ ty = p->jc->tex_y + (ty * p->jc->tex_height);
+
+ glTexCoord2f (tx, ty);
+ glVertex3f (x, y, z);
+ }
+ glEnd();
+ }
+
+ polys += count;
+ glPopMatrix();
+ }
+
+ free (otri);
+# endif /* !HAVE_TESS */