Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 1 | /* $Id: enable.c,v 1.33 2000/11/22 07:32:16 joukj Exp $ */ |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 2 | |
| 3 | /* |
| 4 | * Mesa 3-D graphics library |
Brian Paul | eb326f5 | 2000-10-21 01:29:12 +0000 | [diff] [blame] | 5 | * Version: 3.5 |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 6 | * |
Brian Paul | eb326f5 | 2000-10-21 01:29:12 +0000 | [diff] [blame] | 7 | * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 8 | * |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 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: |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 15 | * |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 16 | * The above copyright notice and this permission notice shall be included |
| 17 | * in all copies or substantial portions of the Software. |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 18 | * |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 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. |
| 25 | */ |
| 26 | |
| 27 | |
| 28 | #ifdef PC_HEADER |
| 29 | #include "all.h" |
| 30 | #else |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 31 | #include "glheader.h" |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 32 | #include "context.h" |
| 33 | #include "enable.h" |
| 34 | #include "light.h" |
| 35 | #include "macros.h" |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 36 | #include "mmath.h" |
| 37 | #include "simple_list.h" |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 38 | #include "mtypes.h" |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 39 | #include "enums.h" |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 40 | |
| 41 | #include "math/m_matrix.h" |
| 42 | #include "math/m_xform.h" |
| 43 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 44 | #endif |
| 45 | |
| 46 | |
| 47 | |
| 48 | /* |
| 49 | * Perform glEnable and glDisable calls. |
| 50 | */ |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 51 | void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 52 | { |
| 53 | ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" ); |
| 54 | |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 55 | if (MESA_VERBOSE & VERBOSE_API) |
| 56 | fprintf(stderr, "%s %s (newstate is %x)\n", |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 57 | state ? "glEnable" : "glDisable", |
| 58 | gl_lookup_enum_by_nr(cap), |
| 59 | ctx->NewState); |
| 60 | |
| 61 | switch (cap) { |
| 62 | case GL_ALPHA_TEST: |
| 63 | if (ctx->Color.AlphaEnabled!=state) { |
| 64 | ctx->Color.AlphaEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 65 | ctx->NewState |= _NEW_COLOR; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 66 | } |
| 67 | break; |
| 68 | case GL_AUTO_NORMAL: |
| 69 | ctx->Eval.AutoNormal = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 70 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 71 | break; |
| 72 | case GL_BLEND: |
| 73 | if (ctx->Color.BlendEnabled!=state) { |
| 74 | ctx->Color.BlendEnabled = state; |
| 75 | /* The following needed to accomodate 1.0 RGB logic op blending */ |
| 76 | if (ctx->Color.BlendEquation==GL_LOGIC_OP && state) { |
| 77 | ctx->Color.ColorLogicOpEnabled = GL_TRUE; |
| 78 | } |
| 79 | else { |
| 80 | ctx->Color.ColorLogicOpEnabled = GL_FALSE; |
| 81 | } |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 82 | ctx->NewState |= _NEW_COLOR; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 83 | } |
| 84 | break; |
| 85 | case GL_CLIP_PLANE0: |
| 86 | case GL_CLIP_PLANE1: |
| 87 | case GL_CLIP_PLANE2: |
| 88 | case GL_CLIP_PLANE3: |
| 89 | case GL_CLIP_PLANE4: |
| 90 | case GL_CLIP_PLANE5: |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 91 | if (ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0] != state) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 92 | { |
| 93 | GLuint p = cap-GL_CLIP_PLANE0; |
| 94 | |
| 95 | ctx->Transform.ClipEnabled[p] = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 96 | ctx->NewState |= _NEW_TRANSFORM; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 97 | |
| 98 | if (state) { |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 99 | ctx->_Enabled |= ENABLE_USERCLIP; |
| 100 | ctx->Transform._AnyClip++; |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 101 | |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 102 | if (ctx->ProjectionMatrix.flags & MAT_DIRTY) { |
| 103 | _math_matrix_analyze( &ctx->ProjectionMatrix ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 104 | } |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 105 | |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 106 | /* This derived state also calculated in clip.c and |
| 107 | * from gl_update_state() on changes to EyeUserPlane |
| 108 | * and ctx->ProjectionMatrix respectively. |
| 109 | */ |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 110 | gl_transform_vector( ctx->Transform._ClipUserPlane[p], |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 111 | ctx->Transform.EyeUserPlane[p], |
| 112 | ctx->ProjectionMatrix.inv ); |
| 113 | } else { |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 114 | if (--ctx->Transform._AnyClip == 0) |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 115 | ctx->_Enabled &= ~ENABLE_USERCLIP; |
| 116 | } |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 117 | } |
| 118 | break; |
| 119 | case GL_COLOR_MATERIAL: |
| 120 | if (ctx->Light.ColorMaterialEnabled!=state) { |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 121 | ctx->Light.ColorMaterialEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 122 | ctx->NewState |= _NEW_LIGHT; |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 123 | |
| 124 | if (state) { |
| 125 | FLUSH_TNL( ctx, FLUSH_UPDATE_CURRENT ); |
Brian Paul | 1930053 | 2000-10-29 19:02:23 +0000 | [diff] [blame] | 126 | gl_update_color_material( ctx, ctx->Current.Color ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 127 | } |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 128 | } |
| 129 | break; |
| 130 | case GL_CULL_FACE: |
| 131 | if (ctx->Polygon.CullFlag!=state) { |
| 132 | ctx->Polygon.CullFlag = state; |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 133 | /* ctx->_TriangleCaps ^= DD_TRI_CULL; */ |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 134 | ctx->NewState |= _NEW_POLYGON; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 135 | } |
| 136 | break; |
| 137 | case GL_DEPTH_TEST: |
Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 138 | if (state && ctx->Visual.DepthBits==0) { |
| 139 | _mesa_warning(ctx,"glEnable(GL_DEPTH_TEST) but no depth buffer"); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 140 | return; |
| 141 | } |
| 142 | if (ctx->Depth.Test!=state) { |
| 143 | ctx->Depth.Test = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 144 | ctx->NewState |= _NEW_DEPTH; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 145 | } |
| 146 | break; |
| 147 | case GL_DITHER: |
| 148 | if (ctx->NoDither) { |
| 149 | /* MESA_NO_DITHER env var */ |
| 150 | state = GL_FALSE; |
| 151 | } |
| 152 | if (ctx->Color.DitherFlag!=state) { |
| 153 | ctx->Color.DitherFlag = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 154 | ctx->NewState |= _NEW_COLOR; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 155 | } |
| 156 | break; |
| 157 | case GL_FOG: |
| 158 | if (ctx->Fog.Enabled!=state) { |
| 159 | ctx->Fog.Enabled = state; |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 160 | ctx->_Enabled ^= ENABLE_FOG; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 161 | ctx->NewState |= _NEW_FOG; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 162 | } |
| 163 | break; |
Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 164 | case GL_HISTOGRAM: |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 165 | if (ctx->Extensions.EXT_histogram) { |
Brian Paul | 8e05391 | 2000-08-30 18:21:06 +0000 | [diff] [blame] | 166 | ctx->Pixel.HistogramEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 167 | ctx->NewState |= _NEW_PIXEL; |
Brian Paul | 8e05391 | 2000-08-30 18:21:06 +0000 | [diff] [blame] | 168 | } |
| 169 | else { |
| 170 | gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); |
| 171 | return; |
| 172 | } |
Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 173 | break; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 174 | case GL_LIGHT0: |
| 175 | case GL_LIGHT1: |
| 176 | case GL_LIGHT2: |
| 177 | case GL_LIGHT3: |
| 178 | case GL_LIGHT4: |
| 179 | case GL_LIGHT5: |
| 180 | case GL_LIGHT6: |
| 181 | case GL_LIGHT7: |
Brian Paul | 8e05391 | 2000-08-30 18:21:06 +0000 | [diff] [blame] | 182 | if (ctx->Light.Light[cap-GL_LIGHT0].Enabled != state) { |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 183 | ctx->Light.Light[cap-GL_LIGHT0].Enabled = state; |
| 184 | |
| 185 | if (state) { |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 186 | insert_at_tail(&ctx->Light.EnabledList, |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 187 | &ctx->Light.Light[cap-GL_LIGHT0]); |
| 188 | if (ctx->Light.Enabled) |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 189 | ctx->_Enabled |= ENABLE_LIGHT; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 190 | } else { |
| 191 | remove_from_list(&ctx->Light.Light[cap-GL_LIGHT0]); |
| 192 | if (is_empty_list(&ctx->Light.EnabledList)) |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 193 | ctx->_Enabled &= ~ENABLE_LIGHT; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 194 | } |
| 195 | |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 196 | ctx->NewState |= _NEW_LIGHT; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 197 | } |
| 198 | break; |
| 199 | case GL_LIGHTING: |
| 200 | if (ctx->Light.Enabled!=state) { |
| 201 | ctx->Light.Enabled = state; |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 202 | ctx->_Enabled &= ~ENABLE_LIGHT; |
Brian Paul | 2c318aa | 1999-10-20 22:16:45 +0000 | [diff] [blame] | 203 | if (state) |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 204 | ctx->_Enabled |= ENABLE_LIGHT; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 205 | ctx->NewState |= _NEW_LIGHT; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 206 | } |
| 207 | break; |
| 208 | case GL_LINE_SMOOTH: |
| 209 | if (ctx->Line.SmoothFlag!=state) { |
| 210 | ctx->Line.SmoothFlag = state; |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 211 | ctx->_TriangleCaps ^= DD_LINE_SMOOTH; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 212 | ctx->NewState |= _NEW_LINE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 213 | } |
| 214 | break; |
| 215 | case GL_LINE_STIPPLE: |
| 216 | if (ctx->Line.StippleFlag!=state) { |
| 217 | ctx->Line.StippleFlag = state; |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 218 | ctx->_TriangleCaps ^= DD_LINE_STIPPLE; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 219 | ctx->NewState |= _NEW_LINE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 220 | } |
| 221 | break; |
| 222 | case GL_INDEX_LOGIC_OP: |
| 223 | if (ctx->Color.IndexLogicOpEnabled!=state) { |
| 224 | ctx->Color.IndexLogicOpEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 225 | ctx->NewState |= _NEW_COLOR; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 226 | } |
| 227 | break; |
| 228 | case GL_COLOR_LOGIC_OP: |
| 229 | if (ctx->Color.ColorLogicOpEnabled!=state) { |
| 230 | ctx->Color.ColorLogicOpEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 231 | ctx->NewState |= _NEW_COLOR; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 232 | } |
| 233 | break; |
| 234 | case GL_MAP1_COLOR_4: |
| 235 | ctx->Eval.Map1Color4 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 236 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 237 | break; |
| 238 | case GL_MAP1_INDEX: |
| 239 | ctx->Eval.Map1Index = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 240 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 241 | break; |
| 242 | case GL_MAP1_NORMAL: |
| 243 | ctx->Eval.Map1Normal = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 244 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 245 | break; |
| 246 | case GL_MAP1_TEXTURE_COORD_1: |
| 247 | ctx->Eval.Map1TextureCoord1 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 248 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 249 | break; |
| 250 | case GL_MAP1_TEXTURE_COORD_2: |
| 251 | ctx->Eval.Map1TextureCoord2 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 252 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 253 | break; |
| 254 | case GL_MAP1_TEXTURE_COORD_3: |
| 255 | ctx->Eval.Map1TextureCoord3 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 256 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 257 | break; |
| 258 | case GL_MAP1_TEXTURE_COORD_4: |
| 259 | ctx->Eval.Map1TextureCoord4 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 260 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 261 | break; |
| 262 | case GL_MAP1_VERTEX_3: |
| 263 | ctx->Eval.Map1Vertex3 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 264 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 265 | break; |
| 266 | case GL_MAP1_VERTEX_4: |
| 267 | ctx->Eval.Map1Vertex4 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 268 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 269 | break; |
| 270 | case GL_MAP2_COLOR_4: |
| 271 | ctx->Eval.Map2Color4 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 272 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 273 | break; |
| 274 | case GL_MAP2_INDEX: |
| 275 | ctx->Eval.Map2Index = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 276 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 277 | break; |
| 278 | case GL_MAP2_NORMAL: |
| 279 | ctx->Eval.Map2Normal = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 280 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 281 | break; |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 282 | case GL_MAP2_TEXTURE_COORD_1: |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 283 | ctx->Eval.Map2TextureCoord1 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 284 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 285 | break; |
| 286 | case GL_MAP2_TEXTURE_COORD_2: |
| 287 | ctx->Eval.Map2TextureCoord2 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 288 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 289 | break; |
| 290 | case GL_MAP2_TEXTURE_COORD_3: |
| 291 | ctx->Eval.Map2TextureCoord3 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 292 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 293 | break; |
| 294 | case GL_MAP2_TEXTURE_COORD_4: |
| 295 | ctx->Eval.Map2TextureCoord4 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 296 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 297 | break; |
| 298 | case GL_MAP2_VERTEX_3: |
| 299 | ctx->Eval.Map2Vertex3 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 300 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 301 | break; |
| 302 | case GL_MAP2_VERTEX_4: |
| 303 | ctx->Eval.Map2Vertex4 = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 304 | ctx->NewState |= _NEW_EVAL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 305 | break; |
Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 306 | case GL_MINMAX: |
| 307 | ctx->Pixel.MinMaxEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 308 | ctx->NewState |= _NEW_PIXEL; |
Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 309 | break; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 310 | case GL_NORMALIZE: |
| 311 | if (ctx->Transform.Normalize != state) { |
| 312 | ctx->Transform.Normalize = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 313 | ctx->NewState |= _NEW_TRANSFORM; |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 314 | ctx->_Enabled ^= ENABLE_NORMALIZE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 315 | } |
| 316 | break; |
| 317 | case GL_POINT_SMOOTH: |
| 318 | if (ctx->Point.SmoothFlag!=state) { |
| 319 | ctx->Point.SmoothFlag = state; |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 320 | ctx->_TriangleCaps ^= DD_POINT_SMOOTH; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 321 | ctx->NewState |= _NEW_POINT; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 322 | } |
| 323 | break; |
| 324 | case GL_POLYGON_SMOOTH: |
| 325 | if (ctx->Polygon.SmoothFlag!=state) { |
| 326 | ctx->Polygon.SmoothFlag = state; |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 327 | ctx->_TriangleCaps ^= DD_TRI_SMOOTH; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 328 | ctx->NewState |= _NEW_POLYGON; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 329 | } |
| 330 | break; |
| 331 | case GL_POLYGON_STIPPLE: |
| 332 | if (ctx->Polygon.StippleFlag!=state) { |
| 333 | ctx->Polygon.StippleFlag = state; |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 334 | ctx->_TriangleCaps ^= DD_TRI_STIPPLE; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 335 | ctx->NewState |= _NEW_POLYGON; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 336 | } |
| 337 | break; |
| 338 | case GL_POLYGON_OFFSET_POINT: |
| 339 | if (ctx->Polygon.OffsetPoint!=state) { |
| 340 | ctx->Polygon.OffsetPoint = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 341 | ctx->NewState |= _NEW_POLYGON; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 342 | } |
| 343 | break; |
| 344 | case GL_POLYGON_OFFSET_LINE: |
| 345 | if (ctx->Polygon.OffsetLine!=state) { |
| 346 | ctx->Polygon.OffsetLine = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 347 | ctx->NewState |= _NEW_POLYGON; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 348 | } |
| 349 | break; |
| 350 | case GL_POLYGON_OFFSET_FILL: |
| 351 | /*case GL_POLYGON_OFFSET_EXT:*/ |
| 352 | if (ctx->Polygon.OffsetFill!=state) { |
| 353 | ctx->Polygon.OffsetFill = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 354 | ctx->NewState |= _NEW_POLYGON; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 355 | } |
| 356 | break; |
| 357 | case GL_RESCALE_NORMAL_EXT: |
| 358 | if (ctx->Transform.RescaleNormals != state) { |
| 359 | ctx->Transform.RescaleNormals = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 360 | ctx->NewState |= _NEW_TRANSFORM; |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 361 | ctx->_Enabled ^= ENABLE_RESCALE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 362 | } |
| 363 | break; |
| 364 | case GL_SCISSOR_TEST: |
| 365 | if (ctx->Scissor.Enabled!=state) { |
| 366 | ctx->Scissor.Enabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 367 | ctx->NewState |= _NEW_SCISSOR; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 368 | } |
| 369 | break; |
| 370 | case GL_SHARED_TEXTURE_PALETTE_EXT: |
| 371 | ctx->Texture.SharedPalette = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 372 | ctx->NewState |= _NEW_TEXTURE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 373 | break; |
| 374 | case GL_STENCIL_TEST: |
Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 375 | if (state && ctx->Visual.StencilBits==0) { |
| 376 | _mesa_warning(ctx, "glEnable(GL_STENCIL_TEST) but no stencil buffer"); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 377 | return; |
| 378 | } |
| 379 | if (ctx->Stencil.Enabled!=state) { |
| 380 | ctx->Stencil.Enabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 381 | ctx->NewState |= _NEW_STENCIL; |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 382 | ctx->_TriangleCaps ^= DD_STENCIL; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 383 | } |
| 384 | break; |
| 385 | case GL_TEXTURE_1D: |
Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 386 | if (ctx->Visual.RGBAflag) { |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 387 | const GLuint curr = ctx->Texture.CurrentUnit; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 388 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 389 | ctx->NewState |= _NEW_TEXTURE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 390 | if (state) { |
| 391 | texUnit->Enabled |= TEXTURE0_1D; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 392 | } |
| 393 | else { |
| 394 | texUnit->Enabled &= ~TEXTURE0_1D; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 395 | } |
| 396 | } |
| 397 | break; |
| 398 | case GL_TEXTURE_2D: |
Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 399 | if (ctx->Visual.RGBAflag) { |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 400 | const GLuint curr = ctx->Texture.CurrentUnit; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 401 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 402 | ctx->NewState |= _NEW_TEXTURE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 403 | if (state) { |
| 404 | texUnit->Enabled |= TEXTURE0_2D; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 405 | } |
| 406 | else { |
| 407 | texUnit->Enabled &= ~TEXTURE0_2D; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 408 | } |
| 409 | } |
| 410 | break; |
| 411 | case GL_TEXTURE_3D: |
Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 412 | if (ctx->Visual.RGBAflag) { |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 413 | const GLuint curr = ctx->Texture.CurrentUnit; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 414 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 415 | ctx->NewState |= _NEW_TEXTURE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 416 | if (state) { |
| 417 | texUnit->Enabled |= TEXTURE0_3D; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 418 | } |
| 419 | else { |
| 420 | texUnit->Enabled &= ~TEXTURE0_3D; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 421 | } |
| 422 | } |
| 423 | break; |
| 424 | case GL_TEXTURE_GEN_Q: |
| 425 | { |
| 426 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 427 | if (state) |
| 428 | texUnit->TexGenEnabled |= Q_BIT; |
| 429 | else |
| 430 | texUnit->TexGenEnabled &= ~Q_BIT; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 431 | ctx->NewState |= _NEW_TEXTURE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 432 | } |
| 433 | break; |
| 434 | case GL_TEXTURE_GEN_R: |
| 435 | { |
| 436 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 437 | if (state) |
| 438 | texUnit->TexGenEnabled |= R_BIT; |
| 439 | else |
| 440 | texUnit->TexGenEnabled &= ~R_BIT; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 441 | ctx->NewState |= _NEW_TEXTURE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 442 | } |
| 443 | break; |
| 444 | case GL_TEXTURE_GEN_S: |
| 445 | { |
| 446 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 447 | if (state) |
| 448 | texUnit->TexGenEnabled |= S_BIT; |
| 449 | else |
| 450 | texUnit->TexGenEnabled &= ~S_BIT; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 451 | ctx->NewState |= _NEW_TEXTURE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 452 | } |
| 453 | break; |
| 454 | case GL_TEXTURE_GEN_T: |
| 455 | { |
| 456 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 457 | if (state) |
| 458 | texUnit->TexGenEnabled |= T_BIT; |
| 459 | else |
| 460 | texUnit->TexGenEnabled &= ~T_BIT; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 461 | ctx->NewState |= _NEW_TEXTURE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 462 | } |
| 463 | break; |
| 464 | |
| 465 | /* |
| 466 | * CLIENT STATE!!! |
| 467 | */ |
| 468 | case GL_VERTEX_ARRAY: |
| 469 | ctx->Array.Vertex.Enabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 470 | ctx->NewState |= _NEW_ARRAY; |
| 471 | break; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 472 | case GL_NORMAL_ARRAY: |
| 473 | ctx->Array.Normal.Enabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 474 | ctx->NewState |= _NEW_ARRAY; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 475 | break; |
| 476 | case GL_COLOR_ARRAY: |
| 477 | ctx->Array.Color.Enabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 478 | ctx->NewState |= _NEW_ARRAY; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 479 | break; |
| 480 | case GL_INDEX_ARRAY: |
| 481 | ctx->Array.Index.Enabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 482 | ctx->NewState |= _NEW_ARRAY; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 483 | break; |
| 484 | case GL_TEXTURE_COORD_ARRAY: |
Brian Paul | 45224fa | 1999-09-07 22:31:30 +0000 | [diff] [blame] | 485 | ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 486 | ctx->NewState |= _NEW_ARRAY; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 487 | break; |
| 488 | case GL_EDGE_FLAG_ARRAY: |
| 489 | ctx->Array.EdgeFlag.Enabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 490 | ctx->NewState |= _NEW_ARRAY; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 491 | break; |
| 492 | |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 493 | /* GL_HP_occlusion_test */ |
| 494 | case GL_OCCLUSION_TEST_HP: |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 495 | if (ctx->Extensions.HP_occlusion_test) { |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 496 | ctx->Depth.OcclusionTest = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 497 | ctx->NewState |= _NEW_DEPTH; |
Brian Paul | 7e67fb4 | 2000-04-04 15:14:10 +0000 | [diff] [blame] | 498 | if (state) |
| 499 | ctx->OcclusionResult = ctx->OcclusionResultSaved; |
| 500 | else |
| 501 | ctx->OcclusionResultSaved = ctx->OcclusionResult; |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 502 | } |
| 503 | else { |
| 504 | gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" ); |
| 505 | return; |
| 506 | } |
| 507 | break; |
| 508 | |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 509 | /* GL_SGIS_pixel_texture */ |
| 510 | case GL_PIXEL_TEXTURE_SGIS: |
Brian Paul | fa4525e | 2000-08-21 14:22:24 +0000 | [diff] [blame] | 511 | /* XXX check for extension */ |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 512 | ctx->Pixel.PixelTextureEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 513 | ctx->NewState |= _NEW_PIXEL; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 514 | break; |
| 515 | |
| 516 | /* GL_SGIX_pixel_texture */ |
| 517 | case GL_PIXEL_TEX_GEN_SGIX: |
Brian Paul | fa4525e | 2000-08-21 14:22:24 +0000 | [diff] [blame] | 518 | /* XXX check for extension */ |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 519 | ctx->Pixel.PixelTextureEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 520 | ctx->NewState |= _NEW_PIXEL; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 521 | break; |
| 522 | |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 523 | /* GL_SGI_color_table */ |
| 524 | case GL_COLOR_TABLE_SGI: |
Brian Paul | fa4525e | 2000-08-21 14:22:24 +0000 | [diff] [blame] | 525 | /* XXX check for extension */ |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 526 | ctx->Pixel.ColorTableEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 527 | ctx->NewState |= _NEW_PIXEL; |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 528 | break; |
| 529 | case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
| 530 | ctx->Pixel.PostConvolutionColorTableEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 531 | ctx->NewState |= _NEW_PIXEL; |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 532 | break; |
| 533 | case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
| 534 | ctx->Pixel.PostColorMatrixColorTableEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 535 | ctx->NewState |= _NEW_PIXEL; |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 536 | break; |
| 537 | |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 538 | /* GL_EXT_convolution */ |
| 539 | case GL_CONVOLUTION_1D: |
Brian Paul | fa4525e | 2000-08-21 14:22:24 +0000 | [diff] [blame] | 540 | /* XXX check for extension */ |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 541 | ctx->Pixel.Convolution1DEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 542 | ctx->NewState |= _NEW_PIXEL; |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 543 | break; |
| 544 | case GL_CONVOLUTION_2D: |
| 545 | ctx->Pixel.Convolution2DEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 546 | ctx->NewState |= _NEW_PIXEL; |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 547 | break; |
| 548 | case GL_SEPARABLE_2D: |
| 549 | ctx->Pixel.Separable2DEnabled = state; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 550 | ctx->NewState |= _NEW_PIXEL; |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 551 | break; |
| 552 | |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 553 | /* GL_ARB_texture_cube_map */ |
| 554 | case GL_TEXTURE_CUBE_MAP_ARB: |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 555 | if (ctx->Extensions.ARB_texture_cube_map) { |
Brian Paul | b1394fa | 2000-09-26 20:53:53 +0000 | [diff] [blame] | 556 | if (ctx->Visual.RGBAflag) { |
Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 557 | const GLuint curr = ctx->Texture.CurrentUnit; |
Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 558 | struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 559 | ctx->NewState |= _NEW_TEXTURE; |
Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 560 | if (state) { |
| 561 | texUnit->Enabled |= TEXTURE0_CUBE; |
Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 562 | } |
| 563 | else { |
| 564 | texUnit->Enabled &= ~TEXTURE0_CUBE; |
Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 565 | } |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 566 | } |
| 567 | } |
Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 568 | else { |
Brian Paul | eb326f5 | 2000-10-21 01:29:12 +0000 | [diff] [blame] | 569 | gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); |
Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 570 | return; |
| 571 | } |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 572 | break; |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 573 | |
Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 574 | /* GL_EXT_secondary_color */ |
| 575 | case GL_COLOR_SUM_EXT: |
| 576 | ctx->Fog.ColorSumEnabled = state; |
| 577 | if (state) |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 578 | SET_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR); |
Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 579 | else if (ctx->Light.Model.ColorControl == GL_SINGLE_COLOR) |
Keith Whitwell | 14940c4 | 2000-11-05 18:40:57 +0000 | [diff] [blame] | 580 | CLEAR_BITS(ctx->_TriangleCaps, DD_SEPERATE_SPECULAR); |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 581 | ctx->NewState |= _NEW_FOG; |
Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 582 | break; |
| 583 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 584 | default: |
Brian Paul | eb326f5 | 2000-10-21 01:29:12 +0000 | [diff] [blame] | 585 | gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 586 | return; |
| 587 | } |
| 588 | |
| 589 | if (ctx->Driver.Enable) { |
| 590 | (*ctx->Driver.Enable)( ctx, cap, state ); |
| 591 | } |
| 592 | } |
| 593 | |
| 594 | |
| 595 | |
| 596 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 597 | void |
| 598 | _mesa_Enable( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 599 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 600 | GET_CURRENT_CONTEXT(ctx); |
| 601 | _mesa_set_enable( ctx, cap, GL_TRUE ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 602 | } |
| 603 | |
| 604 | |
| 605 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 606 | void |
| 607 | _mesa_Disable( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 608 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 609 | GET_CURRENT_CONTEXT(ctx); |
| 610 | _mesa_set_enable( ctx, cap, GL_FALSE ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 611 | } |
| 612 | |
| 613 | |
| 614 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 615 | GLboolean |
| 616 | _mesa_IsEnabled( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 617 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 618 | GET_CURRENT_CONTEXT(ctx); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 619 | switch (cap) { |
| 620 | case GL_ALPHA_TEST: |
| 621 | return ctx->Color.AlphaEnabled; |
| 622 | case GL_AUTO_NORMAL: |
| 623 | return ctx->Eval.AutoNormal; |
| 624 | case GL_BLEND: |
| 625 | return ctx->Color.BlendEnabled; |
| 626 | case GL_CLIP_PLANE0: |
| 627 | case GL_CLIP_PLANE1: |
| 628 | case GL_CLIP_PLANE2: |
| 629 | case GL_CLIP_PLANE3: |
| 630 | case GL_CLIP_PLANE4: |
| 631 | case GL_CLIP_PLANE5: |
| 632 | return ctx->Transform.ClipEnabled[cap-GL_CLIP_PLANE0]; |
| 633 | case GL_COLOR_MATERIAL: |
| 634 | return ctx->Light.ColorMaterialEnabled; |
| 635 | case GL_CULL_FACE: |
| 636 | return ctx->Polygon.CullFlag; |
| 637 | case GL_DEPTH_TEST: |
| 638 | return ctx->Depth.Test; |
| 639 | case GL_DITHER: |
| 640 | return ctx->Color.DitherFlag; |
| 641 | case GL_FOG: |
| 642 | return ctx->Fog.Enabled; |
Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 643 | case GL_HISTOGRAM: |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 644 | if (ctx->Extensions.EXT_histogram) { |
Brian Paul | 8e05391 | 2000-08-30 18:21:06 +0000 | [diff] [blame] | 645 | return ctx->Pixel.HistogramEnabled; |
| 646 | } |
| 647 | else { |
| 648 | gl_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); |
| 649 | return GL_FALSE; |
| 650 | } |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 651 | case GL_LIGHTING: |
| 652 | return ctx->Light.Enabled; |
| 653 | case GL_LIGHT0: |
| 654 | case GL_LIGHT1: |
| 655 | case GL_LIGHT2: |
| 656 | case GL_LIGHT3: |
| 657 | case GL_LIGHT4: |
| 658 | case GL_LIGHT5: |
| 659 | case GL_LIGHT6: |
| 660 | case GL_LIGHT7: |
| 661 | return ctx->Light.Light[cap-GL_LIGHT0].Enabled; |
| 662 | case GL_LINE_SMOOTH: |
| 663 | return ctx->Line.SmoothFlag; |
| 664 | case GL_LINE_STIPPLE: |
| 665 | return ctx->Line.StippleFlag; |
| 666 | case GL_INDEX_LOGIC_OP: |
| 667 | return ctx->Color.IndexLogicOpEnabled; |
| 668 | case GL_COLOR_LOGIC_OP: |
| 669 | return ctx->Color.ColorLogicOpEnabled; |
| 670 | case GL_MAP1_COLOR_4: |
| 671 | return ctx->Eval.Map1Color4; |
| 672 | case GL_MAP1_INDEX: |
| 673 | return ctx->Eval.Map1Index; |
| 674 | case GL_MAP1_NORMAL: |
| 675 | return ctx->Eval.Map1Normal; |
| 676 | case GL_MAP1_TEXTURE_COORD_1: |
| 677 | return ctx->Eval.Map1TextureCoord1; |
| 678 | case GL_MAP1_TEXTURE_COORD_2: |
| 679 | return ctx->Eval.Map1TextureCoord2; |
| 680 | case GL_MAP1_TEXTURE_COORD_3: |
| 681 | return ctx->Eval.Map1TextureCoord3; |
| 682 | case GL_MAP1_TEXTURE_COORD_4: |
| 683 | return ctx->Eval.Map1TextureCoord4; |
| 684 | case GL_MAP1_VERTEX_3: |
| 685 | return ctx->Eval.Map1Vertex3; |
| 686 | case GL_MAP1_VERTEX_4: |
| 687 | return ctx->Eval.Map1Vertex4; |
| 688 | case GL_MAP2_COLOR_4: |
| 689 | return ctx->Eval.Map2Color4; |
| 690 | case GL_MAP2_INDEX: |
| 691 | return ctx->Eval.Map2Index; |
| 692 | case GL_MAP2_NORMAL: |
| 693 | return ctx->Eval.Map2Normal; |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 694 | case GL_MAP2_TEXTURE_COORD_1: |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 695 | return ctx->Eval.Map2TextureCoord1; |
| 696 | case GL_MAP2_TEXTURE_COORD_2: |
| 697 | return ctx->Eval.Map2TextureCoord2; |
| 698 | case GL_MAP2_TEXTURE_COORD_3: |
| 699 | return ctx->Eval.Map2TextureCoord3; |
| 700 | case GL_MAP2_TEXTURE_COORD_4: |
| 701 | return ctx->Eval.Map2TextureCoord4; |
| 702 | case GL_MAP2_VERTEX_3: |
| 703 | return ctx->Eval.Map2Vertex3; |
| 704 | case GL_MAP2_VERTEX_4: |
| 705 | return ctx->Eval.Map2Vertex4; |
Brian Paul | 1a1cf7e | 2000-05-04 13:48:49 +0000 | [diff] [blame] | 706 | case GL_MINMAX: |
| 707 | return ctx->Pixel.MinMaxEnabled; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 708 | case GL_NORMALIZE: |
| 709 | return ctx->Transform.Normalize; |
| 710 | case GL_POINT_SMOOTH: |
| 711 | return ctx->Point.SmoothFlag; |
| 712 | case GL_POLYGON_SMOOTH: |
| 713 | return ctx->Polygon.SmoothFlag; |
| 714 | case GL_POLYGON_STIPPLE: |
| 715 | return ctx->Polygon.StippleFlag; |
| 716 | case GL_POLYGON_OFFSET_POINT: |
| 717 | return ctx->Polygon.OffsetPoint; |
| 718 | case GL_POLYGON_OFFSET_LINE: |
| 719 | return ctx->Polygon.OffsetLine; |
| 720 | case GL_POLYGON_OFFSET_FILL: |
| 721 | /*case GL_POLYGON_OFFSET_EXT:*/ |
| 722 | return ctx->Polygon.OffsetFill; |
| 723 | case GL_RESCALE_NORMAL_EXT: |
| 724 | return ctx->Transform.RescaleNormals; |
| 725 | case GL_SCISSOR_TEST: |
| 726 | return ctx->Scissor.Enabled; |
| 727 | case GL_SHARED_TEXTURE_PALETTE_EXT: |
| 728 | return ctx->Texture.SharedPalette; |
| 729 | case GL_STENCIL_TEST: |
| 730 | return ctx->Stencil.Enabled; |
| 731 | case GL_TEXTURE_1D: |
| 732 | { |
| 733 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 734 | return (texUnit->Enabled & TEXTURE0_1D) ? GL_TRUE : GL_FALSE; |
| 735 | } |
| 736 | case GL_TEXTURE_2D: |
| 737 | { |
| 738 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 739 | return (texUnit->Enabled & TEXTURE0_2D) ? GL_TRUE : GL_FALSE; |
| 740 | } |
| 741 | case GL_TEXTURE_3D: |
| 742 | { |
| 743 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
Brian Paul | 65b5e1e | 1999-08-19 13:24:27 +0000 | [diff] [blame] | 744 | return (texUnit->Enabled & TEXTURE0_3D) ? GL_TRUE : GL_FALSE; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 745 | } |
| 746 | case GL_TEXTURE_GEN_Q: |
| 747 | { |
| 748 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 749 | return (texUnit->TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE; |
| 750 | } |
| 751 | case GL_TEXTURE_GEN_R: |
| 752 | { |
| 753 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 754 | return (texUnit->TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE; |
| 755 | } |
| 756 | case GL_TEXTURE_GEN_S: |
| 757 | { |
| 758 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 759 | return (texUnit->TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE; |
| 760 | } |
| 761 | case GL_TEXTURE_GEN_T: |
| 762 | { |
| 763 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 764 | return (texUnit->TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE; |
| 765 | } |
| 766 | |
| 767 | /* |
| 768 | * CLIENT STATE!!! |
| 769 | */ |
| 770 | case GL_VERTEX_ARRAY: |
| 771 | return ctx->Array.Vertex.Enabled; |
| 772 | case GL_NORMAL_ARRAY: |
| 773 | return ctx->Array.Normal.Enabled; |
| 774 | case GL_COLOR_ARRAY: |
| 775 | return ctx->Array.Color.Enabled; |
| 776 | case GL_INDEX_ARRAY: |
| 777 | return ctx->Array.Index.Enabled; |
| 778 | case GL_TEXTURE_COORD_ARRAY: |
Brian Paul | 45224fa | 1999-09-07 22:31:30 +0000 | [diff] [blame] | 779 | return ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 780 | case GL_EDGE_FLAG_ARRAY: |
| 781 | return ctx->Array.EdgeFlag.Enabled; |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 782 | |
| 783 | /* GL_HP_occlusion_test */ |
| 784 | case GL_OCCLUSION_TEST_HP: |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 785 | if (ctx->Extensions.HP_occlusion_test) { |
Brian Paul | 1b2ff69 | 2000-03-11 23:23:26 +0000 | [diff] [blame] | 786 | return ctx->Depth.OcclusionTest; |
| 787 | } |
| 788 | else { |
| 789 | gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); |
| 790 | return GL_FALSE; |
| 791 | } |
| 792 | |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 793 | /* GL_SGIS_pixel_texture */ |
| 794 | case GL_PIXEL_TEXTURE_SGIS: |
| 795 | return ctx->Pixel.PixelTextureEnabled; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 796 | |
| 797 | /* GL_SGIX_pixel_texture */ |
| 798 | case GL_PIXEL_TEX_GEN_SGIX: |
| 799 | return ctx->Pixel.PixelTextureEnabled; |
Brian Paul | 1381137 | 2000-04-12 00:27:37 +0000 | [diff] [blame] | 800 | |
| 801 | /* GL_SGI_color_table */ |
| 802 | case GL_COLOR_TABLE_SGI: |
| 803 | return ctx->Pixel.ColorTableEnabled; |
| 804 | case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: |
| 805 | return ctx->Pixel.PostConvolutionColorTableEnabled; |
| 806 | case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: |
| 807 | return ctx->Pixel.PostColorMatrixColorTableEnabled; |
Brian Paul | 2b2e925 | 2000-04-07 16:27:26 +0000 | [diff] [blame] | 808 | |
Brian Paul | 82b02f0 | 2000-05-07 20:37:40 +0000 | [diff] [blame] | 809 | /* GL_EXT_convolution */ |
| 810 | case GL_CONVOLUTION_1D: |
| 811 | return ctx->Pixel.Convolution1DEnabled; |
| 812 | case GL_CONVOLUTION_2D: |
| 813 | return ctx->Pixel.Convolution2DEnabled; |
| 814 | case GL_SEPARABLE_2D: |
| 815 | return ctx->Pixel.Separable2DEnabled; |
| 816 | |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 817 | /* GL_ARB_texture_cube_map */ |
| 818 | case GL_TEXTURE_CUBE_MAP_ARB: |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 819 | if (ctx->Extensions.ARB_texture_cube_map) { |
Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 820 | const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; |
| 821 | return (texUnit->Enabled & TEXTURE0_CUBE) ? GL_TRUE : GL_FALSE; |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 822 | } |
Brian Paul | fc4b443 | 2000-05-23 15:17:12 +0000 | [diff] [blame] | 823 | else { |
| 824 | gl_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); |
| 825 | return GL_FALSE; |
| 826 | } |
Brian Paul | 86fc370 | 2000-05-22 16:33:20 +0000 | [diff] [blame] | 827 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 828 | default: |
| 829 | gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); |
| 830 | return GL_FALSE; |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | |
| 835 | |
| 836 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 837 | static void |
| 838 | client_state( GLcontext *ctx, GLenum cap, GLboolean state ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 839 | { |
Jouk Jansen | 5e3bc0c | 2000-11-22 07:32:16 +0000 | [diff] [blame^] | 840 | ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, |
| 841 | (state |
| 842 | ? "glEnableClientState" |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 843 | : "glDisableClientState") ); |
| 844 | |
| 845 | switch (cap) { |
| 846 | case GL_VERTEX_ARRAY: |
| 847 | ctx->Array.Vertex.Enabled = state; |
| 848 | break; |
| 849 | case GL_NORMAL_ARRAY: |
| 850 | ctx->Array.Normal.Enabled = state; |
| 851 | break; |
| 852 | case GL_COLOR_ARRAY: |
| 853 | ctx->Array.Color.Enabled = state; |
| 854 | break; |
| 855 | case GL_INDEX_ARRAY: |
| 856 | ctx->Array.Index.Enabled = state; |
| 857 | break; |
| 858 | case GL_TEXTURE_COORD_ARRAY: |
Brian Paul | 45224fa | 1999-09-07 22:31:30 +0000 | [diff] [blame] | 859 | ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled = state; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 860 | break; |
| 861 | case GL_EDGE_FLAG_ARRAY: |
| 862 | ctx->Array.EdgeFlag.Enabled = state; |
| 863 | break; |
Keith Whitwell | fe5d67d | 2000-10-27 16:44:40 +0000 | [diff] [blame] | 864 | case GL_FOG_COORDINATE_ARRAY_EXT: |
| 865 | ctx->Array.FogCoord.Enabled = state; |
| 866 | break; |
| 867 | case GL_SECONDARY_COLOR_ARRAY_EXT: |
| 868 | ctx->Array.SecondaryColor.Enabled = state; |
| 869 | break; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 870 | default: |
| 871 | gl_error( ctx, GL_INVALID_ENUM, "glEnable/DisableClientState" ); |
| 872 | } |
| 873 | |
Keith Whitwell | a96308c | 2000-10-30 13:31:59 +0000 | [diff] [blame] | 874 | ctx->NewState |= _NEW_ARRAY; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 875 | } |
| 876 | |
| 877 | |
| 878 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 879 | void |
| 880 | _mesa_EnableClientState( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 881 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 882 | GET_CURRENT_CONTEXT(ctx); |
| 883 | client_state( ctx, cap, GL_TRUE ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 884 | } |
| 885 | |
| 886 | |
| 887 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 888 | void |
| 889 | _mesa_DisableClientState( GLenum cap ) |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 890 | { |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 891 | GET_CURRENT_CONTEXT(ctx); |
| 892 | client_state( ctx, cap, GL_FALSE ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 893 | } |
| 894 | |