-/* $Id: api_arrayelt.c,v 1.6 2002/01/14 16:06:35 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
- * Version: 4.1
+ * Version: 5.1
*
- * Copyright (C) 1999-2002 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,
GLboolean _ae_create_context( GLcontext *ctx )
{
+ if (ctx->aelt_context)
+ return GL_TRUE;
+
ctx->aelt_context = MALLOC( sizeof(AEcontext) );
if (!ctx->aelt_context)
return GL_FALSE;
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 );
}
}