mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
Add an RGB texture loader.
This commit is contained in:
parent
7e5b3304fc
commit
6b4a10819a
2 changed files with 20 additions and 0 deletions
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
int GL_LoadQuakeTexture (const char *identifier, int width, int height,
|
int GL_LoadQuakeTexture (const char *identifier, int width, int height,
|
||||||
byte *data);
|
byte *data);
|
||||||
|
int GL_LoadRGBTexture (const char *identifier, int width, int height,
|
||||||
|
byte *data);
|
||||||
void GL_ReleaseTexture (int tex);
|
void GL_ReleaseTexture (int tex);
|
||||||
int GL_LoadTexture (const char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel);
|
int GL_LoadTexture (const char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel);
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,24 @@ GL_LoadQuakeTexture (const char *identifier, int width, int height, byte *data)
|
||||||
return tnum;
|
return tnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
GL_LoadRGBTexture (const char *identifier, int width, int height, byte *data)
|
||||||
|
{
|
||||||
|
GLuint tnum;
|
||||||
|
|
||||||
|
qfglGenTextures (1, &tnum);
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, tnum);
|
||||||
|
qfglTexImage2D (GL_TEXTURE_2D, 0, GL_RGB,
|
||||||
|
width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
|
||||||
|
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
|
qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
qfglGenerateMipmap (GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
return tnum;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GL_ReleaseTexture (int tex)
|
GL_ReleaseTexture (int tex)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue