5752a42577fea451ce8d432f91af0feb39892dc1
2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 #include "math/m_translate.h"
41 _mesa_VertexPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
43 GET_CURRENT_CONTEXT(ctx
);
44 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
46 if (size
< 2 || size
> 4) {
47 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexPointer(size)" );
51 _mesa_error( ctx
, GL_INVALID_VALUE
, "glVertexPointer(stride)" );
55 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
56 _mesa_debug(ctx
, "glVertexPointer( sz %d type %s stride %d )\n", size
,
57 _mesa_lookup_enum_by_nr( type
), stride
);
59 /* always need to check that <type> is legal */
62 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLshort
);
65 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLint
);
68 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLfloat
);
71 ctx
->Array
.Vertex
.StrideB
= size
* sizeof(GLdouble
);
74 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexPointer(type)" );
79 ctx
->Array
.Vertex
.StrideB
= stride
;
81 ctx
->Array
.Vertex
.Size
= size
;
82 ctx
->Array
.Vertex
.Type
= type
;
83 ctx
->Array
.Vertex
.Stride
= stride
;
84 ctx
->Array
.Vertex
.Ptr
= (void *) ptr
;
85 ctx
->NewState
|= _NEW_ARRAY
;
86 ctx
->Array
.NewState
|= _NEW_ARRAY_VERTEX
;
88 if (ctx
->Driver
.VertexPointer
)
89 ctx
->Driver
.VertexPointer( ctx
, size
, type
, stride
, ptr
);
96 _mesa_NormalPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
98 GET_CURRENT_CONTEXT(ctx
);
99 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
102 _mesa_error( ctx
, GL_INVALID_VALUE
, "glNormalPointer(stride)" );
106 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
107 _mesa_debug(ctx
, "glNormalPointer( type %s stride %d )\n",
108 _mesa_lookup_enum_by_nr( type
), stride
);
112 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLbyte
);
115 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLshort
);
118 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLint
);
121 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLfloat
);
124 ctx
->Array
.Normal
.StrideB
= 3 * sizeof(GLdouble
);
127 _mesa_error( ctx
, GL_INVALID_ENUM
, "glNormalPointer(type)" );
131 ctx
->Array
.Normal
.StrideB
= stride
;
133 ctx
->Array
.Normal
.Size
= 3;
134 ctx
->Array
.Normal
.Type
= type
;
135 ctx
->Array
.Normal
.Stride
= stride
;
136 ctx
->Array
.Normal
.Ptr
= (void *) ptr
;
137 ctx
->NewState
|= _NEW_ARRAY
;
138 ctx
->Array
.NewState
|= _NEW_ARRAY_NORMAL
;
140 if (ctx
->Driver
.NormalPointer
)
141 ctx
->Driver
.NormalPointer( ctx
, type
, stride
, ptr
);
147 _mesa_ColorPointer(GLint size
, GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
149 GET_CURRENT_CONTEXT(ctx
);
150 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
152 if (size
< 3 || size
> 4) {
153 _mesa_error( ctx
, GL_INVALID_VALUE
, "glColorPointer(size)" );
157 _mesa_error( ctx
, GL_INVALID_VALUE
, "glColorPointer(stride)" );
161 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
162 _mesa_debug(ctx
, "glColorPointer( sz %d type %s stride %d )\n", size
,
163 _mesa_lookup_enum_by_nr( type
), stride
);
167 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLbyte
);
169 case GL_UNSIGNED_BYTE
:
170 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLubyte
);
173 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLshort
);
175 case GL_UNSIGNED_SHORT
:
176 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLushort
);
179 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLint
);
181 case GL_UNSIGNED_INT
:
182 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLuint
);
185 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLfloat
);
188 ctx
->Array
.Color
.StrideB
= size
* sizeof(GLdouble
);
191 _mesa_error( ctx
, GL_INVALID_ENUM
, "glColorPointer(type)" );
196 ctx
->Array
.Color
.StrideB
= stride
;
198 ctx
->Array
.Color
.Size
= size
;
199 ctx
->Array
.Color
.Type
= type
;
200 ctx
->Array
.Color
.Stride
= stride
;
201 ctx
->Array
.Color
.Ptr
= (void *) ptr
;
202 ctx
->NewState
|= _NEW_ARRAY
;
203 ctx
->Array
.NewState
|= _NEW_ARRAY_COLOR0
;
205 if (ctx
->Driver
.ColorPointer
)
206 ctx
->Driver
.ColorPointer( ctx
, size
, type
, stride
, ptr
);
212 _mesa_FogCoordPointerEXT(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
214 GET_CURRENT_CONTEXT(ctx
);
215 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
218 _mesa_error( ctx
, GL_INVALID_VALUE
, "glFogCoordPointer(stride)" );
224 ctx
->Array
.FogCoord
.StrideB
= sizeof(GLfloat
);
227 ctx
->Array
.FogCoord
.StrideB
= sizeof(GLdouble
);
230 _mesa_error( ctx
, GL_INVALID_ENUM
, "glFogCoordPointer(type)" );
235 ctx
->Array
.FogCoord
.StrideB
= stride
;
237 ctx
->Array
.FogCoord
.Size
= 1;
238 ctx
->Array
.FogCoord
.Type
= type
;
239 ctx
->Array
.FogCoord
.Stride
= stride
;
240 ctx
->Array
.FogCoord
.Ptr
= (void *) ptr
;
241 ctx
->NewState
|= _NEW_ARRAY
;
242 ctx
->Array
.NewState
|= _NEW_ARRAY_FOGCOORD
;
244 if (ctx
->Driver
.FogCoordPointer
)
245 ctx
->Driver
.FogCoordPointer( ctx
, type
, stride
, ptr
);
250 _mesa_IndexPointer(GLenum type
, GLsizei stride
, const GLvoid
*ptr
)
252 GET_CURRENT_CONTEXT(ctx
);
253 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
256 _mesa_error( ctx
, GL_INVALID_VALUE
, "glIndexPointer(stride)" );
261 case GL_UNSIGNED_BYTE
:
262 ctx
->Array
.Index
.StrideB
= sizeof(GLubyte
);
265 ctx
->Array
.Index
.StrideB
= sizeof(GLshort
);
268 ctx
->Array
.Index
.StrideB
= sizeof(GLint
);
271 ctx
->Array
.Index
.StrideB
= sizeof(GLfloat
);
274 ctx
->Array
.Index
.StrideB
= sizeof(GLdouble
);
277 _mesa_error( ctx
, GL_INVALID_ENUM
, "glIndexPointer(type)" );
282 ctx
->Array
.Index
.StrideB
= stride
;
284 ctx
->Array
.Index
.Size
= 1;
285 ctx
->Array
.Index
.Type
= type
;
286 ctx
->Array
.Index
.Stride
= stride
;
287 ctx
->Array
.Index
.Ptr
= (void *) ptr
;
288 ctx
->NewState
|= _NEW_ARRAY
;
289 ctx
->Array
.NewState
|= _NEW_ARRAY_INDEX
;
291 if (ctx
->Driver
.IndexPointer
)
292 ctx
->Driver
.IndexPointer( ctx
, type
, stride
, ptr
);
297 _mesa_SecondaryColorPointerEXT(GLint size
, GLenum type
,
298 GLsizei stride
, const GLvoid
*ptr
)
300 GET_CURRENT_CONTEXT(ctx
);
301 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
303 if (size
!= 3 && size
!= 4) {
304 _mesa_error( ctx
, GL_INVALID_VALUE
, "glSecondaryColorPointer(size)" );
308 _mesa_error( ctx
, GL_INVALID_VALUE
, "glSecondaryColorPointer(stride)" );
312 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
313 _mesa_debug(ctx
, "glSecondaryColorPointer( sz %d type %s stride %d )\n",
314 size
, _mesa_lookup_enum_by_nr( type
), stride
);
318 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLbyte
);
320 case GL_UNSIGNED_BYTE
:
321 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLubyte
);
324 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLshort
);
326 case GL_UNSIGNED_SHORT
:
327 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLushort
);
330 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLint
);
332 case GL_UNSIGNED_INT
:
333 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLuint
);
336 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLfloat
);
339 ctx
->Array
.SecondaryColor
.StrideB
= size
* sizeof(GLdouble
);
342 _mesa_error( ctx
, GL_INVALID_ENUM
, "glSecondaryColorPointer(type)" );
347 ctx
->Array
.SecondaryColor
.StrideB
= stride
;
349 ctx
->Array
.SecondaryColor
.Size
= 3; /* hardwire */
350 ctx
->Array
.SecondaryColor
.Type
= type
;
351 ctx
->Array
.SecondaryColor
.Stride
= stride
;
352 ctx
->Array
.SecondaryColor
.Ptr
= (void *) ptr
;
353 ctx
->NewState
|= _NEW_ARRAY
;
354 ctx
->Array
.NewState
|= _NEW_ARRAY_COLOR1
;
356 if (ctx
->Driver
.SecondaryColorPointer
)
357 ctx
->Driver
.SecondaryColorPointer( ctx
, size
, type
, stride
, ptr
);
363 _mesa_TexCoordPointer(GLint size
, GLenum type
, GLsizei stride
,
366 GET_CURRENT_CONTEXT(ctx
);
367 GLuint texUnit
= ctx
->Array
.ActiveTexture
;
368 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
370 if (size
< 1 || size
> 4) {
371 _mesa_error( ctx
, GL_INVALID_VALUE
, "glTexCoordPointer(size)" );
375 _mesa_error( ctx
, GL_INVALID_VALUE
, "glTexCoordPointer(stride)" );
379 if (MESA_VERBOSE
&(VERBOSE_VARRAY
|VERBOSE_API
))
380 _mesa_debug(ctx
, "glTexCoordPointer(unit %u sz %d type %s stride %d)\n",
381 texUnit
, size
, _mesa_lookup_enum_by_nr( type
), stride
);
383 /* always need to check that <type> is legal */
386 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLshort
);
389 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLint
);
392 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLfloat
);
395 ctx
->Array
.TexCoord
[texUnit
].StrideB
= size
* sizeof(GLdouble
);
398 _mesa_error( ctx
, GL_INVALID_ENUM
, "glTexCoordPointer(type)" );
403 ctx
->Array
.TexCoord
[texUnit
].StrideB
= stride
;
405 ctx
->Array
.TexCoord
[texUnit
].Size
= size
;
406 ctx
->Array
.TexCoord
[texUnit
].Type
= type
;
407 ctx
->Array
.TexCoord
[texUnit
].Stride
= stride
;
408 ctx
->Array
.TexCoord
[texUnit
].Ptr
= (void *) ptr
;
409 ctx
->NewState
|= _NEW_ARRAY
;
410 ctx
->Array
.NewState
|= _NEW_ARRAY_TEXCOORD(texUnit
);
412 if (ctx
->Driver
.TexCoordPointer
)
413 ctx
->Driver
.TexCoordPointer( ctx
, size
, type
, stride
, ptr
);
418 _mesa_EdgeFlagPointer(GLsizei stride
, const GLvoid
*vptr
)
420 GET_CURRENT_CONTEXT(ctx
);
421 const GLboolean
*ptr
= (GLboolean
*)vptr
;
422 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
425 _mesa_error( ctx
, GL_INVALID_VALUE
, "glEdgeFlagPointer(stride)" );
428 ctx
->Array
.EdgeFlag
.Stride
= stride
;
429 ctx
->Array
.EdgeFlag
.StrideB
= stride
? stride
: sizeof(GLboolean
);
430 ctx
->Array
.EdgeFlag
.Ptr
= (GLboolean
*) ptr
;
431 ctx
->NewState
|= _NEW_ARRAY
;
432 ctx
->Array
.NewState
|= _NEW_ARRAY_EDGEFLAG
;
434 if (ctx
->Driver
.EdgeFlagPointer
)
435 ctx
->Driver
.EdgeFlagPointer( ctx
, stride
, ptr
);
440 _mesa_VertexAttribPointerNV(GLuint index
, GLint size
, GLenum type
,
441 GLsizei stride
, const GLvoid
*ptr
)
443 GET_CURRENT_CONTEXT(ctx
);
444 ASSERT_OUTSIDE_BEGIN_END(ctx
);
446 if (index
>= VERT_ATTRIB_MAX
) {
447 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(index)");
451 if (size
< 1 || size
> 4) {
452 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(size)");
457 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(stride)");
461 if (type
== GL_UNSIGNED_BYTE
&& size
!= 4) {
462 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerNV(size!=4)");
466 /* check for valid 'type' and compute StrideB right away */
468 case GL_UNSIGNED_BYTE
:
469 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLubyte
);
472 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLshort
);
475 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLfloat
);
478 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLdouble
);
481 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttribPointerNV(type)" );
486 ctx
->Array
.VertexAttrib
[index
].StrideB
= stride
;
488 ctx
->Array
.VertexAttrib
[index
].Stride
= stride
;
489 ctx
->Array
.VertexAttrib
[index
].Size
= size
;
490 ctx
->Array
.VertexAttrib
[index
].Type
= type
;
491 ctx
->Array
.VertexAttrib
[index
].Ptr
= (void *) ptr
;
493 ctx
->NewState
|= _NEW_ARRAY
;
494 ctx
->Array
.NewState
|= _NEW_ARRAY_ATTRIB(index
);
496 if (ctx
->Driver
.VertexAttribPointer
)
497 ctx
->Driver
.VertexAttribPointer( ctx
, index
, size
, type
, stride
, ptr
);
502 _mesa_VertexAttribPointerARB(GLuint index
, GLint size
, GLenum type
,
503 GLboolean normalized
,
504 GLsizei stride
, const GLvoid
*ptr
)
506 GET_CURRENT_CONTEXT(ctx
);
507 ASSERT_OUTSIDE_BEGIN_END(ctx
);
509 if (index
>= ctx
->Const
.MaxVertexProgramAttribs
) {
510 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerARB(index)");
514 if (size
< 1 || size
> 4) {
515 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerARB(size)");
520 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerARB(stride)");
524 if (type
== GL_UNSIGNED_BYTE
&& size
!= 4) {
525 _mesa_error(ctx
, GL_INVALID_VALUE
, "glVertexAttribPointerARB(size!=4)");
529 /* check for valid 'type' and compute StrideB right away */
531 case GL_UNSIGNED_BYTE
:
532 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLubyte
);
535 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLshort
);
538 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLfloat
);
541 ctx
->Array
.VertexAttrib
[index
].StrideB
= size
* sizeof(GLdouble
);
544 _mesa_error( ctx
, GL_INVALID_ENUM
, "glVertexAttribPointerARB(type)" );
549 ctx
->Array
.VertexAttrib
[index
].StrideB
= stride
;
551 ctx
->Array
.VertexAttrib
[index
].Stride
= stride
;
552 ctx
->Array
.VertexAttrib
[index
].Size
= size
;
553 ctx
->Array
.VertexAttrib
[index
].Type
= type
;
554 ctx
->Array
.VertexAttrib
[index
].Normalized
= normalized
;
555 ctx
->Array
.VertexAttrib
[index
].Ptr
= (void *) ptr
;
557 ctx
->NewState
|= _NEW_ARRAY
;
558 ctx
->Array
.NewState
|= _NEW_ARRAY_ATTRIB(index
);
561 if (ctx->Driver.VertexAttribPointer)
562 ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr );
569 _mesa_VertexPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
570 GLsizei count
, const GLvoid
*ptr
)
573 _mesa_VertexPointer(size
, type
, stride
, ptr
);
578 _mesa_NormalPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
582 _mesa_NormalPointer(type
, stride
, ptr
);
587 _mesa_ColorPointerEXT(GLint size
, GLenum type
, GLsizei stride
, GLsizei count
,
591 _mesa_ColorPointer(size
, type
, stride
, ptr
);
596 _mesa_IndexPointerEXT(GLenum type
, GLsizei stride
, GLsizei count
,
600 _mesa_IndexPointer(type
, stride
, ptr
);
605 _mesa_TexCoordPointerEXT(GLint size
, GLenum type
, GLsizei stride
,
606 GLsizei count
, const GLvoid
*ptr
)
609 _mesa_TexCoordPointer(size
, type
, stride
, ptr
);
614 _mesa_EdgeFlagPointerEXT(GLsizei stride
, GLsizei count
, const GLboolean
*ptr
)
617 _mesa_EdgeFlagPointer(stride
, ptr
);
624 _mesa_InterleavedArrays(GLenum format
, GLsizei stride
, const GLvoid
*pointer
)
626 GET_CURRENT_CONTEXT(ctx
);
627 GLboolean tflag
, cflag
, nflag
; /* enable/disable flags */
628 GLint tcomps
, ccomps
, vcomps
; /* components per texcoord, color, vertex */
630 GLenum ctype
= 0; /* color type */
631 GLint coffset
= 0, noffset
= 0, voffset
;/* color, normal, vertex offsets */
632 GLint defstride
; /* default stride */
636 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
639 c
= f
* ((4*sizeof(GLubyte
) + (f
-1)) / f
);
642 _mesa_error( ctx
, GL_INVALID_VALUE
, "glInterleavedArrays(stride)" );
648 tflag
= GL_FALSE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
649 tcomps
= 0; ccomps
= 0; vcomps
= 2;
654 tflag
= GL_FALSE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
655 tcomps
= 0; ccomps
= 0; vcomps
= 3;
660 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
661 tcomps
= 0; ccomps
= 4; vcomps
= 2;
662 ctype
= GL_UNSIGNED_BYTE
;
668 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
669 tcomps
= 0; ccomps
= 4; vcomps
= 3;
670 ctype
= GL_UNSIGNED_BYTE
;
676 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
677 tcomps
= 0; ccomps
= 3; vcomps
= 3;
684 tflag
= GL_FALSE
; cflag
= GL_FALSE
; nflag
= GL_TRUE
;
685 tcomps
= 0; ccomps
= 0; vcomps
= 3;
691 tflag
= GL_FALSE
; cflag
= GL_TRUE
; nflag
= GL_TRUE
;
692 tcomps
= 0; ccomps
= 4; vcomps
= 3;
700 tflag
= GL_TRUE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
701 tcomps
= 2; ccomps
= 0; vcomps
= 3;
706 tflag
= GL_TRUE
; cflag
= GL_FALSE
; nflag
= GL_FALSE
;
707 tcomps
= 4; ccomps
= 0; vcomps
= 4;
711 case GL_T2F_C4UB_V3F
:
712 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
713 tcomps
= 2; ccomps
= 4; vcomps
= 3;
714 ctype
= GL_UNSIGNED_BYTE
;
720 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_FALSE
;
721 tcomps
= 2; ccomps
= 3; vcomps
= 3;
728 tflag
= GL_TRUE
; cflag
= GL_FALSE
; nflag
= GL_TRUE
;
729 tcomps
= 2; ccomps
= 0; vcomps
= 3;
734 case GL_T2F_C4F_N3F_V3F
:
735 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_TRUE
;
736 tcomps
= 2; ccomps
= 4; vcomps
= 3;
743 case GL_T4F_C4F_N3F_V4F
:
744 tflag
= GL_TRUE
; cflag
= GL_TRUE
; nflag
= GL_TRUE
;
745 tcomps
= 4; ccomps
= 4; vcomps
= 4;
753 _mesa_error( ctx
, GL_INVALID_ENUM
, "glInterleavedArrays(format)" );
761 _mesa_DisableClientState( GL_EDGE_FLAG_ARRAY
);
762 _mesa_DisableClientState( GL_INDEX_ARRAY
);
765 coordUnitSave
= ctx
->Array
.ActiveTexture
;
768 GLint factor
= ctx
->Array
.TexCoordInterleaveFactor
;
769 for (i
= 0; i
< factor
; i
++) {
770 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ i
) );
771 _mesa_EnableClientState( GL_TEXTURE_COORD_ARRAY
);
772 _mesa_TexCoordPointer( tcomps
, GL_FLOAT
, stride
,
773 (GLubyte
*) pointer
+ i
* coffset
);
775 for (i
= factor
; i
< (GLint
) ctx
->Const
.MaxTextureCoordUnits
; i
++) {
776 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ i
) );
777 _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY
);
782 for (i
= 0; i
< (GLint
) ctx
->Const
.MaxTextureCoordUnits
; i
++) {
783 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ i
) );
784 _mesa_DisableClientState( GL_TEXTURE_COORD_ARRAY
);
787 /* Restore texture coordinate unit index */
788 _mesa_ClientActiveTextureARB( (GLenum
) (GL_TEXTURE0_ARB
+ coordUnitSave
) );
793 _mesa_EnableClientState( GL_COLOR_ARRAY
);
794 _mesa_ColorPointer( ccomps
, ctype
, stride
,
795 (GLubyte
*) pointer
+ coffset
);
798 _mesa_DisableClientState( GL_COLOR_ARRAY
);
804 _mesa_EnableClientState( GL_NORMAL_ARRAY
);
805 _mesa_NormalPointer( GL_FLOAT
, stride
,
806 (GLubyte
*) pointer
+ noffset
);
809 _mesa_DisableClientState( GL_NORMAL_ARRAY
);
812 _mesa_EnableClientState( GL_VERTEX_ARRAY
);
813 _mesa_VertexPointer( vcomps
, GL_FLOAT
, stride
,
814 (GLubyte
*) pointer
+ voffset
);
820 _mesa_LockArraysEXT(GLint first
, GLsizei count
)
822 GET_CURRENT_CONTEXT(ctx
);
823 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
825 if (MESA_VERBOSE
& VERBOSE_API
)
826 _mesa_debug(ctx
, "glLockArrays %d %d\n", first
, count
);
828 if (first
== 0 && count
> 0 &&
829 count
<= (GLint
) ctx
->Const
.MaxArrayLockSize
) {
830 ctx
->Array
.LockFirst
= first
;
831 ctx
->Array
.LockCount
= count
;
834 ctx
->Array
.LockFirst
= 0;
835 ctx
->Array
.LockCount
= 0;
838 ctx
->NewState
|= _NEW_ARRAY
;
839 ctx
->Array
.NewState
|= _NEW_ARRAY_ALL
;
841 if (ctx
->Driver
.LockArraysEXT
)
842 ctx
->Driver
.LockArraysEXT( ctx
, first
, count
);
847 _mesa_UnlockArraysEXT( void )
849 GET_CURRENT_CONTEXT(ctx
);
850 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
852 if (MESA_VERBOSE
& VERBOSE_API
)
853 _mesa_debug(ctx
, "glUnlockArrays\n");
855 ctx
->Array
.LockFirst
= 0;
856 ctx
->Array
.LockCount
= 0;
857 ctx
->NewState
|= _NEW_ARRAY
;
858 ctx
->Array
.NewState
|= _NEW_ARRAY_ALL
;
860 if (ctx
->Driver
.UnlockArraysEXT
)
861 ctx
->Driver
.UnlockArraysEXT( ctx
);
866 /* GL_EXT_multi_draw_arrays */
867 /* Somebody forgot to spec the first and count parameters as const! <sigh> */
869 _mesa_MultiDrawArraysEXT( GLenum mode
, GLint
*first
,
870 GLsizei
*count
, GLsizei primcount
)
872 GET_CURRENT_CONTEXT(ctx
);
875 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
877 for (i
= 0; i
< primcount
; i
++) {
879 (ctx
->Exec
->DrawArrays
)(mode
, first
[i
], count
[i
]);
885 /* GL_EXT_multi_draw_arrays */
887 _mesa_MultiDrawElementsEXT( GLenum mode
, const GLsizei
*count
, GLenum type
,
888 const GLvoid
**indices
, GLsizei primcount
)
890 GET_CURRENT_CONTEXT(ctx
);
893 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
895 for (i
= 0; i
< primcount
; i
++) {
897 (ctx
->Exec
->DrawElements
)(mode
, count
[i
], type
, indices
[i
]);