Header file clean-up:
[mesa.git] / src / mesa / main / api_arrayelt.c
index f5b3695bfd9b2d61389106aa23621bd4362df472..5d8609b91045e827d58a6dd1c08f7ee1191179b7 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: api_arrayelt.c,v 1.5 2001/12/28 06:28:10 gareth Exp $ */
+/* $Id: api_arrayelt.c,v 1.10 2002/10/24 23:57:19 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.5
+ * Version:  4.1
  *
- * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2002  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"),
@@ -32,7 +32,7 @@
 #include "api_arrayelt.h"
 #include "context.h"
 #include "glapi.h"
-#include "mem.h"
+#include "imports.h"
 #include "macros.h"
 #include "mtypes.h"
 
@@ -63,7 +63,7 @@ typedef struct {
 
 static void (*colorfuncs[2][8])( const void * ) = {
    { (array_func)glColor3bv,
-     (array_func)glColor3ub,
+     (array_func)glColor3ubv,
      (array_func)glColor3sv,
      (array_func)glColor3usv,
      (array_func)glColor3iv,
@@ -72,7 +72,7 @@ static void (*colorfuncs[2][8])( const void * ) = {
      (array_func)glColor3dv },
 
    { (array_func)glColor4bv,
-     (array_func)glColor4ub,
+     (array_func)glColor4ubv,
      (array_func)glColor4sv,
      (array_func)glColor4usv,
      (array_func)glColor4iv,
@@ -172,38 +172,90 @@ static void (*normalfuncs[8])( const void * ) = {
    (array_func)glNormal3dv,
 };
 
-static void (*fogcoordfuncs[8])( const void * );
-static void (*secondarycolorfuncs[8])( const void * );
 
-GLboolean _ae_create_context( GLcontext *ctx )
+/* Wrapper functions in case glSecondaryColor*EXT doesn't exist */
+static void SecondaryColor3bvEXT(const GLbyte *c)
+{
+   _glapi_Dispatch->SecondaryColor3bvEXT(c);
+}
+
+static void SecondaryColor3ubvEXT(const GLubyte *c)
+{
+   _glapi_Dispatch->SecondaryColor3ubvEXT(c);
+}
+
+static void SecondaryColor3svEXT(const GLshort *c)
+{
+   _glapi_Dispatch->SecondaryColor3svEXT(c);
+}
+
+static void SecondaryColor3usvEXT(const GLushort *c)
+{
+   _glapi_Dispatch->SecondaryColor3usvEXT(c);
+}
+
+static void SecondaryColor3ivEXT(const GLint *c)
+{
+   _glapi_Dispatch->SecondaryColor3ivEXT(c);
+}
+
+static void SecondaryColor3uivEXT(const GLuint *c)
+{
+   _glapi_Dispatch->SecondaryColor3uivEXT(c);
+}
+
+static void SecondaryColor3fvEXT(const GLfloat *c)
+{
+   _glapi_Dispatch->SecondaryColor3fvEXT(c);
+}
+
+static void SecondaryColor3dvEXT(const GLdouble *c)
 {
-   static int firsttime = 1;
+   _glapi_Dispatch->SecondaryColor3dvEXT(c);
+}
 
+static void (*secondarycolorfuncs[8])( const void * ) = {
+   (array_func) SecondaryColor3bvEXT,
+   (array_func) SecondaryColor3ubvEXT,
+   (array_func) SecondaryColor3svEXT,
+   (array_func) SecondaryColor3usvEXT,
+   (array_func) SecondaryColor3ivEXT,
+   (array_func) SecondaryColor3uivEXT,
+   (array_func) SecondaryColor3fvEXT,
+   (array_func) SecondaryColor3dvEXT,
+};
+
+
+/* Again, wrapper functions in case glSecondaryColor*EXT doesn't exist */
+static void FogCoordfvEXT(const GLfloat *f)
+{
+   _glapi_Dispatch->FogCoordfvEXT(f);
+}
+
+static void FogCoorddvEXT(const GLdouble *f)
+{
+   _glapi_Dispatch->FogCoorddvEXT(f);
+}
+
+static void (*fogcoordfuncs[8])( const void * ) = {
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   (array_func) FogCoordfvEXT,
+   (array_func) FogCoorddvEXT
+};
+
+
+
+GLboolean _ae_create_context( GLcontext *ctx )
+{
    ctx->aelt_context = MALLOC( sizeof(AEcontext) );
    if (!ctx->aelt_context)
       return GL_FALSE;
 
-
-   if (firsttime)
-   {
-      firsttime = 0;
-
-      /* Don't really want to use api_compat.h for this, but the
-       * rational for using _glapi_get_proc_address is the same.
-       */
-      fogcoordfuncs[0] = (array_func) _glapi_get_proc_address("glSecondaryColor3bvEXT");
-      fogcoordfuncs[1] = (array_func) _glapi_get_proc_address("glSecondaryColor3ubvEXT");
-      fogcoordfuncs[2] = (array_func) _glapi_get_proc_address("glSecondaryColor3svEXT");
-      fogcoordfuncs[3] = (array_func) _glapi_get_proc_address("glSecondaryColor3usvEXT");
-      fogcoordfuncs[4] = (array_func) _glapi_get_proc_address("glSecondaryColor3ivEXT");
-      fogcoordfuncs[5] = (array_func) _glapi_get_proc_address("glSecondaryColor3uivEXT");
-      fogcoordfuncs[6] = (array_func) _glapi_get_proc_address("glSecondaryColor3fvEXT");
-      fogcoordfuncs[7] = (array_func) _glapi_get_proc_address("glSecondaryColor3dvEXT");
-
-      secondarycolorfuncs[6] = (array_func) _glapi_get_proc_address("glFogCoordfvEXT");
-      secondarycolorfuncs[7] = (array_func) _glapi_get_proc_address("glFogCoorddvEXT");
-   }
-
    AE_CONTEXT(ctx)->NewState = ~0;
    return GL_TRUE;
 }
@@ -223,7 +275,7 @@ static void _ae_update_state( GLcontext *ctx )
    AEcontext *actx = AE_CONTEXT(ctx);
    AEtexarray *ta = actx->texarrays;
    AEarray *aa = actx->arrays;
-   int i;
+   GLuint i;
 
    for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
       if (ctx->Array.TexCoord[i].Enabled) {
@@ -295,7 +347,7 @@ void _ae_loopback_array_elt( GLint elt )
       _ae_update_state( ctx );
 
    for (ta = actx->texarrays ; ta->func ; ta++) {
-      ta->func( ta->unit, (char *)ta->array->Ptr + elt * ta->array->StrideB );
+      ta->func( ta->unit + GL_TEXTURE0_ARB, (char *)ta->array->Ptr + elt * ta->array->StrideB );
    }
 
    /* Must be last