+ if (wire) texture_p = cel_p = False;
+ if (cel_p) texture_p = False;
+
+ if (texture_p || cel_p) {
+ glGenTextures(1, &tc->texid);
+# ifdef HAVE_GLBINDTEXTURE
+ glBindTexture ((cel_p ? GL_TEXTURE_1D : GL_TEXTURE_2D), tc->texid);
+# endif
+
+ if (cel_p)
+ {
+ /* "16 1 3 1",
+ "X c #808080",
+ "x c #C0C0C0",
+ ". c #FFFFFF",
+ "XXXxxxxx........"
+ */
+ int w = 16;
+ tc->texture = XCreateImage (MI_DISPLAY(mi), MI_VISUAL(mi),
+ 32, ZPixmap, 0, 0, w, 1, 32, 0);
+ tc->texture->data = (char *) calloc(1, tc->texture->bytes_per_line);
+ /* ABGR */
+ for (i = 0; i < 3; i++) XPutPixel (tc->texture, i, 0, 0xFF808080);
+ for (; i < 8; i++) XPutPixel (tc->texture, i, 0, 0xFFC0C0C0);
+ for (; i < w; i++) XPutPixel (tc->texture, i, 0, 0xFFFFFFFF);
+ }
+ else
+ tc->texture = image_data_to_ximage (MI_DISPLAY(mi), MI_VISUAL(mi),
+ scales_png, sizeof(scales_png));
+
+ if (!tc->texture) texture_p = cel_p = False;
+ }
+
+ if (texture_p) {
+ glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
+ clear_gl_error();
+ glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA,
+ tc->texture->width, tc->texture->height, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, tc->texture->data);
+ check_gl_error("texture");
+
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ glEnable(GL_TEXTURE_2D);
+ } else if (cel_p) {
+ clear_gl_error();
+ glTexImage1D (GL_TEXTURE_1D, 0, GL_RGBA,
+ tc->texture->width, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, tc->texture->data);
+ check_gl_error("texture");
+
+ glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+
+ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ glEnable(GL_TEXTURE_1D);
+ glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
+ glEnable (GL_LINE_SMOOTH);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable (GL_BLEND);
+
+ /* Dark gray instead of black, so the outlines show up */
+ glClearColor (0.13, 0.13, 0.13, 1.0);
+ }
+
+ compute_unit_torus (mi, 0.5,
+ MAX(5, arg_slices/6),
+ MAX(9, arg_slices/3));