-/* $Id: texobj.c,v 1.39 2001/02/17 18:41:01 brianp Exp $ */
+/* $Id: texobj.c,v 1.45 2001/03/18 08:53:49 gareth Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.5
*
- * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* Return: pointer to new texture object
*/
struct gl_texture_object *
-_mesa_alloc_texture_object( struct gl_shared_state *shared,
+_mesa_alloc_texture_object( struct gl_shared_state *shared,
GLuint name, GLuint dimensions )
{
struct gl_texture_object *obj;
obj->MaxLod = 1000.0;
obj->BaseLevel = 0;
obj->MaxLevel = 1000;
+ obj->MaxAnisotropy = 1.0;
obj->CompareFlag = GL_FALSE;
obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX;
+ obj->ShadowAmbient = 0;
_mesa_init_colortable(&obj->Palette);
/* insert into linked list */
if (t->Dimensions == 6) {
/* make sure that all six cube map level 0 images are the same size */
- const GLint w = t->Image[baseLevel]->Width2;
- const GLint h = t->Image[baseLevel]->Height2;
+ const GLuint w = t->Image[baseLevel]->Width2;
+ const GLuint h = t->Image[baseLevel]->Height2;
if (!t->NegX[baseLevel] ||
t->NegX[baseLevel]->Width2 != w ||
t->NegX[baseLevel]->Height2 != h ||
}
else {
/* Dimensions = ??? */
- gl_problem(NULL, "Bug in gl_test_texture_object_completeness\n");
+ _mesa_problem(ctx, "Bug in gl_test_texture_object_completeness\n");
}
}
}
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (n < 0) {
- gl_error( ctx, GL_INVALID_VALUE, "glGenTextures" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glGenTextures" );
return;
}
if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
fprintf(stderr, "glBindTexture %s %d\n",
- gl_lookup_enum_by_nr(target), (GLint) texName);
+ _mesa_lookup_enum_by_nr(target), (GLint) texName);
switch (target) {
case GL_TEXTURE_1D:
}
/* fallthrough */
default:
- gl_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
+ _mesa_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" );
return;
}
/* error checking */
if (newTexObj->Dimensions > 0 && newTexObj->Dimensions != targetDim) {
/* the named texture object's dimensions don't match the target */
- gl_error( ctx, GL_INVALID_OPERATION, "glBindTexture" );
+ _mesa_error( ctx, GL_INVALID_OPERATION, "glBindTexture" );
return;
}
}
newTexObj = _mesa_alloc_texture_object( ctx->Shared, texName,
targetDim);
if (!newTexObj) {
- gl_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindTexture");
return;
}
}
newTexObj->RefCount++;
-
+
/* do the actual binding, but first flush outstanding vertices:
*/
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->CurrentCubeMap = newTexObj;
break;
default:
- gl_problem(ctx, "bad target in BindTexture");
+ _mesa_problem(ctx, "bad target in BindTexture");
}
/* Pass BindTexture call to device driver */
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (n < 0) {
- gl_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" );
+ _mesa_error( ctx, GL_INVALID_VALUE, "glPrioritizeTextures" );
return;
}
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
if (n < 0) {
- gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)");
+ _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)");
return GL_FALSE;
}
for (i = 0; i < n; i++) {
struct gl_texture_object *t;
if (texName[i] == 0) {
- gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)");
+ _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)");
return GL_FALSE;
}
t = (struct gl_texture_object *)
}
}
else {
- gl_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)");
+ _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)");
return GL_FALSE;
}
}
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
return texture > 0 && _mesa_HashLookup(ctx->Shared->TexObjects, texture);
}
-