-/* $Id: api_arrayelt.c,v 1.3 2001/06/01 22:22:10 keithw Exp $ */
+/* $Id: api_arrayelt.c,v 1.4 2001/12/20 15:30:45 keithw Exp $ */
/*
* Mesa 3-D graphics library
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/* Author:
+ * Keith Whitwell <keith_whitwell@yahoo.com>
+ */
+
#include "glheader.h"
#include "api_arrayelt.h"
#include "context.h"
+#include "glapi.h"
#include "mem.h"
#include "macros.h"
#include "mtypes.h"
(void (*)( const void * ))glNormal3dv,
};
-static void (*fogcoordfuncs[8])( const void * ) = {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- (void (*)( const void * ))glFogCoordfvEXT,
- (void (*)( const void * ))glFogCoorddvEXT,
-};
-
-static void (*secondarycolorfuncs[8])( const void * ) = {
- (void (*)( const void * ))glSecondaryColor3bvEXT,
- (void (*)( const void * ))glSecondaryColor3ubvEXT,
- (void (*)( const void * ))glSecondaryColor3svEXT,
- (void (*)( const void * ))glSecondaryColor3usvEXT,
- (void (*)( const void * ))glSecondaryColor3ivEXT,
- (void (*)( const void * ))glSecondaryColor3uivEXT,
- (void (*)( const void * ))glSecondaryColor3fvEXT,
- (void (*)( const void * ))glSecondaryColor3dvEXT,
-};
-
+static void (*fogcoordfuncs[8])( const void * );
+static void (*secondarycolorfuncs[8])( const void * );
GLboolean _ae_create_context( GLcontext *ctx )
{
+ static int firsttime = 1;
+
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 _glaph_get_proc_address is the same.
+ */
+ fogcoordfuncs[0] = _glapi_get_proc_address("glSecondaryColor3bvEXT");
+ fogcoordfuncs[1] = _glapi_get_proc_address("glSecondaryColor3ubvEXT");
+ fogcoordfuncs[2] = _glapi_get_proc_address("glSecondaryColor3svEXT");
+ fogcoordfuncs[3] = _glapi_get_proc_address("glSecondaryColor3usvEXT");
+ fogcoordfuncs[4] = _glapi_get_proc_address("glSecondaryColor3ivEXT");
+ fogcoordfuncs[5] = _glapi_get_proc_address("glSecondaryColor3uivEXT");
+ fogcoordfuncs[6] = _glapi_get_proc_address("glSecondaryColor3fvEXT");
+ fogcoordfuncs[7] = _glapi_get_proc_address("glSecondaryColor3dvEXT");
+
+ secondarycolorfuncs[6] = _glapi_get_proc_address("glFogCoordfvEXT");
+ secondarycolorfuncs[7] = _glapi_get_proc_address("glFogCoorddvEXT");
+ }
+
AE_CONTEXT(ctx)->NewState = ~0;
return GL_TRUE;
}
-/* $Id: api_loopback.c,v 1.12 2001/12/14 02:50:01 brianp Exp $ */
+/* $Id: api_loopback.c,v 1.13 2001/12/20 15:30:45 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "glapitable.h"
#include "macros.h"
#include "colormac.h"
+#include "api_compat.h"
#include "api_loopback.h"
/* KW: A set of functions to convert unusual Color/Normal/Vertex/etc
* listed in dd.h. The easiest way for a driver to do this is to
* install the supplied software t&l module.
*/
-#define DRIVER(x) gl##x
-#define COLORUBV(v) DRIVER(Color4ubv)(v)
-#define COLORF(r,g,b,a) DRIVER(Color4f)(r,g,b,a)
-#define FOGCOORDF(x) DRIVER(FogCoordfEXT)(x)
-#define VERTEX2(x,y) DRIVER(Vertex2f)(x,y)
-#define VERTEX3(x,y,z) DRIVER(Vertex3f)(x,y,z)
-#define VERTEX4(x,y,z,w) DRIVER(Vertex4f)(x,y,z,w)
-#define NORMAL(x,y,z) DRIVER(Normal3f)(x,y,z)
-#define TEXCOORD1(s) DRIVER(TexCoord1f)(s)
-#define TEXCOORD2(s,t) DRIVER(TexCoord2f)(s,t)
-#define TEXCOORD3(s,t,u) DRIVER(TexCoord3f)(s,t,u)
-#define TEXCOORD4(s,t,u,v) DRIVER(TexCoord4f)(s,t,u,v)
-#define INDEX(c) DRIVER(Indexi)(c)
-#define MULTI_TEXCOORD1(z,s) DRIVER(MultiTexCoord1fARB)(z,s)
-#define MULTI_TEXCOORD2(z,s,t) DRIVER(MultiTexCoord2fARB)(z,s,t)
-#define MULTI_TEXCOORD3(z,s,t,u) DRIVER(MultiTexCoord3fARB)(z,s,t,u)
-#define MULTI_TEXCOORD4(z,s,t,u,v) DRIVER(MultiTexCoord4fARB)(z,s,t,u,v)
-#define EVALCOORD1(x) DRIVER(EvalCoord1f)(x)
-#define EVALCOORD2(x,y) DRIVER(EvalCoord2f)(x,y)
-#define MATERIALFV(a,b,c) DRIVER(Materialfv)(a,b,c)
-#define RECTF(a,b,c,d) DRIVER(Rectf)(a,b,c,d)
-#define SECONDARYCOLORUB(a,b,c) DRIVER(SecondaryColor3ubEXT)(a,b,c)
-#define SECONDARYCOLORF(a,b,c) DRIVER(SecondaryColor3fEXT)(a,b,c)
-#define ATTRIB(index, x, y, z, w) DRIVER(VertexAttrib4fNV)(index, x, y, z, w)
+#define COLORUBV(v) glColor4ubv(v)
+#define COLORF(r,g,b,a) glColor4f(r,g,b,a)
+#define VERTEX2(x,y) glVertex2f(x,y)
+#define VERTEX3(x,y,z) glVertex3f(x,y,z)
+#define VERTEX4(x,y,z,w) glVertex4f(x,y,z,w)
+#define NORMAL(x,y,z) glNormal3f(x,y,z)
+#define TEXCOORD1(s) glTexCoord1f(s)
+#define TEXCOORD2(s,t) glTexCoord2f(s,t)
+#define TEXCOORD3(s,t,u) glTexCoord3f(s,t,u)
+#define TEXCOORD4(s,t,u,v) glTexCoord4f(s,t,u,v)
+#define INDEX(c) glIndexi(c)
+#define MULTI_TEXCOORD1(z,s) glMultiTexCoord1fARB(z,s)
+#define MULTI_TEXCOORD2(z,s,t) glMultiTexCoord2fARB(z,s,t)
+#define MULTI_TEXCOORD3(z,s,t,u) glMultiTexCoord3fARB(z,s,t,u)
+#define MULTI_TEXCOORD4(z,s,t,u,v) glMultiTexCoord4fARB(z,s,t,u,v)
+#define EVALCOORD1(x) glEvalCoord1f(x)
+#define EVALCOORD2(x,y) glEvalCoord2f(x,y)
+#define MATERIALFV(a,b,c) glMaterialfv(a,b,c)
+#define RECTF(a,b,c,d) glRectf(a,b,c,d)
+
+
+
+#define FOGCOORDF(x) _compat_FogCoordfEXT(x)
+#define SECONDARYCOLORUB(a,b,c) _compat_SecondaryColor3ubEXT(a,b,c)
+#define SECONDARYCOLORF(a,b,c) _compat_SecondaryColor3fEXT(a,b,c)
static void
static void
loopback_SecondaryColor3bvEXT( const GLbyte *v )
{
- const GLfloat r = BYTE_TO_FLOAT(v[0]);
- const GLfloat g = BYTE_TO_FLOAT(v[1]);
- const GLfloat b = BYTE_TO_FLOAT(v[2]);
- SECONDARYCOLORF(r, g, b);
+ const GLfloat a = BYTE_TO_FLOAT(v[0]);
+ const GLfloat b = BYTE_TO_FLOAT(v[1]);
+ const GLfloat c = BYTE_TO_FLOAT(v[2]);
+ SECONDARYCOLORF(a,b,c);
}
static void
-/* $Id: t_imm_dlist.c,v 1.33 2001/12/14 02:51:45 brianp Exp $ */
+/* $Id: t_imm_dlist.c,v 1.34 2001/12/20 15:30:46 keithw Exp $ */
/*
* Mesa 3-D graphics library
#include "glheader.h"
+#include "api_compat.h"
#include "context.h"
#include "dlist.h"
#include "debug.h"
ASSERT((prim & PRIM_MODE_MASK) <= GL_POLYGON+1);
if (prim & PRIM_BEGIN) {
-/* fprintf(stderr, "begin %s\n", _mesa_prim_name[prim&PRIM_MODE_MASK]); */
glBegin(prim & PRIM_MODE_MASK);
}
}
}
- if (flags[i] & VERT_NORMAL_BIT) {
-/* fprintf(stderr, "normal %d: %f %f %f\n", i, */
-/* IM->Normal[i][0], IM->Normal[i][1], IM->Normal[i][2]); */
+ if (flags[i] & VERT_NORMAL_BIT)
glNormal3fv(IM->Normal[i]);
- }
- if (flags[i] & VERT_COLOR0_BIT) {
-/* fprintf(stderr, "color %d: %f %f %f\n", i, */
-/* IM->Color[i][0], IM->Color[i][1], IM->Color[i][2]); */
+ if (flags[i] & VERT_COLOR0_BIT)
glColor4fv( IM->Color[i] );
- }
if (flags[i] & VERT_COLOR1_BIT)
- glSecondaryColor3fvEXT( IM->SecondaryColor[i] );
+ _compat_SecondaryColor3fvEXT( IM->SecondaryColor[i] );
if (flags[i] & VERT_FOG_BIT)
- glFogCoordfEXT( IM->FogCoord[i] );
+ _compat_FogCoordfEXT( IM->FogCoord[i] );
if (flags[i] & VERT_INDEX_BIT)
glIndexi( IM->Index[i] );
if (flags[i] & VERT_MATERIAL)
emit_material( IM->Material[i], IM->MaterialMask[i] );
- if (flags[i]&VERT_OBJ_234) {
-/* fprintf(stderr, "vertex %d: %f %f %f\n", i, */
-/* IM->Obj[i][0], IM->Obj[i][1], IM->Obj[i][2]); */
+ if (flags[i]&VERT_OBJ_234)
vertex( IM->Obj[i] );
- }
else if (flags[i] & VERT_EVAL_C1)
glEvalCoord1f( IM->Obj[i][0] );
else if (flags[i] & VERT_EVAL_P1)
}
if (prim & PRIM_END) {
-/* fprintf(stderr, "end\n"); */
glEnd();
}
}