mirror of
https://git.code.sf.net/p/quake/nuq
synced 2024-11-21 19:51:09 +00:00
back port 0.5's scaled image allocation
This commit is contained in:
parent
b1cf570c7f
commit
a41b5b975f
1 changed files with 7 additions and 2 deletions
|
@ -1096,9 +1096,12 @@ GL_Upload32
|
|||
static void GL_Upload32 (unsigned *data, int width, int height, qboolean mipmap, qboolean alpha)
|
||||
{
|
||||
int samples;
|
||||
static unsigned scaled[1024*512]; // [512*256];
|
||||
unsigned int *scaled;
|
||||
int scaled_width, scaled_height;
|
||||
|
||||
if (!width || !height)
|
||||
return; // Null texture
|
||||
|
||||
for (scaled_width = 1 ; scaled_width < width ; scaled_width<<=1)
|
||||
;
|
||||
for (scaled_height = 1 ; scaled_height < height ; scaled_height<<=1)
|
||||
|
@ -1110,7 +1113,7 @@ static unsigned scaled[1024*512]; // [512*256];
|
|||
scaled_width = min(scaled_width, gl_max_size->int_val);
|
||||
scaled_height = min(scaled_height, gl_max_size->int_val);
|
||||
|
||||
if (scaled_width * scaled_height > sizeof(scaled)/4)
|
||||
if (!(scaled = malloc (scaled_width * scaled_height * sizeof (GLuint))))
|
||||
Sys_Error ("GL_LoadTexture: too big");
|
||||
|
||||
samples = alpha ? gl_alpha_format : gl_solid_format;
|
||||
|
@ -1173,6 +1176,8 @@ done: ;
|
|||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
}
|
||||
|
||||
free (scaled);
|
||||
}
|
||||
|
||||
void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha)
|
||||
|
|
Loading…
Reference in a new issue