1 /* $Id: varray.c,v 1.47 2002/10/24 23:57:21 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.
39 #include "math/m_translate.h"
44 _mesa_VertexPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
46 GET_CURRENT_CONTEXT(ctx
);
47 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
49 if (size
< 2 || size
> 4) {
50 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexPointer(size)" );
54 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexPointer(stride)" );
58 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
59 _mesa_debug(ctx
, "glVertexPointer( sz %d type %s stride %d )\n", size
,
60 _mesa_lookup_enum_by_nr( type
), stride
);
62 /* always need to check that <type> is legal */
65 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLshort
);
68 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLint
);
71 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLfloat
);
74 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLdouble
);
77 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexPointer(type)" );
82 ctx
->Array
.Vertex
.StrideB
= stride
;
84 ctx
->Array
.Vertex
.Size
= size
;
85 ctx
->Array
.Vertex
.Type
= type
;
86 ctx
->Array
.Vertex
.Stride
= stride
;
87 ctx
->Array
.Vertex
.Ptr
= (void *) ptr
;
88 ctx
->NewState
|= _NEW_ARRAY
;
89 ctx
->Array
.NewState
|= _NEW_ARRAY_VERTEX
;
91 if (ctx
->Driver
.VertexPointer
)
92 ctx
->Driver
.VertexPointer( ctx
, size
, type
, stride
, ptr
);
99 _mesa_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
101 GET_CURRENT_CONTEXT(ctx
);
102 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
105 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNormalPointer(stride)" );
109 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
110 _mesa_debug(ctx
, "glNormalPointer( type %s stride %d )\n",
111 _mesa_lookup_enum_by_nr( type
), stride
);
115 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLbyte
);
118 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLshort
);
121 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLint
);
124 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLfloat
);
127 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLdouble
);
130 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNormalPointer(type)" );
134 ctx
->Array
.Normal
.StrideB
= stride
;
136 ctx
->Array
.Normal
.Size
= 3;
137 ctx
->Array
.Normal
.Type
= type
;
138 ctx
->Array
.Normal
.Stride
= stride
;
139 ctx
->Array
.Normal
.Ptr
= (void *) ptr
;
140 ctx
->NewState
|= _NEW_ARRAY
;
141 ctx
->Array
.NewState
|= _NEW_ARRAY_NORMAL
;
143 if (ctx
->Driver
.NormalPointer
)
144 ctx
->Driver
.NormalPointer( ctx
, type
, stride
, ptr
);
150 _mesa_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
152 GET_CURRENT_CONTEXT(ctx
);
153 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
155 if (size
< 3 || size
> 4) {
156 _mesa_error( ctx
, GL_INVALID_VALUE
, "glColorPointer(size)" );
160 _mesa_error( ctx
, GL_INVALID_VALUE
, "glColorPointer(stride)" );
164 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
165 _mesa_debug(ctx
, "glColorPointer( sz %d type %s stride %d )\n", size
,
166 _mesa_lookup_enum_by_nr( type
), stride
);
170 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLbyte
);
172 case GL_UNSIGNED_BYTE
:
173 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLubyte
);
176 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLshort
);
178 case GL_UNSIGNED_SHORT
:
179 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLushort
);
182 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLint
);
184 case GL_UNSIGNED_INT
:
185 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLuint
);
188 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLfloat
);
191 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLdouble
);
194 _mesa_error( ctx
, GL_INVALID_ENUM
, "glColorPointer(type)" );
199 ctx
->Array
.Color
.StrideB
= stride
;
201 ctx
->Array
.Color
.Size
= size
;
202 ctx
->Array
.Color
.Type
= type
;
203 ctx
->Array
.Color
.Stride
= stride
;
204 ctx
->Array
.Color
.Ptr
= (void *) ptr
;
205 ctx
->NewState
|= _NEW_ARRAY
;
206 ctx
->Array
.NewState
|= _NEW_ARRAY_COLOR0
;
208 if (ctx
->Driver
.ColorPointer
)
209 ctx
->Driver
.ColorPointer( ctx
, size
, type
, stride
, ptr
);
215 _mesa_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
217 GET_CURRENT_CONTEXT(ctx
);
218 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
221 _mesa_error( ctx
, GL_INVALID_VALUE
, "glFogCoordPointer(stride)" );
227 ctx
->Array
.FogCoord
.StrideB
= sizeof(GLfloat
);
230 ctx
->Array
.FogCoord
.StrideB
= sizeof(GLdouble
);
233 _mesa_error( ctx
, GL_INVALID_ENUM
, "glFogCoordPointer(type)" );
238 ctx
->Array
.FogCoord
.StrideB
= stride
;
240 ctx
->Array
.FogCoord
.Size
= 1;
241 ctx
->Array
.FogCoord
.Type
= type
;
242 ctx
->Array
.FogCoord
.Stride
= stride
;
243 ctx
->Array
.FogCoord
.Ptr
= (void *) ptr
;
244 ctx
->NewState
|= _NEW_ARRAY
;
245 ctx
->Array
.NewState
|= _NEW_ARRAY_FOGCOORD
;
247 if (ctx
->Driver
.FogCoordPointer
)
248 ctx
->Driver
.FogCoordPointer( ctx
, type
, stride
, ptr
);
253 _mesa_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
255 GET_CURRENT_CONTEXT(ctx
);
256 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
259 _mesa_error( ctx
, GL_INVALID_VALUE
, "glIndexPointer(stride)" );
264 case GL_UNSIGNED_BYTE
:
265 ctx
->Array
.Index
.StrideB
= sizeof(GLubyte
);
268 ctx
->Array
.Index
.StrideB
= sizeof(GLshort
);
271 ctx
->Array
.Index
.StrideB
= sizeof(GLint
);
274 ctx
->Array
.Index
.StrideB
= sizeof(GLfloat
);
277 ctx
->Array
.Index
.StrideB
= sizeof(GLdouble
);
280 _mesa_error( ctx
, GL_INVALID_ENUM
, "glIndexPointer(type)" );
285 ctx
->Array
.Index
.StrideB
= stride
;
287 ctx
->Array
.Index
.Size
= 1;
288 ctx
->Array
.Index
.Type
= type
;
289 ctx
->Array
.Index
.Stride
= stride
;
290 ctx
->Array
.Index
.Ptr
= (void *) ptr
;
291 ctx
->NewState
|= _NEW_ARRAY
;
292 ctx
->Array
.NewState
|= _NEW_ARRAY_INDEX
;
294 if (ctx
->Driver
.IndexPointer
)
295 ctx
->Driver
.IndexPointer( ctx
, type
, stride
, ptr
);
300 _mesa_SecondaryColorPointerEXT(GLint size
, GLenum type
,
301 GLsizei stride
, const GLvoid
*ptr
)
303 GET_CURRENT_CONTEXT(ctx
);
304 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
306 if (size
!= 3 && size
!= 4) {
307 _mesa_error( ctx
, GL_INVALID_VALUE
, "glSecondaryColorPointer(size)" );
311 _mesa_error( ctx
, GL_INVALID_VALUE
, "glSecondaryColorPointer(stride)" );
315 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
316 _mesa_debug(ctx
, "glSecondaryColorPointer( sz %d type %s stride %d )\n",
317 size
, _mesa_lookup_enum_by_nr( type
), stride
);
321 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLbyte
);
323 case GL_UNSIGNED_BYTE
:
324 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLubyte
);
327 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLshort
);
329 case GL_UNSIGNED_SHORT
:
330 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLushort
);
333 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLint
);
335 case GL_UNSIGNED_INT
:
336 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLuint
);
339 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLfloat
);
342 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLdouble
);
345 _mesa_error( ctx
, GL_INVALID_ENUM
, "glSecondaryColorPointer(type)" );
350 ctx
->Array
.SecondaryColor
.StrideB
= stride
;
352 ctx
->Array
.SecondaryColor
.Size
= 3; /* hardwire */
353 ctx
->Array
.SecondaryColor
.Type
= type
;
354 ctx
->Array
.SecondaryColor
.Stride
= stride
;
355 ctx
->Array
.SecondaryColor
.Ptr
= (void *) ptr
;
356 ctx
->NewState
|= _NEW_ARRAY
;
357 ctx
->Array
.NewState
|= _NEW_ARRAY_COLOR1
;
359 if (ctx
->Driver
.SecondaryColorPointer
)
360 ctx
->Driver
.SecondaryColorPointer( ctx
, size
, type
, stride
, ptr
);
366 _mesa_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
369 GET_CURRENT_CONTEXT(ctx
);
370 GLuint texUnit
= ctx
->Array
.ActiveTexture
;
371 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
373 if (size
< 1 || size
> 4) {
374 _mesa_error( ctx
, GL_INVALID_VALUE
, "glTexCoordPointer(size)" );
378 _mesa_error( ctx
, GL_INVALID_VALUE
, "glTexCoordPointer(stride)" );
382 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
383 _mesa_debug(ctx
, "glTexCoordPointer(unit %u sz %d type %s stride %d)\n",
384 texUnit
, size
, _mesa_lookup_enum_by_nr( type
), stride
);
386 /* always need to check that <type> is legal */
389 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLshort
);
392 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLint
);
395 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLfloat
);
398 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLdouble
);
401 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexCoordPointer(type)" );
406 ctx
->Array
.TexCoord
[texUnit
].StrideB
= stride
;
408 ctx
->Array
.TexCoord
[texUnit
].Size
= size
;
409 ctx
->Array
.TexCoord
[texUnit
].Type
= type
;
410 ctx
->Array
.TexCoord
[texUnit
].Stride
= stride
;
411 ctx
->Array
.TexCoord
[texUnit
].Ptr
= (void *) ptr
;
412 ctx
->NewState
|= _NEW_ARRAY
;
413 ctx
->Array
.NewState
|= _NEW_ARRAY_TEXCOORD(texUnit
);
415 if (ctx
->Driver
.TexCoordPointer
)
416 ctx
->Driver
.TexCoordPointer( ctx
, size
, type
, stride
, ptr
);
421 _mesa_EdgeFlagPointer(GLsizei stride
, const GLvoid
*vptr
)
423 GET_CURRENT_CONTEXT(ctx
);
424 const GLboolean
*ptr
= (GLboolean
*)vptr
;
425 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
428 _mesa_error( ctx
, GL_INVALID_VALUE
, "glEdgeFlagPointer(stride)" );
431 ctx
->Array
.EdgeFlag
.Stride
= stride
;
432 ctx
->Array
.EdgeFlag
.StrideB
= stride
? stride
: sizeof(GLboolean
);
433 ctx
->Array
.EdgeFlag
.Ptr
= (GLboolean
*) ptr
;
434 ctx
->NewState
|= _NEW_ARRAY
;
435 ctx
->Array
.NewState
|= _NEW_ARRAY_EDGEFLAG
;
437 if (ctx
->Driver
.EdgeFlagPointer
)
438 ctx
->Driver
.EdgeFlagPointer( ctx
, stride
, ptr
);
442 void _mesa_VertexAttribPointerNV(GLuint index
, GLint size
, GLenum type
,
443 GLsizei stride
, const GLvoid
*ptr
)
445 GET_CURRENT_CONTEXT(ctx
);
446 ASSERT_OUTSIDE_BEGIN_END(ctx
);
448 if (index
>= VERT_ATTRIB_MAX
) {
449 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(index)");
453 if (size
< 1 || size
> 4) {
454 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(size)");
459 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(stride)");
463 if (type
== GL_UNSIGNED_BYTE
&& size
!= 4) {
464 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(size!=4)");
468 /* check for valid 'type' and compute StrideB right away */
470 case GL_UNSIGNED_BYTE
:
471 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLubyte
);
474 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLshort
);
477 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLfloat
);
480 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLdouble
);
483 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttribPointerNV(type)" );
488 ctx
->Array
.VertexAttrib
[index
].StrideB
= stride
;
490 ctx
->Array
.VertexAttrib
[index
].Stride
= stride
;
491 ctx
->Array
.VertexAttrib
[index
].Size
= size
;
492 ctx
->Array
.VertexAttrib
[index
].Type
= type
;
493 ctx
->Array
.VertexAttrib
[index
].Ptr
= (void *) ptr
;
495 ctx
->NewState
|= _NEW_ARRAY
;
496 ctx
->Array
.NewState
|= _NEW_ARRAY_ATTRIB(index
);
498 if (ctx
->Driver
.VertexAttribPointer
)
499 ctx
->Driver
.VertexAttribPointer( ctx
, index
, size
, type
, stride
, ptr
);
504 _mesa_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
505 GLsizei count
, const GLvoid
*ptr
)
508 _mesa_VertexPointer(size
, type
, stride
, ptr
);
513 _mesa_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
517 _mesa_NormalPointer(type
, stride
, ptr
);
522 _mesa_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
,
526 _mesa_ColorPointer(size
, type
, stride
, ptr
);
531 _mesa_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
535 _mesa_IndexPointer(type
, stride
, ptr
);
540 _mesa_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
541 GLsizei count
, const GLvoid
*ptr
)
544 _mesa_TexCoordPointer(size
, type
, stride
, ptr
);
549 _mesa_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
552 _mesa_EdgeFlagPointer(stride
, ptr
);
559 _mesa_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
*pointer
)
561 GET_CURRENT_CONTEXT(ctx
);
562 GLboolean tflag
, cflag
, nflag
; /* enable/disable flags */
563 GLint tcomps
, ccomps
, vcomps
; /* components per texcoord, color, vertex */
565 GLenum ctype
= 0; /* color type */
566 GLint coffset
= 0, noffset
= 0, voffset
;/* color, normal, vertex offsets */
567 GLint defstride
; /* default stride */
571 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
574 c
= f
* ((4*sizeof(GLubyte
) + (f
-1)) / f
);
577 _mesa_error( ctx
, GL_INVALID_VALUE
, "glInterleavedArrays(stride)" );
583 tflag
= GL_FALSE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
584 tcomps
= 0; ccomps
= 0; vcomps
= 2;
589 tflag
= GL_FALSE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
590 tcomps
= 0; ccomps
= 0; vcomps
= 3;
595 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
596 tcomps
= 0; ccomps
= 4; vcomps
= 2;
597 ctype
= GL_UNSIGNED_BYTE
;
603 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
604 tcomps
= 0; ccomps
= 4; vcomps
= 3;
605 ctype
= GL_UNSIGNED_BYTE
;
611 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
612 tcomps
= 0; ccomps
= 3; vcomps
= 3;
619 tflag
= GL_FALSE
; cflag
= GL_FALSE
; nflag
= GL_TRUE
;
620 tcomps
= 0; ccomps
= 0; vcomps
= 3;
626 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_TRUE
;
627 tcomps
= 0; ccomps
= 4; vcomps
= 3;
635 tflag
= GL_TRUE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
636 tcomps
= 2; ccomps
= 0; vcomps
= 3;
641 tflag
= GL_TRUE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
642 tcomps
= 4; ccomps
= 0; vcomps
= 4;
646 case GL_T2F_C4UB_V3F
:
647 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
648 tcomps
= 2; ccomps
= 4; vcomps
= 3;
649 ctype
= GL_UNSIGNED_BYTE
;
655 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
656 tcomps
= 2; ccomps
= 3; vcomps
= 3;
663 tflag
= GL_TRUE
; cflag
= GL_FALSE
; nflag
= GL_TRUE
;
664 tcomps
= 2; ccomps
= 0; vcomps
= 3;
669 case GL_T2F_C4F_N3F_V3F
:
670 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_TRUE
;
671 tcomps
= 2; ccomps
= 4; vcomps
= 3;
678 case GL_T4F_C4F_N3F_V4F
:
679 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_TRUE
;
680 tcomps
= 4; ccomps
= 4; vcomps
= 4;
688 _mesa_error( ctx
, GL_INVALID_ENUM
, "glInterleavedArrays(format)" );
696 _mesa_DisableClientState( GL_EDGE_FLAG_ARRAY
);
697 _mesa_DisableClientState( GL_INDEX_ARRAY
);
700 coordUnitSave
= ctx
->Array
.ActiveTexture
;
703 GLint factor
= ctx
->Array
.TexCoordInterleaveFactor
;
704 for (i
= 0; i
< factor
; i
++) {
705 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ i
) );
706 _mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY
);
707 _mesa_TexCoordPointer( tcomps
, GL_FLOAT
, stride
,
708 (GLubyte
*) pointer
+ i
* coffset
);
710 for (i
= factor
; i
< (GLint
) ctx
->Const
.MaxTextureUnits
; i
++) {
711 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ i
) );
712 _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY
);
717 for (i
= 0; i
< (GLint
) ctx
->Const
.MaxTextureUnits
; i
++) {
718 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ i
) );
719 _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY
);
722 /* Restore texture coordinate unit index */
723 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ coordUnitSave
) );
728 _mesa_EnableClientState( GL_COLOR_ARRAY
);
729 _mesa_ColorPointer( ccomps
, ctype
, stride
,
730 (GLubyte
*) pointer
+ coffset
);
733 _mesa_DisableClientState( GL_COLOR_ARRAY
);
739 _mesa_EnableClientState( GL_NORMAL_ARRAY
);
740 _mesa_NormalPointer( GL_FLOAT
, stride
,
741 (GLubyte
*) pointer
+ noffset
);
744 _mesa_DisableClientState( GL_NORMAL_ARRAY
);
747 _mesa_EnableClientState( GL_VERTEX_ARRAY
);
748 _mesa_VertexPointer( vcomps
, GL_FLOAT
, stride
,
749 (GLubyte
*) pointer
+ voffset
);
755 _mesa_LockArraysEXT(GLint first
, GLsizei count
)
757 GET_CURRENT_CONTEXT(ctx
);
758 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
760 if (MESA_VERBOSE
& VERBOSE_API
)
761 _mesa_debug(ctx
, "glLockArrays %d %d\n", first
, count
);
763 if (first
== 0 && count
> 0 &&
764 count
<= (GLint
) ctx
->Const
.MaxArrayLockSize
) {
765 ctx
->Array
.LockFirst
= first
;
766 ctx
->Array
.LockCount
= count
;
769 ctx
->Array
.LockFirst
= 0;
770 ctx
->Array
.LockCount
= 0;
773 ctx
->NewState
|= _NEW_ARRAY
;
774 ctx
->Array
.NewState
|= _NEW_ARRAY_ALL
;
776 if (ctx
->Driver
.LockArraysEXT
)
777 ctx
->Driver
.LockArraysEXT( ctx
, first
, count
);
782 _mesa_UnlockArraysEXT( void )
784 GET_CURRENT_CONTEXT(ctx
);
785 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
787 if (MESA_VERBOSE
& VERBOSE_API
)
788 _mesa_debug(ctx
, "glUnlockArrays\n");
790 ctx
->Array
.LockFirst
= 0;
791 ctx
->Array
.LockCount
= 0;
792 ctx
->NewState
|= _NEW_ARRAY
;
793 ctx
->Array
.NewState
|= _NEW_ARRAY_ALL
;
795 if (ctx
->Driver
.UnlockArraysEXT
)
796 ctx
->Driver
.UnlockArraysEXT( ctx
);
801 /* GL_EXT_multi_draw_arrays */
802 /* Somebody forgot to spec the first and count parameters as const! <sigh> */
804 _mesa_MultiDrawArraysEXT( GLenum mode
, GLint
*first
,
805 GLsizei
*count
, GLsizei primcount
)
807 GET_CURRENT_CONTEXT(ctx
);
810 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
812 for (i
= 0; i
< primcount
; i
++) {
814 (ctx
->Exec
->DrawArrays
)(mode
, first
[i
], count
[i
]);
820 /* GL_EXT_multi_draw_arrays */
822 _mesa_MultiDrawElementsEXT( GLenum mode
, const GLsizei
*count
, GLenum type
,
823 const GLvoid
**indices
, GLsizei primcount
)
825 GET_CURRENT_CONTEXT(ctx
);
828 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
830 for (i
= 0; i
< primcount
; i
++) {
832 (ctx
->Exec
->DrawElements
)(mode
, count
[i
], type
, indices
[i
]);