xref: /reactos/dll/opengl/mesa/enable.c (revision 7eead935)
1 /* $Id: enable.c,v 1.23 1997/10/29 02:23:54 brianp Exp $ */
2 
3 /*
4  * Mesa 3-D graphics library
5  * Version:  2.5
6  * Copyright (C) 1995-1997  Brian Paul
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22 
23 
24 /*
25  * $Log: enable.c,v $
26  * Revision 1.23  1997/10/29 02:23:54  brianp
27  * added UseGlobalTexturePalette() dd function (David Bucciarelli v20 3dfx)
28  *
29  * Revision 1.22  1997/10/16 01:59:08  brianp
30  * added GL_EXT_shared_texture_palette extension
31  *
32  * Revision 1.21  1997/07/24 01:25:01  brianp
33  * changed precompiled header symbol from PCH to PC_HEADER
34  *
35  * Revision 1.20  1997/06/20 02:20:32  brianp
36  * replaced Current.IntColor with Current.ByteColor
37  *
38  * Revision 1.19  1997/05/31 16:57:14  brianp
39  * added MESA_NO_RASTER env var support
40  *
41  * Revision 1.18  1997/05/28 03:24:22  brianp
42  * added precompiled header (PCH) support
43  *
44  * Revision 1.17  1997/04/24 01:49:30  brianp
45  * call gl_set_color_function() instead of directly setting pointers
46  *
47  * Revision 1.16  1997/04/12 16:54:05  brianp
48  * new NEW_POLYGON state flag
49  *
50  * Revision 1.15  1997/04/12 16:20:27  brianp
51  * removed call to Driver.Dither()
52  *
53  * Revision 1.14  1997/04/02 03:10:36  brianp
54  * changed some #include's
55  *
56  * Revision 1.13  1997/02/27 19:59:08  brianp
57  * issue a warning if enable depth or stencil test without such a buffer
58  *
59  * Revision 1.12  1997/02/09 19:53:43  brianp
60  * now use TEXTURE_xD enable constants
61  *
62  * Revision 1.11  1997/02/09 18:49:37  brianp
63  * added GL_EXT_texture3D support
64  *
65  * Revision 1.10  1997/01/28 22:13:42  brianp
66  * now there's separate state for CI and RGBA logic op enabled
67  *
68  * Revision 1.9  1996/12/18 20:00:57  brianp
69  * gl_set_material() now takes a bitmask instead of face and pname
70  *
71  * Revision 1.8  1996/12/11 20:16:49  brianp
72  * more work on the GL_COLOR_MATERIAL bug
73  *
74  * Revision 1.7  1996/12/09 22:51:51  brianp
75  * update API Color4f and Color4ub pointers for GL_COLOR_MATERIAL
76  *
77  * Revision 1.6  1996/12/07 10:21:07  brianp
78  * call gl_set_material() instead of gl_Materialfv()
79  *
80  * Revision 1.5  1996/11/09 03:11:18  brianp
81  * added missing GL_EXT_vertex_array caps to gl_enable()
82  *
83  * Revision 1.4  1996/10/11 03:44:09  brianp
84  * added comments for GL_POLYGON_OFFSET_EXT symbol
85  *
86  * Revision 1.3  1996/09/27 01:26:40  brianp
87  * removed unused variables
88  *
89  * Revision 1.2  1996/09/15 14:17:30  brianp
90  * now use GLframebuffer and GLvisual
91  *
92  * Revision 1.1  1996/09/13 01:38:16  brianp
93  * Initial revision
94  *
95  */
96 
97 
98 #ifdef PC_HEADER
99 #include "all.h"
100 #else
101 #include <string.h>
102 #include "context.h"
103 #include "depth.h"
104 #include "enable.h"
105 #include "light.h"
106 #include "dlist.h"
107 #include "macros.h"
108 #include "stencil.h"
109 #include "types.h"
110 #include "vbfill.h"
111 #endif
112 
113 
114 
115 /*
116  * Perform glEnable and glDisable calls.
117  */
118 static void gl_enable( GLcontext* ctx, GLenum cap, GLboolean state )
119 {
120    GLuint p;
121 
122    if (INSIDE_BEGIN_END(ctx)) {
123       if (state) {
124 	 gl_error( ctx, GL_INVALID_OPERATION, "glEnable" );
125       }
126       else {
127 	 gl_error( ctx, GL_INVALID_OPERATION, "glDisable" );
128       }
129       return;
130    }
131 
132    switch (cap) {
133       case GL_ALPHA_TEST:
134          if (ctx->Color.AlphaEnabled!=state) {
135             ctx->Color.AlphaEnabled = state;
136             ctx->NewState |= NEW_RASTER_OPS;
137          }
138 	 break;
139       case GL_AUTO_NORMAL:
140 	 ctx->Eval.AutoNormal = state;
141 	 break;
142       case GL_BLEND:
143          if (ctx->Color.BlendEnabled!=state) {
144             ctx->Color.BlendEnabled = state;
145             /* The following needed to accomodate 1.0 RGB logic op blending */
146             ctx->Color.ColorLogicOpEnabled = GL_FALSE;
147             ctx->NewState |= NEW_RASTER_OPS;
148          }
149 	 break;
150       case GL_CLIP_PLANE0:
151       case GL_CLIP_PLANE1:
152       case GL_CLIP_PLANE2:
153       case GL_CLIP_PLANE3:
154       case GL_CLIP_PLANE4:
155       case GL_CLIP_PLANE5:
156 	 ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0] = state;
157 	 /* Check if any clip planes enabled */
158          ctx->Transform.AnyClip = GL_FALSE;
159          for (p=0;p<MAX_CLIP_PLANES;p++) {
160             if (ctx->Transform.ClipEnabled[p]) {
161                ctx->Transform.AnyClip = GL_TRUE;
162                break;
163             }
164          }
165 	 break;
166       case GL_COLOR_MATERIAL:
167          if (ctx->Light.ColorMaterialEnabled!=state) {
168             ctx->Light.ColorMaterialEnabled = state;
169             if (state) {
170                GLfloat color[4];
171                color[0] = ctx->Current.ByteColor[0] * ctx->Visual->InvRedScale;
172                color[1] = ctx->Current.ByteColor[1] * ctx->Visual->InvGreenScale;
173                color[2] = ctx->Current.ByteColor[2] * ctx->Visual->InvBlueScale;
174                color[3] = ctx->Current.ByteColor[3] * ctx->Visual->InvAlphaScale;
175                /* update material with current color */
176                gl_set_material( ctx, ctx->Light.ColorMaterialBitmask, color );
177             }
178             gl_set_color_function(ctx);
179             ctx->NewState |= NEW_LIGHTING;
180          }
181 	 break;
182       case GL_CULL_FACE:
183          if (ctx->Polygon.CullFlag!=state) {
184             ctx->Polygon.CullFlag = state;
185             ctx->NewState |= NEW_POLYGON;
186          }
187 	 break;
188       case GL_DEPTH_TEST:
189          if (state && ctx->Visual->DepthBits==0) {
190             gl_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer");
191             return;
192          }
193 	 if (ctx->Depth.Test!=state) {
194             ctx->Depth.Test = state;
195             ctx->NewState |= NEW_RASTER_OPS;
196          }
197          break;
198       case GL_DITHER:
199          if (ctx->NoDither) {
200             /* MESA_NO_DITHER env var */
201             state = GL_FALSE;
202          }
203          if (ctx->Color.DitherFlag!=state) {
204             ctx->Color.DitherFlag = state;
205             ctx->NewState |= NEW_RASTER_OPS;
206          }
207 	 break;
208       case GL_FOG:
209 	 if (ctx->Fog.Enabled!=state) {
210             ctx->Fog.Enabled = state;
211             ctx->NewState |= NEW_RASTER_OPS;
212          }
213 	 break;
214       case GL_LIGHT0:
215       case GL_LIGHT1:
216       case GL_LIGHT2:
217       case GL_LIGHT3:
218       case GL_LIGHT4:
219       case GL_LIGHT5:
220       case GL_LIGHT6:
221       case GL_LIGHT7:
222          ctx->Light.Light[cap-GL_LIGHT0].Enabled = state;
223          ctx->NewState |= NEW_LIGHTING;
224          break;
225       case GL_LIGHTING:
226          if (ctx->Light.Enabled!=state) {
227             ctx->Light.Enabled = state;
228             ctx->NewState |= NEW_LIGHTING;
229          }
230          break;
231       case GL_LINE_SMOOTH:
232 	 if (ctx->Line.SmoothFlag!=state) {
233             ctx->Line.SmoothFlag = state;
234             ctx->NewState |= NEW_RASTER_OPS;
235          }
236 	 break;
237       case GL_LINE_STIPPLE:
238 	 if (ctx->Line.StippleFlag!=state) {
239             ctx->Line.StippleFlag = state;
240             ctx->NewState |= NEW_RASTER_OPS;
241          }
242 	 break;
243       case GL_INDEX_LOGIC_OP:
244          if (ctx->Color.IndexLogicOpEnabled!=state) {
245             ctx->NewState |= NEW_RASTER_OPS;
246          }
247 	 ctx->Color.IndexLogicOpEnabled = state;
248 	 break;
249       case GL_COLOR_LOGIC_OP:
250          if (ctx->Color.ColorLogicOpEnabled!=state) {
251             ctx->NewState |= NEW_RASTER_OPS;
252          }
253 	 ctx->Color.ColorLogicOpEnabled = state;
254 	 break;
255       case GL_MAP1_COLOR_4:
256 	 ctx->Eval.Map1Color4 = state;
257 	 break;
258       case GL_MAP1_INDEX:
259 	 ctx->Eval.Map1Index = state;
260 	 break;
261       case GL_MAP1_NORMAL:
262 	 ctx->Eval.Map1Normal = state;
263 	 break;
264       case GL_MAP1_TEXTURE_COORD_1:
265 	 ctx->Eval.Map1TextureCoord1 = state;
266 	 break;
267       case GL_MAP1_TEXTURE_COORD_2:
268 	 ctx->Eval.Map1TextureCoord2 = state;
269 	 break;
270       case GL_MAP1_TEXTURE_COORD_3:
271 	 ctx->Eval.Map1TextureCoord3 = state;
272 	 break;
273       case GL_MAP1_TEXTURE_COORD_4:
274 	 ctx->Eval.Map1TextureCoord4 = state;
275 	 break;
276       case GL_MAP1_VERTEX_3:
277 	 ctx->Eval.Map1Vertex3 = state;
278 	 break;
279       case GL_MAP1_VERTEX_4:
280 	 ctx->Eval.Map1Vertex4 = state;
281 	 break;
282       case GL_MAP2_COLOR_4:
283 	 ctx->Eval.Map2Color4 = state;
284 	 break;
285       case GL_MAP2_INDEX:
286 	 ctx->Eval.Map2Index = state;
287 	 break;
288       case GL_MAP2_NORMAL:
289 	 ctx->Eval.Map2Normal = state;
290 	 break;
291       case GL_MAP2_TEXTURE_COORD_1:
292 	 ctx->Eval.Map2TextureCoord1 = state;
293 	 break;
294       case GL_MAP2_TEXTURE_COORD_2:
295 	 ctx->Eval.Map2TextureCoord2 = state;
296 	 break;
297       case GL_MAP2_TEXTURE_COORD_3:
298 	 ctx->Eval.Map2TextureCoord3 = state;
299 	 break;
300       case GL_MAP2_TEXTURE_COORD_4:
301 	 ctx->Eval.Map2TextureCoord4 = state;
302 	 break;
303       case GL_MAP2_VERTEX_3:
304 	 ctx->Eval.Map2Vertex3 = state;
305 	 break;
306       case GL_MAP2_VERTEX_4:
307 	 ctx->Eval.Map2Vertex4 = state;
308 	 break;
309       case GL_NORMALIZE:
310 	 ctx->Transform.Normalize = state;
311 	 break;
312       case GL_POINT_SMOOTH:
313 	 if (ctx->Point.SmoothFlag!=state) {
314             ctx->Point.SmoothFlag = state;
315             ctx->NewState |= NEW_RASTER_OPS;
316          }
317 	 break;
318       case GL_POLYGON_SMOOTH:
319 	 if (ctx->Polygon.SmoothFlag!=state) {
320             ctx->Polygon.SmoothFlag = state;
321             ctx->NewState |= NEW_RASTER_OPS;
322          }
323 	 break;
324       case GL_POLYGON_STIPPLE:
325 	 if (ctx->Polygon.StippleFlag!=state) {
326             ctx->Polygon.StippleFlag = state;
327             ctx->NewState |= NEW_RASTER_OPS;
328          }
329 	 break;
330       case GL_POLYGON_OFFSET_POINT:
331          if (ctx->Polygon.OffsetPoint!=state) {
332             ctx->Polygon.OffsetPoint = state;
333             ctx->NewState |= NEW_POLYGON;
334          }
335          break;
336       case GL_POLYGON_OFFSET_LINE:
337          if (ctx->Polygon.OffsetLine!=state) {
338             ctx->Polygon.OffsetLine = state;
339             ctx->NewState |= NEW_POLYGON;
340          }
341          break;
342       case GL_POLYGON_OFFSET_FILL:
343       /*case GL_POLYGON_OFFSET_EXT:*/
344          if (ctx->Polygon.OffsetFill!=state) {
345             ctx->Polygon.OffsetFill = state;
346             ctx->NewState |= NEW_POLYGON;
347          }
348          break;
349       case GL_SCISSOR_TEST:
350          if (ctx->Scissor.Enabled!=state) {
351             ctx->Scissor.Enabled = state;
352             ctx->NewState |= NEW_RASTER_OPS;
353          }
354 	 break;
355       case GL_STENCIL_TEST:
356 	 if (state && ctx->Visual->StencilBits==0) {
357             gl_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer");
358             return;
359 	 }
360 	 if (ctx->Stencil.Enabled!=state) {
361             ctx->Stencil.Enabled = state;
362             ctx->NewState |= NEW_RASTER_OPS;
363          }
364 	 break;
365       case GL_TEXTURE_1D:
366          if (ctx->Visual->RGBAflag) {
367             /* texturing only works in RGB mode */
368             if (state) {
369                ctx->Texture.Enabled |= TEXTURE_1D;
370             }
371             else {
372                ctx->Texture.Enabled &= (~TEXTURE_1D);
373             }
374             ctx->NewState |= (NEW_RASTER_OPS | NEW_TEXTURING);
375          }
376 	 break;
377       case GL_TEXTURE_2D:
378          if (ctx->Visual->RGBAflag) {
379             /* texturing only works in RGB mode */
380             if (state) {
381                ctx->Texture.Enabled |= TEXTURE_2D;
382             }
383             else {
384                ctx->Texture.Enabled &= (~TEXTURE_2D);
385             }
386             ctx->NewState |= (NEW_RASTER_OPS | NEW_TEXTURING);
387          }
388 	 break;
389       case GL_TEXTURE_GEN_Q:
390          if (state) {
391             ctx->Texture.TexGenEnabled |= Q_BIT;
392          }
393          else {
394             ctx->Texture.TexGenEnabled &= ~Q_BIT;
395          }
396          ctx->NewState |= NEW_TEXTURING;
397 	 break;
398       case GL_TEXTURE_GEN_R:
399          if (state) {
400             ctx->Texture.TexGenEnabled |= R_BIT;
401          }
402          else {
403             ctx->Texture.TexGenEnabled &= ~R_BIT;
404          }
405          ctx->NewState |= NEW_TEXTURING;
406 	 break;
407       case GL_TEXTURE_GEN_S:
408 	 if (state) {
409             ctx->Texture.TexGenEnabled |= S_BIT;
410          }
411          else {
412             ctx->Texture.TexGenEnabled &= ~S_BIT;
413          }
414          ctx->NewState |= NEW_TEXTURING;
415 	 break;
416       case GL_TEXTURE_GEN_T:
417          if (state) {
418             ctx->Texture.TexGenEnabled |= T_BIT;
419          }
420          else {
421             ctx->Texture.TexGenEnabled &= ~T_BIT;
422          }
423          ctx->NewState |= NEW_TEXTURING;
424 	 break;
425 
426       /*
427        * CLIENT STATE!!!
428        */
429       case GL_VERTEX_ARRAY:
430          ctx->Array.VertexEnabled = state;
431          break;
432       case GL_NORMAL_ARRAY:
433          ctx->Array.NormalEnabled = state;
434          break;
435       case GL_COLOR_ARRAY:
436          ctx->Array.ColorEnabled = state;
437          break;
438       case GL_INDEX_ARRAY:
439          ctx->Array.IndexEnabled = state;
440          break;
441       case GL_TEXTURE_COORD_ARRAY:
442          ctx->Array.TexCoordEnabled = state;
443          break;
444       case GL_EDGE_FLAG_ARRAY:
445          ctx->Array.EdgeFlagEnabled = state;
446          break;
447 
448       default:
449 	 if (state) {
450 	    gl_error( ctx, GL_INVALID_ENUM, "glEnable" );
451 	 }
452 	 else {
453 	    gl_error( ctx, GL_INVALID_ENUM, "glDisable" );
454 	 }
455          break;
456    }
457 }
458 
459 
460 
461 
462 void gl_Enable( GLcontext* ctx, GLenum cap )
463 {
464    gl_enable( ctx, cap, GL_TRUE );
465 }
466 
467 
468 
469 void gl_Disable( GLcontext* ctx, GLenum cap )
470 {
471    gl_enable( ctx, cap, GL_FALSE );
472 }
473 
474 
475 
476 GLboolean gl_IsEnabled( GLcontext* ctx, GLenum cap )
477 {
478    switch (cap) {
479       case GL_ALPHA_TEST:
480          return ctx->Color.AlphaEnabled;
481       case GL_AUTO_NORMAL:
482 	 return ctx->Eval.AutoNormal;
483       case GL_BLEND:
484          return ctx->Color.BlendEnabled;
485       case GL_CLIP_PLANE0:
486       case GL_CLIP_PLANE1:
487       case GL_CLIP_PLANE2:
488       case GL_CLIP_PLANE3:
489       case GL_CLIP_PLANE4:
490       case GL_CLIP_PLANE5:
491 	 return ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0];
492       case GL_COLOR_MATERIAL:
493 	 return ctx->Light.ColorMaterialEnabled;
494       case GL_CULL_FACE:
495          return ctx->Polygon.CullFlag;
496       case GL_DEPTH_TEST:
497          return ctx->Depth.Test;
498       case GL_DITHER:
499 	 return ctx->Color.DitherFlag;
500       case GL_FOG:
501 	 return ctx->Fog.Enabled;
502       case GL_LIGHTING:
503          return ctx->Light.Enabled;
504       case GL_LIGHT0:
505       case GL_LIGHT1:
506       case GL_LIGHT2:
507       case GL_LIGHT3:
508       case GL_LIGHT4:
509       case GL_LIGHT5:
510       case GL_LIGHT6:
511       case GL_LIGHT7:
512          return ctx->Light.Light[cap-GL_LIGHT0].Enabled;
513       case GL_LINE_SMOOTH:
514 	 return ctx->Line.SmoothFlag;
515       case GL_LINE_STIPPLE:
516 	 return ctx->Line.StippleFlag;
517       case GL_INDEX_LOGIC_OP:
518 	 return ctx->Color.IndexLogicOpEnabled;
519       case GL_COLOR_LOGIC_OP:
520 	 return ctx->Color.ColorLogicOpEnabled;
521       case GL_MAP1_COLOR_4:
522 	 return ctx->Eval.Map1Color4;
523       case GL_MAP1_INDEX:
524 	 return ctx->Eval.Map1Index;
525       case GL_MAP1_NORMAL:
526 	 return ctx->Eval.Map1Normal;
527       case GL_MAP1_TEXTURE_COORD_1:
528 	 return ctx->Eval.Map1TextureCoord1;
529       case GL_MAP1_TEXTURE_COORD_2:
530 	 return ctx->Eval.Map1TextureCoord2;
531       case GL_MAP1_TEXTURE_COORD_3:
532 	 return ctx->Eval.Map1TextureCoord3;
533       case GL_MAP1_TEXTURE_COORD_4:
534 	 return ctx->Eval.Map1TextureCoord4;
535       case GL_MAP1_VERTEX_3:
536 	 return ctx->Eval.Map1Vertex3;
537       case GL_MAP1_VERTEX_4:
538 	 return ctx->Eval.Map1Vertex4;
539       case GL_MAP2_COLOR_4:
540 	 return ctx->Eval.Map2Color4;
541       case GL_MAP2_INDEX:
542 	 return ctx->Eval.Map2Index;
543       case GL_MAP2_NORMAL:
544 	 return ctx->Eval.Map2Normal;
545       case GL_MAP2_TEXTURE_COORD_1:
546 	 return ctx->Eval.Map2TextureCoord1;
547       case GL_MAP2_TEXTURE_COORD_2:
548 	 return ctx->Eval.Map2TextureCoord2;
549       case GL_MAP2_TEXTURE_COORD_3:
550 	 return ctx->Eval.Map2TextureCoord3;
551       case GL_MAP2_TEXTURE_COORD_4:
552 	 return ctx->Eval.Map2TextureCoord4;
553       case GL_MAP2_VERTEX_3:
554 	 return ctx->Eval.Map2Vertex3;
555       case GL_MAP2_VERTEX_4:
556 	 return ctx->Eval.Map2Vertex4;
557       case GL_NORMALIZE:
558 	 return ctx->Transform.Normalize;
559       case GL_POINT_SMOOTH:
560 	 return ctx->Point.SmoothFlag;
561       case GL_POLYGON_SMOOTH:
562 	 return ctx->Polygon.SmoothFlag;
563       case GL_POLYGON_STIPPLE:
564 	 return ctx->Polygon.StippleFlag;
565       case GL_POLYGON_OFFSET_POINT:
566 	 return ctx->Polygon.OffsetPoint;
567       case GL_POLYGON_OFFSET_LINE:
568 	 return ctx->Polygon.OffsetLine;
569       case GL_POLYGON_OFFSET_FILL:
570       /*case GL_POLYGON_OFFSET_EXT:*/
571 	 return ctx->Polygon.OffsetFill;
572       case GL_SCISSOR_TEST:
573 	 return ctx->Scissor.Enabled;
574       case GL_STENCIL_TEST:
575 	 return ctx->Stencil.Enabled;
576       case GL_TEXTURE_1D:
577 	 return (ctx->Texture.Enabled & TEXTURE_1D) ? GL_TRUE : GL_FALSE;
578       case GL_TEXTURE_2D:
579 	 return (ctx->Texture.Enabled & TEXTURE_2D) ? GL_TRUE : GL_FALSE;
580       case GL_TEXTURE_GEN_Q:
581 	 return (ctx->Texture.TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE;
582       case GL_TEXTURE_GEN_R:
583 	 return (ctx->Texture.TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE;
584       case GL_TEXTURE_GEN_S:
585 	 return (ctx->Texture.TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE;
586       case GL_TEXTURE_GEN_T:
587 	 return (ctx->Texture.TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE;
588 
589       /*
590        * CLIENT STATE!!!
591        */
592       case GL_VERTEX_ARRAY:
593          return ctx->Array.VertexEnabled;
594       case GL_NORMAL_ARRAY:
595          return ctx->Array.NormalEnabled;
596       case GL_COLOR_ARRAY:
597          return ctx->Array.ColorEnabled;
598       case GL_INDEX_ARRAY:
599          return ctx->Array.IndexEnabled;
600       case GL_TEXTURE_COORD_ARRAY:
601          return ctx->Array.TexCoordEnabled;
602       case GL_EDGE_FLAG_ARRAY:
603          return ctx->Array.EdgeFlagEnabled;
604       default:
605 	 gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
606 	 return GL_FALSE;
607    }
608 }
609 
610 
611 
612 
613 void gl_client_state( GLcontext *ctx, GLenum cap, GLboolean state )
614 {
615    switch (cap) {
616       case GL_VERTEX_ARRAY:
617          ctx->Array.VertexEnabled = state;
618          break;
619       case GL_NORMAL_ARRAY:
620          ctx->Array.NormalEnabled = state;
621          break;
622       case GL_COLOR_ARRAY:
623          ctx->Array.ColorEnabled = state;
624          break;
625       case GL_INDEX_ARRAY:
626          ctx->Array.IndexEnabled = state;
627          break;
628       case GL_TEXTURE_COORD_ARRAY:
629          ctx->Array.TexCoordEnabled = state;
630          break;
631       case GL_EDGE_FLAG_ARRAY:
632          ctx->Array.EdgeFlagEnabled = state;
633          break;
634       default:
635          gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" );
636    }
637 }
638 
639 
640 
641 void gl_EnableClientState( GLcontext *ctx, GLenum cap )
642 {
643    gl_client_state( ctx, cap, GL_TRUE );
644 }
645 
646 
647 
648 void gl_DisableClientState( GLcontext *ctx, GLenum cap )
649 {
650    gl_client_state( ctx, cap, GL_FALSE );
651 }
652 
653