- while (width > 1 || height > 1 || depth > 1)
- {
- Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, 1, 1, 1);
- prevbuffer = resizebuffer;
- qglTexImage2D(cubemapside[i], mip++, glt->glinternalformat, width, height, 0, glt->glformat, glt->gltype, prevbuffer);CHECKGLERROR
- }
- }
- }
- break;
- case GLTEXTURETYPE_RECTANGLE:
- qglTexImage2D(GL_TEXTURE_RECTANGLE_ARB, mip++, glt->glinternalformat, width, height, 0, glt->glformat, glt->gltype, NULL);CHECKGLERROR
- break;
- }
- GL_SetupTextureParameters(glt->flags, glt->textype->textype, glt->texturetype);
- qglBindTexture(gltexturetypeenums[glt->texturetype], oldbindtexnum);CHECKGLERROR
- break;
- case RENDERPATH_D3D9:
-#ifdef SUPPORTD3D
- if (!(glt->flags & TEXF_RENDERTARGET))
- {
- D3DLOCKED_RECT d3dlockedrect;
- D3DLOCKED_BOX d3dlockedbox;
- switch(glt->texturetype)
- {
- case GLTEXTURETYPE_2D:
- if (IDirect3DTexture9_LockRect((IDirect3DTexture9*)glt->d3dtexture, mip, &d3dlockedrect, NULL, 0) == D3D_OK && d3dlockedrect.pBits)
- {
- if (prevbuffer)
- memcpy(d3dlockedrect.pBits, prevbuffer, width*height*glt->bytesperpixel);
- else
- memset(d3dlockedrect.pBits, 255, width*height*glt->bytesperpixel);
- IDirect3DTexture9_UnlockRect((IDirect3DTexture9*)glt->d3dtexture, mip);
- }
- mip++;
- if ((glt->flags & TEXF_MIPMAP) && prevbuffer)
- {
- while (width > 1 || height > 1 || depth > 1)
- {
- Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, 1, 1, 1);
- prevbuffer = resizebuffer;
- if (IDirect3DTexture9_LockRect((IDirect3DTexture9*)glt->d3dtexture, mip, &d3dlockedrect, NULL, 0) == D3D_OK && d3dlockedrect.pBits)
- {
- memcpy(d3dlockedrect.pBits, prevbuffer, width*height*glt->bytesperpixel);
- IDirect3DTexture9_UnlockRect((IDirect3DTexture9*)glt->d3dtexture, mip);
- }
- mip++;
- }
- }
- break;
- case GLTEXTURETYPE_3D:
- if (IDirect3DVolumeTexture9_LockBox((IDirect3DVolumeTexture9*)glt->d3dtexture, mip, &d3dlockedbox, NULL, 0) == D3D_OK && d3dlockedbox.pBits)
- {
- // we are not honoring the RowPitch or SlicePitch, hopefully this works with all sizes
- memcpy(d3dlockedbox.pBits, prevbuffer, width*height*depth*glt->bytesperpixel);
- IDirect3DVolumeTexture9_UnlockBox((IDirect3DVolumeTexture9*)glt->d3dtexture, mip);