summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2000-05-22 16:33:20 +0000
committerBrian Paul <[email protected]>2000-05-22 16:33:20 +0000
commit86fc370d399167ec9bb978d053d4a72215c86c16 (patch)
tree41269faf262faf74f878896f562513ef580db98c /src/mesa/main/teximage.c
parent87a7897d38fe1fa4458901d15475e3306270b51e (diff)
initial code for GL_ARB_texture_cube_map
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r--src/mesa/main/teximage.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index ae50558bf26..2f3c0f12c80 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -385,6 +385,38 @@ set_teximage_component_sizes( struct gl_texture_image *texImage )
}
+/*
+ * Given a texture unit and a texture target, return the corresponding
+ * texture object.
+ */
+static struct gl_texture_object *
+select_tex_object(struct gl_texture_unit *unit, GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_1D:
+ return unit->CurrentD[1];
+ case GL_TEXTURE_2D:
+ return unit->CurrentD[2];
+ case GL_TEXTURE_3D:
+ return unit->CurrentD[3];
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
+ return unit->CurrentPosX;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
+ return unit->CurrentNegX;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
+ return unit->CurrentPosY;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
+ return unit->CurrentNegY;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
+ return unit->CurrentPosZ;
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+ return unit->CurrentNegZ;
+ default:
+ gl_problem(NULL, "bad target in select_tex_object()");
+ return NULL;
+ }
+}
+
/*
* Return new gl_texture_image struct with all fields initialized to zero.
@@ -1189,7 +1221,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
}
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = texUnit->CurrentD[2];
+ texObj = select_tex_object(texUnit, target);
texImage = texObj->Image[level];
if (!texImage) {
@@ -1756,7 +1788,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level,
}
texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
- texObj = texUnit->CurrentD[2];
+ texObj = select_tex_object(texUnit, target);
texImage = texObj->Image[level];
assert(texImage);