fix GL_BACK color material bug
[mesa.git] / src / mesa / main / varray.c
index 3c1bf6eef374f15e15f19966ca797dde14aaec90..072426c6ea018d0fbbc20a1cda3e510c4f476c46 100644 (file)
@@ -1,10 +1,10 @@
-/* $Id: varray.c,v 1.17 1999/11/19 00:03:27 keithw Exp $ */
+/* $Id: varray.c,v 1.22 2000/06/12 15:30:51 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.1
+ * Version:  3.3
  * 
- * Copyright (C) 1999  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2000  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"),
@@ -37,6 +37,7 @@
 #include "macros.h"
 #include "mmath.h"
 #include "pipeline.h"
+#include "state.h"
 #include "texstate.h"
 #include "translate.h"
 #include "types.h"
@@ -341,9 +342,10 @@ _mesa_EdgeFlagPointer(GLsizei stride, const void *vptr)
 }
 
 
+#if 0
 /* Called only from gl_DrawElements
  */
-void gl_CVAEltPointer( GLcontext *ctx, GLenum type, const GLvoid *ptr )
+static void gl_CVAEltPointer( GLcontext *ctx, GLenum type, const GLvoid *ptr )
 {
    switch (type) {
       case GL_UNSIGNED_BYTE:
@@ -365,6 +367,63 @@ void gl_CVAEltPointer( GLcontext *ctx, GLenum type, const GLvoid *ptr )
    ctx->CVA.EltFunc = gl_trans_1ui_tab[TYPE_IDX(type)];
    ctx->Array.NewArrayState |= VERT_ELT; /* ??? */
 }
+#endif
+
+
+
+void
+_mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
+                       GLsizei count, const GLvoid *ptr)
+{
+   (void) count;
+   _mesa_VertexPointer(size, type, stride, ptr);
+}
+
+
+void
+_mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+                       const GLvoid *ptr)
+{
+   (void) count;
+   _mesa_NormalPointer(type, stride, ptr);
+}
+
+
+void
+_mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count,
+                      const GLvoid *ptr)
+{
+   (void) count;
+   _mesa_ColorPointer(size, type, stride, ptr);
+}
+
+
+void
+_mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+                      const GLvoid *ptr)
+{
+   (void) count;
+   _mesa_IndexPointer(type, stride, ptr);
+}
+
+
+void
+_mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
+                         GLsizei count, const GLvoid *ptr)
+{
+   (void) count;
+   _mesa_TexCoordPointer(size, type, stride, ptr);
+}
+
+
+void
+_mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr)
+{
+   (void) count;
+   _mesa_EdgeFlagPointer(stride, ptr);
+}
+
+
 
 
 
@@ -462,7 +521,8 @@ _mesa_ArrayElement( GLint i )
 }
 
 
-void gl_ArrayElement( GLcontext *CC, GLint i )
+static void
+gl_ArrayElement( GLcontext *CC, GLint i )
 {
    struct immediate *im = CC->input;
    ARRAY_ELT( im, i );
@@ -678,6 +738,7 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
 
         VB->NextPrimitive[VB->CopyStart] = VB->Count;
         VB->Primitive[VB->CopyStart] = mode;
+        ctx->Array.Flag[count] |= VERT_END_VB;
 
          /* Transform and render.
          */
@@ -813,7 +874,7 @@ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indice
       return;
    }
 
-   if (mode > GL_POLYGON) {
+   if (mode < 0 || mode > GL_POLYGON) {
       gl_error( ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
       return;
    }
@@ -1119,6 +1180,13 @@ _mesa_DrawRangeElements(GLenum mode, GLuint start,
       return;
    }
 
+#if 0
+   /*
+    * XXX something in locked arrays is broken!  If start = 0,
+    * end = 1 and count = 2 we'll take the LockArrays path and
+    * get incorrect results.  See Scott McMillan's bug of 3 Jan 2000.
+    * For now, don't use locked arrays.
+    */
    if (!ctx->Array.LockCount && 2*count > (GLint) 3*(end-start)) {
       glLockArraysEXT( start, end );
       glDrawElements( mode, count, type, indices );
@@ -1126,6 +1194,9 @@ _mesa_DrawRangeElements(GLenum mode, GLuint start,
    } else {
       glDrawElements( mode, count, type, indices );
    }
+#else
+   glDrawElements( mode, count, type, indices );
+#endif
 }