-/* $Id: api_arrayelt.c,v 1.5 2001/12/28 06:28:10 gareth Exp $ */
-
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 5.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2003 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"),
*/
/* Author:
- * Keith Whitwell <keith_whitwell@yahoo.com>
+ * Keith Whitwell <keith@tungstengraphics.com>
*/
#include "glheader.h"
#include "api_arrayelt.h"
#include "context.h"
#include "glapi.h"
-#include "mem.h"
+#include "imports.h"
#include "macros.h"
#include "mtypes.h"
} AEarray;
typedef struct {
- AEtexarray texarrays[MAX_TEXTURE_UNITS+1];
+ AEtexarray texarrays[MAX_TEXTURE_COORD_UNITS + 1];
AEarray arrays[32];
GLuint NewState;
} AEcontext;
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,
(array_func)glColor3dv },
{ (array_func)glColor4bv,
- (array_func)glColor4ub,
+ (array_func)glColor4ubv,
(array_func)glColor4sv,
(array_func)glColor4usv,
(array_func)glColor4iv,
(array_func)glNormal3dv,
};
-static void (*fogcoordfuncs[8])( const void * );
-static void (*secondarycolorfuncs[8])( const void * );
+
+/* 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)
+{
+ _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 )
{
- static int firsttime = 1;
+ if (ctx->aelt_context)
+ return GL_TRUE;
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;
}
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++)
+ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++)
if (ctx->Array.TexCoord[i].Enabled) {
ta->unit = i;
ta->array = &ctx->Array.TexCoord[i];
}
-void _ae_loopback_array_elt( GLint elt )
+void GLAPIENTRY _ae_loopback_array_elt( GLint elt )
{
GET_CURRENT_CONTEXT(ctx);
AEcontext *actx = AE_CONTEXT(ctx);
_ae_update_state( ctx );
for (ta = actx->texarrays ; ta->func ; ta++) {
- ta->func( ta->unit, (char *)ta->array->Ptr + elt * ta->array->StrideB );
+ GLubyte *src = ta->array->BufferObj->Data
+ + (GLuint) ta->array->Ptr
+ + elt * ta->array->StrideB;
+ ta->func( ta->unit + GL_TEXTURE0_ARB, src);
}
/* Must be last
*/
for (aa = actx->arrays ; aa->func ; aa++) {
- aa->func( (char *)aa->array->Ptr + elt * aa->array->StrideB );
+ GLubyte *src = aa->array->BufferObj->Data
+ + (GLuint) aa->array->Ptr
+ + elt * aa->array->StrideB;
+ aa->func( src );
}
}