- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR_MIPMAP_LINEAR);
-
- clear_gl_error();
- status = gluBuild2DMipmaps(GL_TEXTURE_2D, 3,
- ximage->width, ximage->height,
- GL_RGBA, GL_UNSIGNED_BYTE, ximage->data);
-
- if (!status && glGetError())
- /* Some implementations of gluBuild2DMipmaps(), but set a GL error anyway.
- ** We could just call check_gl_error(), but that would exit. */
- status = -1;
-
- if (status)
- {
- const GLubyte *s = gluErrorString (status);
- if (s)
- {
- fprintf (stderr, "%s: error mipmapping %dx%d texture: %s\n",
- progname, ximage->width, ximage->height, s);
- }
- else
- {
- fprintf (stderr, "%s: error mipmapping %dx%d texture: (unknown)\n",
- progname, ximage->width, ximage->height);
- }
- clear_gl_error();
- }
- check_gl_error("mipmapping"); /* should get a return code instead of a
- GL error, but just in case... */