Rune Central

The Official Rune Quake Message Board
It is currently Thu Mar 28, 2024 9:46 am

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Max textures fix?
PostPosted: Mon Sep 19, 2005 12:18 am 
Offline

Joined: Sun Mar 09, 2003 10:47 pm
Posts: 1612
Location: Ohio
Is this the fix for where the num textures > max textures

http://www.quakesrc.org/tutorials/old/78

"Quake has a major memory leak, LordHavoc discovered it and patched it while working on Nehahra some time ago, and fixes are now in Nehahra, DarkPlaces, QuakeWorld Forever, and QuakeForge. The patch code is below..
Note that it also contains code for fixing texture mismatches, and you thus need to add"


gl_draw.c

Code:
/*

================

GL_LoadTexture

================

*/

int lhcsumtable[256];

int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha)

{

 qboolean noalpha;

 int   i, p, s, lhcsum;

 gltexture_t *glt;



 // LordHavoc: do a checksum to confirm the data really is the same as previous

 // occurances. well this isn't exactly a checksum, it's better than that but

 // not following any standards.

 lhcsum = 0;

 s = width*height;

 for (i = 0;i < 256;i++) lhcsumtable[i] = i + 1;

 for (i = 0;i < s;i++) lhcsum += (lhcsumtable[data[i] & 255]++);



 // see if the texture is allready present

 if (identifier[0])

 {

  for (i=0, glt=gltextures ; iidentifier))

   {

    // LordHavoc: everyone hates cache mismatchs, so I fixed it

    if (lhcsum != glt->lhcsum || width != glt->width || height != glt->height)

    {

     Con_DPrintf("GL_LoadTexture: cache mismatch, replacing old texture\n");

     goto GL_LoadTexture_setup; // drop out with glt pointing to the texture to replace

    }

    return glt->texnum;

   }

  }

 }

 // LordHavoc: this was an else condition, causing disasterous results,

 // whoever at id or threewave must've been half asleep...

 glt = &gltextures[numgltextures];

 numgltextures++;



 strcpy (glt->identifier, identifier);

 glt->texnum = texture_extension_number;

 texture_extension_number++;



// LordHavoc: label to drop out of the loop into the setup code

GL_LoadTexture_setup:

 glt->lhcsum = lhcsum; // LordHavoc: used to verify textures are identical

 glt->width = width;

 glt->height = height;

 glt->mipmap = mipmap;



 if (!isDedicated)

 {

         GL_Bind(glt->texnum);

         GL_Upload8 (data, width, height, mipmap, alpha);

 }



 return glt->texnum;

}


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Sep 22, 2005 3:46 am 
Offline
User avatar

Joined: Fri Oct 24, 2003 2:09 pm
Posts: 252
Location: Hungary
joequake already contains this fix.

the num_textures > MAX_TEXTURES issue is not a bug which should be fixed. Simply there's a limit for the maximal numbers of textures and if you reach that limit, you'll have to restart the game.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 40 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group