- yi = f >> 16;
- if (yi < endy)
- {
- int lerp = f & 0xFFFF;
- if (yi != oldy)
- {
- inrow = (byte *)indata + inwidth*4*yi;
- if (yi == oldy+1)
- memcpy(row1, row2, outwidth*4);
- else
- R_ResampleTextureLerpLine (inrow, row1, inwidth, outwidth);
- R_ResampleTextureLerpLine (inrow + inwidth*4, row2, inwidth, outwidth);
- oldy = yi;
- }
- j = outwidth - 4;
- while(j >= 0)
- {
- out[ 0] = (byte) ((((row2[ 0] - row1[ 0]) * lerp) >> 16) + row1[ 0]);
- out[ 1] = (byte) ((((row2[ 1] - row1[ 1]) * lerp) >> 16) + row1[ 1]);
- out[ 2] = (byte) ((((row2[ 2] - row1[ 2]) * lerp) >> 16) + row1[ 2]);
- out[ 3] = (byte) ((((row2[ 3] - row1[ 3]) * lerp) >> 16) + row1[ 3]);
- out[ 4] = (byte) ((((row2[ 4] - row1[ 4]) * lerp) >> 16) + row1[ 4]);
- out[ 5] = (byte) ((((row2[ 5] - row1[ 5]) * lerp) >> 16) + row1[ 5]);
- out[ 6] = (byte) ((((row2[ 6] - row1[ 6]) * lerp) >> 16) + row1[ 6]);
- out[ 7] = (byte) ((((row2[ 7] - row1[ 7]) * lerp) >> 16) + row1[ 7]);
- out[ 8] = (byte) ((((row2[ 8] - row1[ 8]) * lerp) >> 16) + row1[ 8]);
- out[ 9] = (byte) ((((row2[ 9] - row1[ 9]) * lerp) >> 16) + row1[ 9]);
- out[10] = (byte) ((((row2[10] - row1[10]) * lerp) >> 16) + row1[10]);
- out[11] = (byte) ((((row2[11] - row1[11]) * lerp) >> 16) + row1[11]);
- out[12] = (byte) ((((row2[12] - row1[12]) * lerp) >> 16) + row1[12]);
- out[13] = (byte) ((((row2[13] - row1[13]) * lerp) >> 16) + row1[13]);
- out[14] = (byte) ((((row2[14] - row1[14]) * lerp) >> 16) + row1[14]);
- out[15] = (byte) ((((row2[15] - row1[15]) * lerp) >> 16) + row1[15]);
- out += 16;
- row1 += 16;
- row2 += 16;
- j -= 4;
- }
- if (j & 2)
- {
- out[ 0] = (byte) ((((row2[ 0] - row1[ 0]) * lerp) >> 16) + row1[ 0]);
- out[ 1] = (byte) ((((row2[ 1] - row1[ 1]) * lerp) >> 16) + row1[ 1]);
- out[ 2] = (byte) ((((row2[ 2] - row1[ 2]) * lerp) >> 16) + row1[ 2]);
- out[ 3] = (byte) ((((row2[ 3] - row1[ 3]) * lerp) >> 16) + row1[ 3]);
- out[ 4] = (byte) ((((row2[ 4] - row1[ 4]) * lerp) >> 16) + row1[ 4]);
- out[ 5] = (byte) ((((row2[ 5] - row1[ 5]) * lerp) >> 16) + row1[ 5]);
- out[ 6] = (byte) ((((row2[ 6] - row1[ 6]) * lerp) >> 16) + row1[ 6]);
- out[ 7] = (byte) ((((row2[ 7] - row1[ 7]) * lerp) >> 16) + row1[ 7]);
- out += 8;
- row1 += 8;
- row2 += 8;
- }
- if (j & 1)
- {
- out[ 0] = (byte) ((((row2[ 0] - row1[ 0]) * lerp) >> 16) + row1[ 0]);
- out[ 1] = (byte) ((((row2[ 1] - row1[ 1]) * lerp) >> 16) + row1[ 1]);
- out[ 2] = (byte) ((((row2[ 2] - row1[ 2]) * lerp) >> 16) + row1[ 2]);
- out[ 3] = (byte) ((((row2[ 3] - row1[ 3]) * lerp) >> 16) + row1[ 3]);
- out += 4;
- row1 += 4;
- row2 += 4;
- }
- row1 -= outwidth*4;
- row2 -= outwidth*4;
- }
- else
- {
- if (yi != oldy)
- {
- inrow = (byte *)indata + inwidth*4*yi;
- if (yi == oldy+1)
- memcpy(row1, row2, outwidth*4);
- else
- R_ResampleTextureLerpLine (inrow, row1, inwidth, outwidth);
- oldy = yi;
- }
- memcpy(out, row1, outwidth * 4);
- }
+ case GLTEXTURETYPE_1D:
+ qglTexSubImage1D(GL_TEXTURE_1D, 0, glt->x, glt->width, glt->image->glformat, GL_UNSIGNED_BYTE, prevbuffer);
+ CHECKGLERROR
+ break;
+ case GLTEXTURETYPE_2D:
+ qglTexSubImage2D(GL_TEXTURE_2D, 0, glt->x, glt->y, glt->width, glt->height, glt->image->glformat, GL_UNSIGNED_BYTE, prevbuffer);
+ CHECKGLERROR
+ break;
+ case GLTEXTURETYPE_3D:
+ qglTexSubImage3D(GL_TEXTURE_3D, 0, glt->x, glt->y, glt->z, glt->width, glt->height, glt->depth, glt->image->glformat, GL_UNSIGNED_BYTE, prevbuffer);
+ CHECKGLERROR
+ break;
+ default:
+ Host_Error("R_Upload: fragment texture of type other than 1D, 2D, or 3D\n");
+ break;