20e5845a7b01e6dfdee858d8a51cff04efe887bd
1 /* $Id: varray.c,v 1.41 2002/01/11 17:25:35 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 #include "math/m_translate.h"
48 _mesa_VertexPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
50 GET_CURRENT_CONTEXT(ctx
);
51 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
53 if (size
< 2 || size
> 4) {
54 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexPointer(size)" );
58 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexPointer(stride)" );
62 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
63 fprintf(stderr
, "glVertexPointer( sz %d type %s stride %d )\n", size
,
64 _mesa_lookup_enum_by_nr( type
),
67 /* always need to check that <type> is legal */
70 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLshort
);
73 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLint
);
76 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLfloat
);
79 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLdouble
);
82 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexPointer(type)" );
87 ctx
->Array
.Vertex
.StrideB
= stride
;
89 ctx
->Array
.Vertex
.Size
= size
;
90 ctx
->Array
.Vertex
.Type
= type
;
91 ctx
->Array
.Vertex
.Stride
= stride
;
92 ctx
->Array
.Vertex
.Ptr
= (void *) ptr
;
93 ctx
->NewState
|= _NEW_ARRAY
;
94 ctx
->Array
.NewState
|= _NEW_ARRAY_VERTEX
;
96 if (ctx
->Driver
.VertexPointer
)
97 ctx
->Driver
.VertexPointer( ctx
, size
, type
, stride
, ptr
);
104 _mesa_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
106 GET_CURRENT_CONTEXT(ctx
);
107 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
110 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNormalPointer(stride)" );
114 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
115 fprintf(stderr
, "glNormalPointer( type %s stride %d )\n",
116 _mesa_lookup_enum_by_nr( type
),
121 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLbyte
);
124 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLshort
);
127 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLint
);
130 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLfloat
);
133 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLdouble
);
136 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNormalPointer(type)" );
140 ctx
->Array
.Normal
.StrideB
= stride
;
142 ctx
->Array
.Normal
.Size
= 3;
143 ctx
->Array
.Normal
.Type
= type
;
144 ctx
->Array
.Normal
.Stride
= stride
;
145 ctx
->Array
.Normal
.Ptr
= (void *) ptr
;
146 ctx
->NewState
|= _NEW_ARRAY
;
147 ctx
->Array
.NewState
|= _NEW_ARRAY_VERTEX
;
149 if (ctx
->Driver
.NormalPointer
)
150 ctx
->Driver
.NormalPointer( ctx
, type
, stride
, ptr
);
156 _mesa_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
158 GET_CURRENT_CONTEXT(ctx
);
159 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
161 if (size
< 3 || size
> 4) {
162 _mesa_error( ctx
, GL_INVALID_VALUE
, "glColorPointer(size)" );
166 _mesa_error( ctx
, GL_INVALID_VALUE
, "glColorPointer(stride)" );
170 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
171 fprintf(stderr
, "glColorPointer( sz %d type %s stride %d )\n", size
,
172 _mesa_lookup_enum_by_nr( type
),
177 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLbyte
);
179 case GL_UNSIGNED_BYTE
:
180 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLubyte
);
183 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLshort
);
185 case GL_UNSIGNED_SHORT
:
186 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLushort
);
189 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLint
);
191 case GL_UNSIGNED_INT
:
192 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLuint
);
195 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLfloat
);
198 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLdouble
);
201 _mesa_error( ctx
, GL_INVALID_ENUM
, "glColorPointer(type)" );
206 ctx
->Array
.Color
.StrideB
= stride
;
208 ctx
->Array
.Color
.Size
= size
;
209 ctx
->Array
.Color
.Type
= type
;
210 ctx
->Array
.Color
.Stride
= stride
;
211 ctx
->Array
.Color
.Ptr
= (void *) ptr
;
212 ctx
->NewState
|= _NEW_ARRAY
;
213 ctx
->Array
.NewState
|= _NEW_ARRAY_VERTEX
;
215 if (ctx
->Driver
.ColorPointer
)
216 ctx
->Driver
.ColorPointer( ctx
, size
, type
, stride
, ptr
);
222 _mesa_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
224 GET_CURRENT_CONTEXT(ctx
);
225 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
228 _mesa_error( ctx
, GL_INVALID_VALUE
, "glFogCoordPointer(stride)" );
234 ctx
->Array
.FogCoord
.StrideB
= sizeof(GLfloat
);
237 ctx
->Array
.FogCoord
.StrideB
= sizeof(GLdouble
);
240 _mesa_error( ctx
, GL_INVALID_ENUM
, "glFogCoordPointer(type)" );
245 ctx
->Array
.FogCoord
.StrideB
= stride
;
247 ctx
->Array
.FogCoord
.Size
= 1;
248 ctx
->Array
.FogCoord
.Type
= type
;
249 ctx
->Array
.FogCoord
.Stride
= stride
;
250 ctx
->Array
.FogCoord
.Ptr
= (void *) ptr
;
251 ctx
->NewState
|= _NEW_ARRAY
;
252 ctx
->Array
.NewState
|= _NEW_ARRAY_VERTEX
;
254 if (ctx
->Driver
.FogCoordPointer
)
255 ctx
->Driver
.FogCoordPointer( ctx
, type
, stride
, ptr
);
260 _mesa_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
262 GET_CURRENT_CONTEXT(ctx
);
263 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
266 _mesa_error( ctx
, GL_INVALID_VALUE
, "glIndexPointer(stride)" );
271 case GL_UNSIGNED_BYTE
:
272 ctx
->Array
.Index
.StrideB
= sizeof(GLubyte
);
275 ctx
->Array
.Index
.StrideB
= sizeof(GLshort
);
278 ctx
->Array
.Index
.StrideB
= sizeof(GLint
);
281 ctx
->Array
.Index
.StrideB
= sizeof(GLfloat
);
284 ctx
->Array
.Index
.StrideB
= sizeof(GLdouble
);
287 _mesa_error( ctx
, GL_INVALID_ENUM
, "glIndexPointer(type)" );
292 ctx
->Array
.Index
.StrideB
= stride
;
294 ctx
->Array
.Index
.Size
= 1;
295 ctx
->Array
.Index
.Type
= type
;
296 ctx
->Array
.Index
.Stride
= stride
;
297 ctx
->Array
.Index
.Ptr
= (void *) ptr
;
298 ctx
->NewState
|= _NEW_ARRAY
;
299 ctx
->Array
.NewState
|= _NEW_ARRAY_VERTEX
;
301 if (ctx
->Driver
.IndexPointer
)
302 ctx
->Driver
.IndexPointer( ctx
, type
, stride
, ptr
);
307 _mesa_SecondaryColorPointerEXT(GLint size
, GLenum type
,
308 GLsizei stride
, const GLvoid
*ptr
)
310 GET_CURRENT_CONTEXT(ctx
);
311 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
313 if (size
!= 3 && size
!= 4) {
314 _mesa_error( ctx
, GL_INVALID_VALUE
, "glSecondaryColorPointer(size)" );
318 _mesa_error( ctx
, GL_INVALID_VALUE
, "glSecondaryColorPointer(stride)" );
322 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
324 "glSecondaryColorPointer( sz %d type %s stride %d )\n", size
,
325 _mesa_lookup_enum_by_nr( type
),
330 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLbyte
);
332 case GL_UNSIGNED_BYTE
:
333 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLubyte
);
336 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLshort
);
338 case GL_UNSIGNED_SHORT
:
339 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLushort
);
342 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLint
);
344 case GL_UNSIGNED_INT
:
345 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLuint
);
348 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLfloat
);
351 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLdouble
);
354 _mesa_error( ctx
, GL_INVALID_ENUM
, "glSecondaryColorPointer(type)" );
359 ctx
->Array
.SecondaryColor
.StrideB
= stride
;
361 ctx
->Array
.SecondaryColor
.Size
= 3; /* hardwire */
362 ctx
->Array
.SecondaryColor
.Type
= type
;
363 ctx
->Array
.SecondaryColor
.Stride
= stride
;
364 ctx
->Array
.SecondaryColor
.Ptr
= (void *) ptr
;
365 ctx
->NewState
|= _NEW_ARRAY
;
366 ctx
->Array
.NewState
|= _NEW_ARRAY_VERTEX
;
368 if (ctx
->Driver
.SecondaryColorPointer
)
369 ctx
->Driver
.SecondaryColorPointer( ctx
, size
, type
, stride
, ptr
);
375 _mesa_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
378 GET_CURRENT_CONTEXT(ctx
);
379 GLuint texUnit
= ctx
->Array
.ActiveTexture
;
380 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
382 if (size
< 1 || size
> 4) {
383 _mesa_error( ctx
, GL_INVALID_VALUE
, "glTexCoordPointer(size)" );
387 _mesa_error( ctx
, GL_INVALID_VALUE
, "glTexCoordPointer(stride)" );
391 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
392 fprintf(stderr
, "glTexCoordPointer( unit %u sz %d type %s stride %d )\n",
395 _mesa_lookup_enum_by_nr( type
),
398 /* always need to check that <type> is legal */
401 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLshort
);
404 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLint
);
407 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLfloat
);
410 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLdouble
);
413 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexCoordPointer(type)" );
418 ctx
->Array
.TexCoord
[texUnit
].StrideB
= stride
;
420 ctx
->Array
.TexCoord
[texUnit
].Size
= size
;
421 ctx
->Array
.TexCoord
[texUnit
].Type
= type
;
422 ctx
->Array
.TexCoord
[texUnit
].Stride
= stride
;
423 ctx
->Array
.TexCoord
[texUnit
].Ptr
= (void *) ptr
;
424 ctx
->NewState
|= _NEW_ARRAY
;
425 ctx
->Array
.NewState
|= _NEW_ARRAY_VERTEX
;
427 if (ctx
->Driver
.TexCoordPointer
)
428 ctx
->Driver
.TexCoordPointer( ctx
, size
, type
, stride
, ptr
);
433 _mesa_EdgeFlagPointer(GLsizei stride
, const GLvoid
*vptr
)
435 GET_CURRENT_CONTEXT(ctx
);
436 const GLboolean
*ptr
= (GLboolean
*)vptr
;
437 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
440 _mesa_error( ctx
, GL_INVALID_VALUE
, "glEdgeFlagPointer(stride)" );
443 ctx
->Array
.EdgeFlag
.Stride
= stride
;
444 ctx
->Array
.EdgeFlag
.StrideB
= stride
? stride
: sizeof(GLboolean
);
445 ctx
->Array
.EdgeFlag
.Ptr
= (GLboolean
*) ptr
;
446 ctx
->NewState
|= _NEW_ARRAY
;
447 ctx
->Array
.NewState
|= _NEW_ARRAY_VERTEX
;
449 if (ctx
->Driver
.EdgeFlagPointer
)
450 ctx
->Driver
.EdgeFlagPointer( ctx
, stride
, ptr
);
454 void _mesa_VertexAttribPointerNV(GLuint index
, GLint size
, GLenum type
,
455 GLsizei stride
, const GLvoid
*pointer
)
457 GET_CURRENT_CONTEXT(ctx
);
458 ASSERT_OUTSIDE_BEGIN_END(ctx
);
460 if (index
>= VP_NUM_PROG_REGS
) {
461 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(index)");
465 if (size
< 1 || size
> 4) {
466 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(size)");
471 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(stride)");
475 if (type
== GL_UNSIGNED_BYTE
&& size
!= 4) {
476 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(size!=4)");
480 /* check for valid 'type' and compute StrideB right away */
482 case GL_UNSIGNED_BYTE
:
483 ctx
->Array
.Normal
.StrideB
= size
* sizeof(GLubyte
);
486 ctx
->Array
.Normal
.StrideB
= size
* sizeof(GLshort
);
489 ctx
->Array
.Normal
.StrideB
= size
* sizeof(GLfloat
);
492 ctx
->Array
.Normal
.StrideB
= size
* sizeof(GLdouble
);
495 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttribPointerNV(type)" );
500 ctx
->Array
.VertexAttrib
[index
].StrideB
= stride
;
502 ctx
->Array
.VertexAttrib
[index
].Stride
= stride
;
503 ctx
->Array
.VertexAttrib
[index
].Size
= size
;
504 ctx
->Array
.VertexAttrib
[index
].Type
= type
;
506 /* XXX need new flags here??? */
507 ctx
->NewState
|= _NEW_ARRAY
;
508 ctx
->Array
.NewState
|= _NEW_ARRAY_VERTEX
;
511 if (ctx->Driver.VertexAttribdPointer)
512 ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr );
518 _mesa_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
519 GLsizei count
, const GLvoid
*ptr
)
522 _mesa_VertexPointer(size
, type
, stride
, ptr
);
527 _mesa_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
531 _mesa_NormalPointer(type
, stride
, ptr
);
536 _mesa_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
,
540 _mesa_ColorPointer(size
, type
, stride
, ptr
);
545 _mesa_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
549 _mesa_IndexPointer(type
, stride
, ptr
);
554 _mesa_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
555 GLsizei count
, const GLvoid
*ptr
)
558 _mesa_TexCoordPointer(size
, type
, stride
, ptr
);
563 _mesa_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
566 _mesa_EdgeFlagPointer(stride
, ptr
);
573 _mesa_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
*pointer
)
575 GET_CURRENT_CONTEXT(ctx
);
576 GLboolean tflag
, cflag
, nflag
; /* enable/disable flags */
577 GLint tcomps
, ccomps
, vcomps
; /* components per texcoord, color, vertex */
579 GLenum ctype
= 0; /* color type */
580 GLint coffset
= 0, noffset
= 0, voffset
;/* color, normal, vertex offsets */
581 GLint defstride
; /* default stride */
585 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
588 c
= f
* ((4*sizeof(GLubyte
) + (f
-1)) / f
);
591 _mesa_error( ctx
, GL_INVALID_VALUE
, "glInterleavedArrays(stride)" );
597 tflag
= GL_FALSE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
598 tcomps
= 0; ccomps
= 0; vcomps
= 2;
603 tflag
= GL_FALSE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
604 tcomps
= 0; ccomps
= 0; vcomps
= 3;
609 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
610 tcomps
= 0; ccomps
= 4; vcomps
= 2;
611 ctype
= GL_UNSIGNED_BYTE
;
617 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
618 tcomps
= 0; ccomps
= 4; vcomps
= 3;
619 ctype
= GL_UNSIGNED_BYTE
;
625 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
626 tcomps
= 0; ccomps
= 3; vcomps
= 3;
633 tflag
= GL_FALSE
; cflag
= GL_FALSE
; nflag
= GL_TRUE
;
634 tcomps
= 0; ccomps
= 0; vcomps
= 3;
640 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_TRUE
;
641 tcomps
= 0; ccomps
= 4; vcomps
= 3;
649 tflag
= GL_TRUE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
650 tcomps
= 2; ccomps
= 0; vcomps
= 3;
655 tflag
= GL_TRUE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
656 tcomps
= 4; ccomps
= 0; vcomps
= 4;
660 case GL_T2F_C4UB_V3F
:
661 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
662 tcomps
= 2; ccomps
= 4; vcomps
= 3;
663 ctype
= GL_UNSIGNED_BYTE
;
669 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
670 tcomps
= 2; ccomps
= 3; vcomps
= 3;
677 tflag
= GL_TRUE
; cflag
= GL_FALSE
; nflag
= GL_TRUE
;
678 tcomps
= 2; ccomps
= 0; vcomps
= 3;
683 case GL_T2F_C4F_N3F_V3F
:
684 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_TRUE
;
685 tcomps
= 2; ccomps
= 4; vcomps
= 3;
692 case GL_T4F_C4F_N3F_V4F
:
693 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_TRUE
;
694 tcomps
= 4; ccomps
= 4; vcomps
= 4;
702 _mesa_error( ctx
, GL_INVALID_ENUM
, "glInterleavedArrays(format)" );
710 _mesa_DisableClientState( GL_EDGE_FLAG_ARRAY
);
711 _mesa_DisableClientState( GL_INDEX_ARRAY
);
714 coordUnitSave
= ctx
->Array
.ActiveTexture
;
717 GLint factor
= ctx
->Array
.TexCoordInterleaveFactor
;
718 for (i
= 0; i
< factor
; i
++) {
719 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ i
) );
720 _mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY
);
721 _mesa_TexCoordPointer( tcomps
, GL_FLOAT
, stride
,
722 (GLubyte
*) pointer
+ i
* coffset
);
724 for (i
= factor
; i
< (GLint
) ctx
->Const
.MaxTextureUnits
; i
++) {
725 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ i
) );
726 _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY
);
731 for (i
= 0; i
< (GLint
) ctx
->Const
.MaxTextureUnits
; i
++) {
732 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ i
) );
733 _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY
);
736 /* Restore texture coordinate unit index */
737 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ coordUnitSave
) );
742 _mesa_EnableClientState( GL_COLOR_ARRAY
);
743 _mesa_ColorPointer( ccomps
, ctype
, stride
,
744 (GLubyte
*) pointer
+ coffset
);
747 _mesa_DisableClientState( GL_COLOR_ARRAY
);
753 _mesa_EnableClientState( GL_NORMAL_ARRAY
);
754 _mesa_NormalPointer( GL_FLOAT
, stride
,
755 (GLubyte
*) pointer
+ noffset
);
758 _mesa_DisableClientState( GL_NORMAL_ARRAY
);
761 _mesa_EnableClientState( GL_VERTEX_ARRAY
);
762 _mesa_VertexPointer( vcomps
, GL_FLOAT
, stride
,
763 (GLubyte
*) pointer
+ voffset
);
769 _mesa_LockArraysEXT(GLint first
, GLsizei count
)
771 GET_CURRENT_CONTEXT(ctx
);
772 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
774 if (MESA_VERBOSE
& VERBOSE_API
)
775 fprintf(stderr
, "glLockArrays %d %d\n", first
, count
);
777 if (first
== 0 && count
> 0 &&
778 count
<= (GLint
) ctx
->Const
.MaxArrayLockSize
) {
779 ctx
->Array
.LockFirst
= first
;
780 ctx
->Array
.LockCount
= count
;
783 ctx
->Array
.LockFirst
= 0;
784 ctx
->Array
.LockCount
= 0;
787 ctx
->NewState
|= _NEW_ARRAY
;
788 ctx
->Array
.NewState
|= _NEW_ARRAY_ALL
;
790 if (ctx
->Driver
.LockArraysEXT
)
791 ctx
->Driver
.LockArraysEXT( ctx
, first
, count
);
796 _mesa_UnlockArraysEXT( void )
798 GET_CURRENT_CONTEXT(ctx
);
799 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
801 if (MESA_VERBOSE
& VERBOSE_API
)
802 fprintf(stderr
, "glUnlockArrays\n");
804 ctx
->Array
.LockFirst
= 0;
805 ctx
->Array
.LockCount
= 0;
806 ctx
->NewState
|= _NEW_ARRAY
;
807 ctx
->Array
.NewState
|= _NEW_ARRAY_ALL
;
809 if (ctx
->Driver
.UnlockArraysEXT
)
810 ctx
->Driver
.UnlockArraysEXT( ctx
);