added Window-isms previously in gl.h
[mesa.git] / src / mesa / main / texobj.c
index 726c107a193cc9dfb4509fe0013ce1430f85e535..330943b5794494b24869eb5410792880f05bb5f0 100644 (file)
@@ -1,4 +1,3 @@
-/* $Id: texobj.c,v 1.16 2000/03/27 17:55:19 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -29,6 +28,7 @@
 #include "all.h"
 #else
 #include "glheader.h"
+#include "colortab.h"
 #include "context.h"
 #include "enums.h"
 #include "hash.h"
@@ -74,13 +74,7 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name,
       obj->BaseLevel = 0;
       obj->MaxLevel = 1000;
       obj->MinMagThresh = 0.0F;
-      obj->Palette.Table[0] = 255;
-      obj->Palette.Table[1] = 255;
-      obj->Palette.Table[2] = 255;
-      obj->Palette.Table[3] = 255;
-      obj->Palette.Size = 1;
-      obj->Palette.IntFormat = GL_RGBA;
-      obj->Palette.Format = GL_RGBA;
+      _mesa_init_colortable(&obj->Palette);
 
       /* insert into linked list */
       if (shared) {
@@ -144,7 +138,9 @@ void gl_free_texture_object( struct gl_shared_state *shared,
       _mesa_HashRemove(shared->TexObjects, t->Name);
    }
 
-   /* free texture image */
+   _mesa_free_colortable_data(&t->Palette);
+
+   /* free texture images */
    {
       GLuint i;
       for (i=0;i<MAX_TEXTURE_LEVELS;i++) {
@@ -168,7 +164,7 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur
    t->Complete = GL_TRUE;  /* be optimistic */
 
    /* Always need level zero image */
-   if (!t->Image[0] || !t->Image[0]->Data) {
+   if (!t->Image[0]) {
       t->Complete = GL_FALSE;
       return;
    }
@@ -207,10 +203,6 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur
       /* Test dimension-independent attributes */
       for (i = minLevel; i <= maxLevel; i++) {
          if (t->Image[i]) {
-            if (!t->Image[i]->Data) {
-               t->Complete = GL_FALSE;
-               return;
-            }
             if (t->Image[i]->Format != t->Image[0]->Format) {
                t->Complete = GL_FALSE;
                return;
@@ -235,10 +227,6 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur
                   t->Complete = GL_FALSE;
                   return;
                }
-               if (!t->Image[i]->Data) {
-                  t->Complete = GL_FALSE;
-                  return;
-               }
                if (t->Image[i]->Width2 != width ) {
                   t->Complete = GL_FALSE;
                   return;