From: havoc Date: Sun, 6 Oct 2002 14:45:53 +0000 (+0000) Subject: fix fragment texture image creation so it has depth 1 X-Git-Tag: RELEASE_0_2_0_RC1~145 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=58bd6e77450c6a4398393580ba6d1fe667c6188e;p=xonotic%2Fdarkplaces.git fix fragment texture image creation so it has depth 1 error if fragment texture is attempted with texture types other than 2D git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2509 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_textures.c b/gl_textures.c index f06ac7dd..b2629ba9 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -877,7 +877,12 @@ static void R_FindImageForTexture(gltexture_t *glt) image->type = GLIMAGETYPE_FRAGMENTS; // make sure the created image is big enough for the fragment for (image->width = block_size;image->width < glt->width;image->width <<= 1); - for (image->height = block_size;image->height < glt->height;image->height <<= 1); + image->height = 1; + if (glt->texturetype != GLTEXTURETYPE_1D) + for (image->height = block_size;image->height < glt->height;image->height <<= 1); + image->depth = 1; + if (glt->texturetype == GLTEXTURETYPE_3D) + for (image->depth = block_size;image->depth < glt->depth;image->depth <<= 1); image->blockallocation = Mem_Alloc(texturemempool, image->width * sizeof(short)); memset(image->blockallocation, 0, image->width * sizeof(short)); @@ -954,16 +959,12 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, char *identifier if (cls.state == ca_dedicated) return NULL; - if (texturetype == GLTEXTURETYPE_CUBEMAP) - { - if (flags & TEXF_FRAGMENT) - Sys_Error("R_LoadTexture: fragment cubemap texture??\n"); - if (!gl_texturecubemap) - Sys_Error("R_LoadTexture: cubemap texture not supported by driver\n"); - } - if (texturetype == GLTEXTURETYPE_3D) - if (!gl_texture3d) - Sys_Error("R_LoadTexture: 3d texture not supported by driver\n"); + if (flags & TEXF_FRAGMENT && texturetype != GLTEXTURETYPE_2D) + Sys_Error("R_LoadTexture: only 2D fragment textures implemented\n"); + if (texturetype == GLTEXTURETYPE_CUBEMAP && !gl_texturecubemap) + Sys_Error("R_LoadTexture: cubemap texture not supported by driver\n"); + if (texturetype == GLTEXTURETYPE_3D && !gl_texture3d) + Sys_Error("R_LoadTexture: 3d texture not supported by driver\n"); /* glt = R_FindTexture (pool, identifier);