textypeinfo_t;
-static textypeinfo_t textype_palette = {TEXTYPE_PALETTE , 1, 4, 4.0f, 3 , GL_BGRA , GL_UNSIGNED_BYTE };
-static textypeinfo_t textype_palette_alpha = {TEXTYPE_PALETTE , 1, 4, 4.0f, 4 , GL_BGRA , GL_UNSIGNED_BYTE };
-static textypeinfo_t textype_rgba = {TEXTYPE_RGBA , 4, 4, 4.0f, 3 , GL_RGBA , GL_UNSIGNED_BYTE };
-static textypeinfo_t textype_rgba_alpha = {TEXTYPE_RGBA , 4, 4, 4.0f, 4 , GL_RGBA , GL_UNSIGNED_BYTE };
+static textypeinfo_t textype_palette = {TEXTYPE_PALETTE , 1, 4, 4.0f, GL_RGBA , GL_BGRA , GL_UNSIGNED_BYTE };
+static textypeinfo_t textype_palette_alpha = {TEXTYPE_PALETTE , 1, 4, 4.0f, GL_RGBA , GL_BGRA , GL_UNSIGNED_BYTE };
+static textypeinfo_t textype_rgba = {TEXTYPE_RGBA , 4, 4, 4.0f, GL_RGBA , GL_RGBA , GL_UNSIGNED_BYTE };
+static textypeinfo_t textype_rgba_alpha = {TEXTYPE_RGBA , 4, 4, 4.0f, GL_RGBA , GL_RGBA , GL_UNSIGNED_BYTE };
static textypeinfo_t textype_rgba_compress = {TEXTYPE_RGBA , 4, 4, 0.5f, GL_COMPRESSED_RGB_S3TC_DXT1_EXT , GL_RGBA , GL_UNSIGNED_BYTE };
static textypeinfo_t textype_rgba_alpha_compress = {TEXTYPE_RGBA , 4, 4, 1.0f, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA , GL_UNSIGNED_BYTE };
-static textypeinfo_t textype_bgra = {TEXTYPE_BGRA , 4, 4, 4.0f, 3 , GL_BGRA , GL_UNSIGNED_BYTE };
-static textypeinfo_t textype_bgra_alpha = {TEXTYPE_BGRA , 4, 4, 4.0f, 4 , GL_BGRA , GL_UNSIGNED_BYTE };
+static textypeinfo_t textype_bgra = {TEXTYPE_BGRA , 4, 4, 4.0f, GL_RGBA , GL_BGRA , GL_UNSIGNED_BYTE };
+static textypeinfo_t textype_bgra_alpha = {TEXTYPE_BGRA , 4, 4, 4.0f, GL_RGBA , GL_BGRA , GL_UNSIGNED_BYTE };
static textypeinfo_t textype_bgra_compress = {TEXTYPE_BGRA , 4, 4, 0.5f, GL_COMPRESSED_RGB_S3TC_DXT1_EXT , GL_BGRA , GL_UNSIGNED_BYTE };
static textypeinfo_t textype_bgra_alpha_compress = {TEXTYPE_BGRA , 4, 4, 1.0f, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_BGRA , GL_UNSIGNED_BYTE };
static textypeinfo_t textype_shadowmap16 = {TEXTYPE_SHADOWMAP , 2, 2, 2.0f, GL_DEPTH_COMPONENT16_ARB , GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT};
static textypeinfo_t textype_dxt1a = {TEXTYPE_DXT1A , 4, 0, 0.5f, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, 0 , 0 };
static textypeinfo_t textype_dxt3 = {TEXTYPE_DXT3 , 4, 0, 1.0f, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, 0 , 0 };
static textypeinfo_t textype_dxt5 = {TEXTYPE_DXT5 , 4, 0, 1.0f, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 0 , 0 };
-static textypeinfo_t textype_colorbuffer = {TEXTYPE_COLORBUFFER, 4, 4, 4.0f, 4 , GL_BGRA , GL_UNSIGNED_BYTE };
+static textypeinfo_t textype_colorbuffer = {TEXTYPE_COLORBUFFER, 4, 4, 4.0f, GL_RGBA , GL_BGRA , GL_UNSIGNED_BYTE };
typedef enum gltexturetype_e
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
if (glt->texnum)
{
CHECKGLERROR
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
// change all the existing mipmap texture objects
// FIXME: force renderer(/client/something?) restart instead?
CHECKGLERROR
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
case RENDERPATH_D3D10:
case RENDERPATH_D3D11:
case RENDERPATH_SOFT:
+ case RENDERPATH_GLES2:
break;
case RENDERPATH_D3D9:
#if 0
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
// LordHavoc: allow any alignment
CHECKGLERROR
qglPixelStorei(GL_UNPACK_ALIGNMENT, 1);CHECKGLERROR
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
break;
case RENDERPATH_D3D9:
#ifdef SUPPORTD3D
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
break;
case RENDERPATH_D3D9:
#ifdef SUPPORTD3D
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
CHECKGLERROR
GL_ActiveTexture(0);
for (pool = gltexturepoolchain;pool;pool = pool->next)
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
{
int oldbindtexnum;
CHECKGLERROR
{
// multiply RGB channels by A channel before uploading
int alpha;
- for (i = 0;i < width*height*depth*4;i += 4)
+ for (i = 0;i < glt->inputwidth*glt->inputheight*glt->inputdepth*4;i += 4)
{
alpha = prevbuffer[i+3];
colorconvertbuffer[i] = (prevbuffer[i] * alpha) >> 8;
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
CHECKGLERROR
// we need to restore the texture binding after finishing the upload
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
CHECKGLERROR
qglGenTextures(1, (GLuint *)&glt->texnum);CHECKGLERROR
break;
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
CHECKGLERROR
GL_ActiveTexture(0);
oldbindtexnum = R_Mesh_TexBound(0, gltexturetypeenums[glt->texturetype]);
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
if (bytesperblock)
{
qglCompressedTexImage2DARB(GL_TEXTURE_2D, mip, glt->glinternalformat, mipwidth, mipheight, 0, mipsize, mippixels);CHECKGLERROR
case RENDERPATH_GL11:
case RENDERPATH_GL13:
case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
+ case RENDERPATH_GLES2:
if (dds_miplevels >= 1 && !mipcomplete)
{
// need to set GL_TEXTURE_MAX_LEVEL
return rt ? ((gltexture_t *)rt)->inputheight : 0;
}
-void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, int width, int height)
+void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, int z, int width, int height, int depth)
{
gltexture_t *glt = (gltexture_t *)rt;
if (data == NULL)
int outputskip = glt->tilewidth*bpp;
const unsigned char *input = data;
unsigned char *output = glt->bufferpixels;
+ if (glt->inputdepth != 1 || glt->sides != 1)
+ Sys_Error("R_UpdateTexture on buffered texture that is not 2D\n");
if (x < 0)
{
width += x;
for (j = 0;j < height;j++, output += outputskip, input += inputskip)
memcpy(output, input, width*bpp);
}
- else if (x || y || width != glt->inputwidth || height != glt->inputheight)
- R_UploadPartialTexture(glt, data, x, y, 0, width, height, 1);
+ else if (x || y || z || width != glt->inputwidth || height != glt->inputheight || depth != glt->inputdepth)
+ R_UploadPartialTexture(glt, data, x, y, z, width, height, depth);
else
R_UploadFullTexture(glt, data);
}