- ximage = screen_to_ximage(modeinfo->xgwa.screen, modeinfo->window, NULL);
-
- qw = QW; qh = QH;
- tw = modeinfo->xgwa.width;
- th = modeinfo->xgwa.height;
-
-#if 0 /* jwz: this makes the image start off the bottom right of the screen */
- qx += (qw*tw/winw);
- qy -= (qh*th/winh);
-#endif
-
- qw *= (GLfloat)tw/winw;
- qh *= (GLfloat)th/winh;
-
- max_tx = (GLfloat) tw / (GLfloat) ximage->width;
- max_ty = (GLfloat) th / (GLfloat) ximage->height;
-
- 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 unsigned char *s = gluErrorString(status);
- fprintf(stderr, "%s: error mipmapping %dx%d texture: %s\n",
- progname, ximage->width, ximage->height,
- (s ? s : (unsigned char *) "(unknown)"));
- fprintf(stderr, "%s: turning on -wireframe.\n", progname);
- MI_IS_WIREFRAME(modeinfo) = 1;
- clear_gl_error();
- }
- check_gl_error("mipmapping"); /* should get a return code instead of a
- GL error, but just in case... */
-
- free(ximage->data);
- ximage->data = 0;
- XDestroyImage (ximage);
+ mp->waiting_for_image_p = True;
+ mp->mipmap_p = True;
+ load_texture_async (modeinfo->xgwa.screen, modeinfo->window,
+ *mp->glx_context, 0, 0, mp->mipmap_p,
+ mp->screentexture, image_loaded_cb, mp);