texture bpp info

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1506 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2007-12-27 06:03:47 +00:00
parent 53e54855da
commit c85954a26f
2 changed files with 6 additions and 4 deletions
+5 -3
View File
@@ -56,7 +56,7 @@ GLenum texformat(int bpp)
}
}
GLuint loadsurface(const char *texname, int &xs, int &ys, int clamp)
GLuint loadsurface(const char *texname, int &xs, int &ys, int &bpp, int clamp)
{
SDL_Surface *s = IMG_Load(findfile(texname, "rb"));
if(!s) { conoutf("couldn't load texture %s", texname); return 0; }
@@ -72,6 +72,7 @@ GLuint loadsurface(const char *texname, int &xs, int &ys, int clamp)
createtexture(tnum, s->w, s->h, s->pixels, clamp, true, format);
xs = s->w;
ys = s->h;
bpp = s->format->BitsPerPixel;
SDL_FreeSurface(s);
return tnum;
}
@@ -87,14 +88,15 @@ Texture *textureload(const char *name, int clamp)
path(pname);
Texture *t = textures.access(pname);
if(t) return t;
int xs, ys;
GLuint id = loadsurface(pname, xs, ys, clamp);
int xs, ys, bpp;
GLuint id = loadsurface(pname, xs, ys, bpp, clamp);
if(!id) return notexture;
char *key = newstring(pname);
t = &textures[key];
t->name = key;
t->xs = xs;
t->ys = ys;
t->bpp = bpp;
t->id = id;
return t;
}