#include "quakedef.h"
#include "image.h"
+#include "jpeg.h"
cvar_t r_max_size = {CVAR_SAVE, "r_max_size", "2048"};
cvar_t r_max_scrapsize = {CVAR_SAVE, "r_max_scrapsize", "256"};
typedef struct gltexturepool_s
{
- int sentinel;
+ unsigned int sentinel;
struct gltextureimage_s *imagechain;
struct gltexture_s *gltchain;
struct gltexturepool_s *next;
texturemempool = Mem_AllocPool("Texture Info");
texturedatamempool = Mem_AllocPool("Texture Storage (not yet uploaded)");
textureprocessingmempool = Mem_AllocPool("Texture Processing Buffers");
+
+ JPEG_OpenLibrary ();
}
static void r_textures_shutdown(void)
{
rtexturepool_t *temp;
+
+ JPEG_CloseLibrary ();
+
while(gltexturepoolchain)
{
temp = (rtexturepool_t *) gltexturepoolchain;
static void GL_SetupTextureParameters(int flags, int texturetype)
{
int textureenum = gltexturetypeenums[texturetype];
- int wrapmode = (flags & TEXF_CLAMP) ? GL_CLAMP : GL_REPEAT;
+ int wrapmode = ((flags & TEXF_CLAMP) && gl_support_clamptoedge) ? GL_CLAMP_TO_EDGE : GL_REPEAT;
CHECKGLERROR
texinfo = R_GetTexTypeInfo(textype, flags);
size = width * height * depth * sides * texinfo->inputbytesperpixel;
+ if (size < 1)
+ Sys_Error("R_LoadTexture: bogus texture size (%dx%dx%dx%dbppx%dsides = %d bytes)\n", width, height, depth, texinfo->inputbytesperpixel * 8, sides);
// clear the alpha flag if the texture has no transparent pixels
switch(textype)
{
glt->inputtexels = Mem_Alloc(texturedatamempool, size);
if (glt->inputtexels == NULL)
- Sys_Error("R_SetupTexture: out of memory\n");
+ Sys_Error("R_LoadTexture: out of memory\n");
memcpy(glt->inputtexels, data, size);
}
else