summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>1999-12-01 21:10:08 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>1999-12-01 21:10:08 +0000
commit420ef64f18208a54b97e96936b741dc1531e45c8 (patch)
tree0be01b7663712ae2e9eebb1b5b9df7212389c325 /src/mesa/main
parenteb6e3d3613fda6e91f3b3fd9fb1e6a656cf461db (diff)
gl_BindTexture was broken when target==GL_TEXTURE_3D
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texobj.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 0abe6036eb..c23ea2c60d 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1,4 +1,4 @@
-/* $Id: texobj.c,v 1.9 1999/11/12 04:57:04 kendallb Exp $ */
+/* $Id: texobj.c,v 1.10 1999/12/01 21:10:08 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -56,10 +56,10 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
{
struct gl_texture_object *obj;
- assert(dimensions <= 3);
+ ASSERT(dimensions <= 3);
+
+ obj = CALLOC_STRUCT(gl_texture_object);
- obj = (struct gl_texture_object *)
- calloc(1,sizeof(struct gl_texture_object));
if (obj) {
/* init the non-zero fields */
obj->RefCount = 1;
@@ -420,14 +420,21 @@ _mesa_BindTexture( GLenum target, GLuint texName )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glBindTexture");
- dim = (GLuint) (target - GL_TEXTURE_1D);
-
- if (dim > 2) {
- gl_error( ctx, GL_INVALID_ENUM, "glBindTexture" );
- return;
+ switch (target) {
+ case GL_TEXTURE_1D:
+ dim = 1;
+ break;
+ case GL_TEXTURE_2D:
+ dim = 2;
+ break;
+ case GL_TEXTURE_3D:
+ dim = 3;
+ break;
+ default:
+ gl_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
+ return;
}
- dim++;
oldTexObj = texUnit->CurrentD[dim];
if (oldTexObj->Name == texName)
@@ -444,6 +451,7 @@ _mesa_BindTexture( GLenum target, GLuint texName )
if (newTexObj->Dimensions != dim) {
if (newTexObj->Dimensions) {
+ /* the named texture object's dimensions don't match the target */
gl_error( ctx, GL_INVALID_OPERATION, "glBindTexture" );
return;
}