http://packetstormsecurity.org/UNIX/admin/xscreensaver-4.02.tar.gz
[xscreensaver] / hacks / glx / extrusion.c
index d1c8dbbb825e0838f56e219496615e3c53006f61..0f35ffb642371ab47dbd209c6be2dcf0c8822e83 100644 (file)
 
 #ifdef USE_GL /* whole file */
 
-#ifdef HAVE_XPM
-# include <X11/xpm.h>
-# ifndef PIXEL_ALREADY_TYPEDEFED
-# define PIXEL_ALREADY_TYPEDEFED /* Sigh, Xmu/Drawing.h needs this... */
-# endif
-#endif
-
 #ifdef HAVE_XMU
 # ifndef VMS
 #  include <X11/Xmu/Drawing.h>
@@ -70,7 +63,7 @@
 # endif /* VMS */
 #endif
 
-#include <malloc.h>
+#include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -461,10 +454,20 @@ void Create_Texture(char *filename, int do_mipmap, int do_texture_quality)
   }
 
   if (do_mipmap) {
-    gluBuild2DMipmaps(GL_TEXTURE_2D, format, width, height, 
-                     format, GL_UNSIGNED_BYTE, image);
-  }
-  else {
+    int status;
+    clear_gl_error();
+    status = gluBuild2DMipmaps(GL_TEXTURE_2D, format, width, height, 
+                               format, GL_UNSIGNED_BYTE, image);
+    if (status)
+      {
+        const char *s = gluErrorString (status);
+        fprintf (stderr, "%s: error mipmapping %dx%d texture: %s\n",
+                 progname, width, height,
+                 (s ? s : "(unknown)"));
+        exit (1);
+      }
+    check_gl_error("mipmapping");
+  } else {
     clear_gl_error();
     glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0,
                 format, GL_UNSIGNED_BYTE, image);