static textypeinfo_t textype_depth24 = {"depth24", TEXTYPE_DEPTHBUFFER24 , 2, 2, 2.0f, GL_DEPTH_COMPONENT16 , GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT};
static textypeinfo_t textype_depth24stencil8 = {"depth24stencil8", TEXTYPE_DEPTHBUFFER24STENCIL8, 2, 2, 2.0f, GL_DEPTH_COMPONENT16 , GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT};
static textypeinfo_t textype_colorbuffer = {"colorbuffer", TEXTYPE_COLORBUFFER , 2, 2, 2.0f, GL_RGB565 , GL_RGBA , GL_UNSIGNED_SHORT_5_6_5};
-static textypeinfo_t textype_colorbuffer16f = {"colorbuffer16f", TEXTYPE_COLORBUFFER16F , 2, 2, 2.0f, GL_RGB565 , GL_RGBA , GL_UNSIGNED_SHORT_5_6_5};
-static textypeinfo_t textype_colorbuffer32f = {"colorbuffer32f", TEXTYPE_COLORBUFFER32F , 2, 2, 2.0f, GL_RGB565 , GL_RGBA , GL_UNSIGNED_SHORT_5_6_5};
+static textypeinfo_t textype_colorbuffer16f = {"colorbuffer16f", TEXTYPE_COLORBUFFER16F , 2, 2, 2.0f, GL_RGBA16F , GL_RGBA , GL_HALF_FLOAT_ARB};
+static textypeinfo_t textype_colorbuffer32f = {"colorbuffer32f", TEXTYPE_COLORBUFFER32F , 2, 2, 2.0f, GL_RGBA32F , GL_RGBA , GL_FLOAT};
// image formats:
static textypeinfo_t textype_alpha = {"alpha", TEXTYPE_ALPHA , 1, 4, 4.0f, GL_ALPHA , GL_ALPHA , GL_UNSIGNED_BYTE };
static textypeinfo_t textype_depth24 = {"depth24", TEXTYPE_DEPTHBUFFER24 , 4, 4, 4.0f, GL_DEPTH_COMPONENT24_ARB , GL_DEPTH_COMPONENT, GL_UNSIGNED_INT };
static textypeinfo_t textype_depth24stencil8 = {"depth24stencil8", TEXTYPE_DEPTHBUFFER24STENCIL8, 4, 4, 4.0f, GL_DEPTH24_STENCIL8_EXT , GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT};
static textypeinfo_t textype_colorbuffer = {"colorbuffer", TEXTYPE_COLORBUFFER , 4, 4, 4.0f, GL_RGBA , GL_BGRA , GL_UNSIGNED_BYTE };
-static textypeinfo_t textype_colorbuffer16f = {"colorbuffer16f", TEXTYPE_COLORBUFFER16F , 8, 8, 8.0f, GL_RGBA16F_ARB , GL_RGBA , GL_FLOAT };
+static textypeinfo_t textype_colorbuffer16f = {"colorbuffer16f", TEXTYPE_COLORBUFFER16F , 8, 8, 8.0f, GL_RGBA16F_ARB , GL_RGBA , GL_HALF_FLOAT_ARB};
static textypeinfo_t textype_colorbuffer32f = {"colorbuffer32f", TEXTYPE_COLORBUFFER32F , 16, 16, 16.0f, GL_RGBA32F_ARB , GL_RGBA , GL_FLOAT };
// image formats:
// dynamic texture stuff [11/22/2007 Black]
updatecallback_t updatecallback;
- void *updatacallback_data;
+ void *updatecallback_data;
// --- [11/22/2007 Black]
// stores backup copy of texture for deferred texture updates (gl_nopartialtextureupdates cvar)
glt->flags |= GLTEXF_DYNAMIC;
glt->updatecallback = updatecallback;
- glt->updatacallback_data = data;
+ glt->updatecallback_data = data;
}
static void R_UpdateDynamicTexture(gltexture_t *glt) {
glt->dirty = false;
if( glt->updatecallback ) {
- glt->updatecallback( (rtexture_t*) glt, glt->updatacallback_data );
+ glt->updatecallback( (rtexture_t*) glt, glt->updatecallback_data );
}
}
{
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
static int old_aniso = 0;
+ static qboolean first_time_aniso = true;
#endif
// could do procedural texture animation here, if we keep track of which
case RENDERPATH_GL20:
case RENDERPATH_GLES1:
case RENDERPATH_GLES2:
+ // ignore the first difference, any textures loaded by now probably had the same aniso value
+ if (first_time_aniso)
+ {
+ first_time_aniso = false;
+ break;
+ }
CHECKGLERROR
GL_ActiveTexture(0);
for (pool = gltexturepoolchain;pool;pool = pool->next)
for (width = glt->tilewidth;width < glt->inputwidth ;width <<= 1);
for (height = glt->tileheight;height < glt->inputheight;height <<= 1);
for (depth = glt->tiledepth;depth < glt->inputdepth ;depth <<= 1);
- R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
if (prevbuffer == NULL)
{
width = glt->tilewidth;
height = glt->tileheight;
depth = glt->tiledepth;
+// R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
// memset(resizebuffer, 0, width * height * depth * glt->sides * glt->bytesperpixel);
// prevbuffer = resizebuffer;
}
if (glt->textype->textype == TEXTYPE_PALETTE)
{
// promote paletted to BGRA, so we only have to worry about BGRA in the rest of this code
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_Copy8bitBGRA(prevbuffer, colorconvertbuffer, glt->inputwidth * glt->inputheight * glt->inputdepth * glt->sides, glt->palette);
prevbuffer = colorconvertbuffer;
}
{
// multiply RGB channels by A channel before uploading
int alpha;
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
for (i = 0;i < glt->inputwidth*glt->inputheight*glt->inputdepth*4;i += 4)
{
alpha = prevbuffer[i+3];
// scale up to a power of 2 size (if appropriate)
if (glt->inputwidth != width || glt->inputheight != height || glt->inputdepth != depth)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_Resample32(prevbuffer, glt->inputwidth, glt->inputheight, glt->inputdepth, resizebuffer, width, height, depth, r_lerpimages.integer);
prevbuffer = resizebuffer;
}
// apply mipmap reduction algorithm to get down to picmip/max_size
while (width > glt->tilewidth || height > glt->tileheight || depth > glt->tiledepth)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, glt->tilewidth, glt->tileheight, glt->tiledepth);
prevbuffer = resizebuffer;
}
{
while (width > 1 || height > 1 || depth > 1)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, 1, 1, 1);
prevbuffer = resizebuffer;
qglTexImage2D(GL_TEXTURE_2D, mip++, glt->glinternalformat, width, height, 0, glt->glformat, glt->gltype, prevbuffer);CHECKGLERROR
{
while (width > 1 || height > 1 || depth > 1)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, 1, 1, 1);
prevbuffer = resizebuffer;
qglTexImage3D(GL_TEXTURE_3D, mip++, glt->glinternalformat, width, height, depth, 0, glt->glformat, glt->gltype, prevbuffer);CHECKGLERROR
texturebuffer += glt->inputwidth * glt->inputheight * glt->inputdepth * glt->textype->inputbytesperpixel;
if (glt->inputwidth != width || glt->inputheight != height || glt->inputdepth != depth)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_Resample32(prevbuffer, glt->inputwidth, glt->inputheight, glt->inputdepth, resizebuffer, width, height, depth, r_lerpimages.integer);
prevbuffer = resizebuffer;
}
// picmip/max_size
while (width > glt->tilewidth || height > glt->tileheight || depth > glt->tiledepth)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, glt->tilewidth, glt->tileheight, glt->tiledepth);
prevbuffer = resizebuffer;
}
{
while (width > 1 || height > 1 || depth > 1)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
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
{
while (width > 1 || height > 1 || depth > 1)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
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)
{
while (width > 1 || height > 1 || depth > 1)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, 1, 1, 1);
prevbuffer = resizebuffer;
if (IDirect3DVolumeTexture9_LockBox((IDirect3DVolumeTexture9*)glt->d3dtexture, mip, &d3dlockedbox, NULL, 0) == D3D_OK && d3dlockedbox.pBits)
texturebuffer += glt->inputwidth * glt->inputheight * glt->inputdepth * glt->textype->inputbytesperpixel;
if (glt->inputwidth != width || glt->inputheight != height || glt->inputdepth != depth)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_Resample32(prevbuffer, glt->inputwidth, glt->inputheight, glt->inputdepth, resizebuffer, width, height, depth, r_lerpimages.integer);
prevbuffer = resizebuffer;
}
// picmip/max_size
while (width > glt->tilewidth || height > glt->tileheight || depth > glt->tiledepth)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, glt->tilewidth, glt->tileheight, glt->tiledepth);
prevbuffer = resizebuffer;
}
{
while (width > 1 || height > 1 || depth > 1)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, 1, 1, 1);
prevbuffer = resizebuffer;
if (IDirect3DCubeTexture9_LockRect((IDirect3DCubeTexture9*)glt->d3dtexture, (D3DCUBEMAP_FACES)i, mip, &d3dlockedrect, NULL, 0) == D3D_OK && d3dlockedrect.pBits)
texturebuffer += glt->inputwidth * glt->inputheight * glt->inputdepth * glt->textype->inputbytesperpixel;
if (glt->inputwidth != width || glt->inputheight != height || glt->inputdepth != depth)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_Resample32(prevbuffer, glt->inputwidth, glt->inputheight, glt->inputdepth, resizebuffer, width, height, depth, r_lerpimages.integer);
prevbuffer = resizebuffer;
}
// picmip/max_size
while (width > glt->tilewidth || height > glt->tileheight || depth > glt->tiledepth)
{
+ R_MakeResizeBufferBigger(width * height * depth * glt->sides * glt->bytesperpixel);
Image_MipReduce32(prevbuffer, resizebuffer, &width, &height, &depth, glt->tilewidth, glt->tileheight, glt->tiledepth);
prevbuffer = resizebuffer;
}
glt->gltexturetypeenum = gltexturetypeenums[glt->texturetype];
// init the dynamic texture attributes, too [11/22/2007 Black]
glt->updatecallback = NULL;
- glt->updatacallback_data = NULL;
+ glt->updatecallback_data = NULL;
GL_Texture_CalcImageSize(glt->texturetype, glt->flags, glt->miplevel, glt->inputwidth, glt->inputheight, glt->inputdepth, &glt->tilewidth, &glt->tileheight, &glt->tiledepth, &glt->miplevels);
glt->texnum = 0;
glt->dirty = false;
glt->glisdepthstencil = textype == TEXTYPE_DEPTHBUFFER24STENCIL8;
- glt->gltexturetypeenum = gltexturetypeenums[glt->texturetype];
+ glt->gltexturetypeenum = GL_TEXTURE_2D;
// init the dynamic texture attributes, too [11/22/2007 Black]
glt->updatecallback = NULL;
- glt->updatacallback_data = NULL;
+ glt->updatecallback_data = NULL;
GL_Texture_CalcImageSize(glt->texturetype, glt->flags, glt->miplevel, glt->inputwidth, glt->inputheight, glt->inputdepth, &glt->tilewidth, &glt->tileheight, &glt->tiledepth, &glt->miplevels);