xref: /reactos/dll/opengl/mesa/get.c (revision 1734f297)
1 /* $Id: get.c,v 1.19 1998/02/04 05:00:28 brianp Exp $ */
2 
3 /*
4  * Mesa 3-D graphics library
5  * Version:  2.6
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: get.c,v $
26  * Revision 1.19  1998/02/04 05:00:28  brianp
27  * more casts for Amiga StormC
28  *
29  * Revision 1.18  1998/02/03 23:45:02  brianp
30  * added casts to prevent warnings with Amiga StormC compiler
31  *
32  * Revision 1.17  1997/12/06 18:06:50  brianp
33  * moved several static display list vars into GLcontext
34  *
35  * Revision 1.16  1997/10/29 01:29:09  brianp
36  * added GL_EXT_point_parameters extension from Daniel Barrero
37  *
38  * Revision 1.15  1997/10/16 01:59:08  brianp
39  * added GL_EXT_shared_texture_palette extension
40  *
41  * Revision 1.14  1997/07/24 01:25:18  brianp
42  * changed precompiled header symbol from PCH to PC_HEADER
43  *
44  * Revision 1.13  1997/06/20 02:00:27  brianp
45  * replaced Current.IntColor with Current.ByteColor
46  *
47  * Revision 1.12  1997/05/28 03:24:54  brianp
48  * added precompiled header (PCH) support
49  *
50  * Revision 1.11  1997/05/26 21:13:42  brianp
51  * rewrite code for GL_RED/GREEN/BLUE/ALPHA_BITS
52  *
53  * Revision 1.10  1997/04/26 04:33:11  brianp
54  * glGet(accum, stencil, depth bits) always returned non-zero values- wrong
55  *
56  * Revision 1.9  1997/03/11 00:57:38  brianp
57  * removed redundant GL_POLYGON_OFFSET_FACTOR_EXT cases
58  *
59  * Revision 1.8  1997/02/10 21:15:59  brianp
60  * renamed GL_TEXTURE_BINDING_3D_EXT to GL_TEXTURE_3D_BINDING_EXT
61  *
62  * Revision 1.7  1997/02/09 19:53:43  brianp
63  * now use TEXTURE_xD enable constants
64  *
65  * Revision 1.6  1997/02/09 18:49:23  brianp
66  * added GL_EXT_texture3D support
67  *
68  * Revision 1.5  1997/01/30 21:05:20  brianp
69  * moved in gl_GetPointerv() from varray.c
70  * added some missing GLenums to the glGet*() functions
71  *
72  * Revision 1.4  1997/01/28 22:13:42  brianp
73  * now there's separate state for CI and RGBA logic op enabled
74  *
75  * Revision 1.3  1996/10/11 03:43:34  brianp
76  * replaced old texture _EXT symbols
77  * added GL_EXT_polygon_offset stuff
78  *
79  * Revision 1.2  1996/09/15 14:17:30  brianp
80  * now use GLframebuffer and GLvisual
81  *
82  * Revision 1.1  1996/09/13 01:38:16  brianp
83  * Initial revision
84  *
85  */
86 
87 
88 #ifdef PC_HEADER
89 #include "all.h"
90 #else
91 #include <string.h>
92 #include "context.h"
93 #include "get.h"
94 #include "dlist.h"
95 #include "macros.h"
96 #include "types.h"
97 #endif
98 
99 
100 
101 #define FLOAT_TO_BOOL(X)	( (X)==0.0F ? GL_FALSE : GL_TRUE )
102 #define INT_TO_BOOL(I)		( (I)==0 ? GL_FALSE : GL_TRUE )
103 #define ENUM_TO_BOOL(E)		( (E)==0 ? GL_FALSE : GL_TRUE )
104 
105 #ifdef SPECIALCAST
106 /* Needed for an Amiga compiler */
107 #define ENUM_TO_FLOAT(X) ((GLfloat)(GLint)(X))
108 #define ENUM_TO_DOUBLE(X) ((GLdouble)(GLint)(X))
109 #else
110 /* all other compilers */
111 #define ENUM_TO_FLOAT(X) ((GLfloat)(X))
112 #define ENUM_TO_DOUBLE(X) ((GLdouble)(X))
113 #endif
114 
115 
116 
117 void gl_GetBooleanv( GLcontext *ctx, GLenum pname, GLboolean *params )
118 {
119    GLuint i;
120 
121    if (INSIDE_BEGIN_END(ctx)) {
122       gl_error( ctx, GL_INVALID_OPERATION, "glGetBooleanv" );
123       return;
124    }
125 
126    switch (pname) {
127       case GL_ACCUM_RED_BITS:
128       case GL_ACCUM_GREEN_BITS:
129       case GL_ACCUM_BLUE_BITS:
130       case GL_ACCUM_ALPHA_BITS:
131          *params = INT_TO_BOOL(ctx->Visual->AccumBits);
132          break;
133       case GL_ACCUM_CLEAR_VALUE:
134          params[0] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[0]);
135          params[1] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[1]);
136          params[2] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[2]);
137          params[3] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[3]);
138          break;
139       case GL_ALPHA_BIAS:
140          *params = FLOAT_TO_BOOL(ctx->Pixel.AlphaBias);
141          break;
142       case GL_ALPHA_BITS:
143          *params = INT_TO_BOOL(ctx->Visual->AlphaBits);
144          break;
145       case GL_ALPHA_SCALE:
146          *params = FLOAT_TO_BOOL(ctx->Pixel.AlphaScale);
147          break;
148       case GL_ALPHA_TEST:
149          *params = ctx->Color.AlphaEnabled;
150          break;
151       case GL_ALPHA_TEST_FUNC:
152          *params = ENUM_TO_BOOL(ctx->Color.AlphaFunc);
153          break;
154       case GL_ALPHA_TEST_REF:
155          *params = FLOAT_TO_BOOL(ctx->Color.AlphaRef);
156          break;
157       case GL_ATTRIB_STACK_DEPTH:
158          *params = INT_TO_BOOL(ctx->AttribStackDepth);
159          break;
160       case GL_AUTO_NORMAL:
161          *params = ctx->Eval.AutoNormal;
162          break;
163       case GL_AUX_BUFFERS:
164          *params = (NUM_AUX_BUFFERS) ? GL_TRUE : GL_FALSE;
165          break;
166       case GL_BLEND:
167          *params = ctx->Color.BlendEnabled;
168          break;
169       case GL_BLEND_DST:
170          *params = ENUM_TO_BOOL(ctx->Color.BlendDst);
171          break;
172       case GL_BLEND_SRC:
173          *params = ENUM_TO_BOOL(ctx->Color.BlendSrc);
174          break;
175       case GL_BLUE_BIAS:
176          *params = FLOAT_TO_BOOL(ctx->Pixel.BlueBias);
177          break;
178       case GL_BLUE_BITS:
179          *params = INT_TO_BOOL( ctx->Visual->BlueBits );
180          break;
181       case GL_BLUE_SCALE:
182          *params = FLOAT_TO_BOOL(ctx->Pixel.BlueScale);
183          break;
184       case GL_CLIENT_ATTRIB_STACK_DEPTH:
185          *params = INT_TO_BOOL(ctx->ClientAttribStackDepth);
186          break;
187       case GL_CLIP_PLANE0:
188       case GL_CLIP_PLANE1:
189       case GL_CLIP_PLANE2:
190       case GL_CLIP_PLANE3:
191       case GL_CLIP_PLANE4:
192       case GL_CLIP_PLANE5:
193          *params = ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0];
194          break;
195       case GL_COLOR_CLEAR_VALUE:
196          params[0] = FLOAT_TO_BOOL(ctx->Color.ClearColor[0]);
197          params[1] = FLOAT_TO_BOOL(ctx->Color.ClearColor[1]);
198          params[2] = FLOAT_TO_BOOL(ctx->Color.ClearColor[2]);
199          params[3] = FLOAT_TO_BOOL(ctx->Color.ClearColor[3]);
200          break;
201       case GL_COLOR_MATERIAL:
202          *params = ctx->Light.ColorMaterialEnabled;
203          break;
204       case GL_COLOR_MATERIAL_FACE:
205          *params = ENUM_TO_BOOL(ctx->Light.ColorMaterialFace);
206          break;
207       case GL_COLOR_MATERIAL_PARAMETER:
208          *params = ENUM_TO_BOOL(ctx->Light.ColorMaterialMode);
209          break;
210       case GL_COLOR_WRITEMASK:
211          params[0] = (ctx->Color.ColorMask & 8) ? GL_TRUE : GL_FALSE;
212          params[1] = (ctx->Color.ColorMask & 4) ? GL_TRUE : GL_FALSE;
213          params[2] = (ctx->Color.ColorMask & 2) ? GL_TRUE : GL_FALSE;
214          params[3] = (ctx->Color.ColorMask & 1) ? GL_TRUE : GL_FALSE;
215          break;
216       case GL_CULL_FACE:
217          *params = ctx->Polygon.CullFlag;
218          break;
219       case GL_CULL_FACE_MODE:
220          *params = ENUM_TO_BOOL(ctx->Polygon.CullFaceMode);
221          break;
222       case GL_CURRENT_COLOR:
223          params[0] = INT_TO_BOOL(ctx->Current.ByteColor[0]);
224          params[1] = INT_TO_BOOL(ctx->Current.ByteColor[1]);
225          params[2] = INT_TO_BOOL(ctx->Current.ByteColor[2]);
226          params[3] = INT_TO_BOOL(ctx->Current.ByteColor[3]);
227          break;
228       case GL_CURRENT_INDEX:
229          *params = INT_TO_BOOL(ctx->Current.Index);
230          break;
231       case GL_CURRENT_NORMAL:
232          params[0] = FLOAT_TO_BOOL(ctx->Current.Normal[0]);
233          params[1] = FLOAT_TO_BOOL(ctx->Current.Normal[1]);
234          params[2] = FLOAT_TO_BOOL(ctx->Current.Normal[2]);
235          break;
236       case GL_CURRENT_RASTER_COLOR:
237 	 params[0] = FLOAT_TO_BOOL(ctx->Current.RasterColor[0]);
238 	 params[1] = FLOAT_TO_BOOL(ctx->Current.RasterColor[1]);
239 	 params[2] = FLOAT_TO_BOOL(ctx->Current.RasterColor[2]);
240 	 params[3] = FLOAT_TO_BOOL(ctx->Current.RasterColor[3]);
241 	 break;
242       case GL_CURRENT_RASTER_DISTANCE:
243 	 *params = FLOAT_TO_BOOL(ctx->Current.RasterDistance);
244 	 break;
245       case GL_CURRENT_RASTER_INDEX:
246 	 *params = FLOAT_TO_BOOL(ctx->Current.RasterIndex);
247 	 break;
248       case GL_CURRENT_RASTER_POSITION:
249 	 params[0] = FLOAT_TO_BOOL(ctx->Current.RasterPos[0]);
250 	 params[1] = FLOAT_TO_BOOL(ctx->Current.RasterPos[1]);
251 	 params[2] = FLOAT_TO_BOOL(ctx->Current.RasterPos[2]);
252 	 params[3] = FLOAT_TO_BOOL(ctx->Current.RasterPos[3]);
253 	 break;
254       case GL_CURRENT_RASTER_TEXTURE_COORDS:
255          params[0] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoord[0]);
256          params[1] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoord[1]);
257          params[2] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoord[2]);
258          params[3] = FLOAT_TO_BOOL(ctx->Current.RasterTexCoord[3]);
259 	 break;
260       case GL_CURRENT_RASTER_POSITION_VALID:
261          *params = ctx->Current.RasterPosValid;
262 	 break;
263       case GL_CURRENT_TEXTURE_COORDS:
264          params[0] = FLOAT_TO_BOOL(ctx->Current.TexCoord[0]);
265          params[1] = FLOAT_TO_BOOL(ctx->Current.TexCoord[1]);
266          params[2] = FLOAT_TO_BOOL(ctx->Current.TexCoord[2]);
267          params[3] = FLOAT_TO_BOOL(ctx->Current.TexCoord[3]);
268 	 break;
269       case GL_DEPTH_BIAS:
270          *params = FLOAT_TO_BOOL(ctx->Pixel.DepthBias);
271 	 break;
272       case GL_DEPTH_BITS:
273 	 *params = INT_TO_BOOL(ctx->Visual->DepthBits);
274 	 break;
275       case GL_DEPTH_CLEAR_VALUE:
276          *params = FLOAT_TO_BOOL(ctx->Depth.Clear);
277 	 break;
278       case GL_DEPTH_FUNC:
279          *params = ENUM_TO_BOOL(ctx->Depth.Func);
280 	 break;
281       case GL_DEPTH_RANGE:
282          params[0] = FLOAT_TO_BOOL(ctx->Viewport.Near);
283          params[1] = FLOAT_TO_BOOL(ctx->Viewport.Far);
284 	 break;
285       case GL_DEPTH_SCALE:
286          *params = FLOAT_TO_BOOL(ctx->Pixel.DepthScale);
287 	 break;
288       case GL_DEPTH_TEST:
289          *params = ctx->Depth.Test;
290 	 break;
291       case GL_DEPTH_WRITEMASK:
292 	 *params = ctx->Depth.Mask;
293 	 break;
294       case GL_DITHER:
295 	 *params = ctx->Color.DitherFlag;
296 	 break;
297       case GL_DOUBLEBUFFER:
298 	 *params = ctx->Visual->DBflag;
299 	 break;
300       case GL_DRAW_BUFFER:
301 	 *params = ENUM_TO_BOOL(ctx->Color.DrawBuffer);
302 	 break;
303       case GL_EDGE_FLAG:
304 	 *params = ctx->Current.EdgeFlag;
305 	 break;
306       case GL_FEEDBACK_BUFFER_SIZE:
307          /* TODO: is this right?  Or, return number of entries in buffer? */
308          *params = INT_TO_BOOL(ctx->Feedback.BufferSize);
309          break;
310       case GL_FEEDBACK_BUFFER_TYPE:
311          *params = INT_TO_BOOL(ctx->Feedback.Type);
312          break;
313       case GL_FOG:
314 	 *params = ctx->Fog.Enabled;
315 	 break;
316       case GL_FOG_COLOR:
317          params[0] = FLOAT_TO_BOOL(ctx->Fog.Color[0]);
318          params[1] = FLOAT_TO_BOOL(ctx->Fog.Color[1]);
319          params[2] = FLOAT_TO_BOOL(ctx->Fog.Color[2]);
320          params[3] = FLOAT_TO_BOOL(ctx->Fog.Color[3]);
321 	 break;
322       case GL_FOG_DENSITY:
323          *params = FLOAT_TO_BOOL(ctx->Fog.Density);
324 	 break;
325       case GL_FOG_END:
326          *params = FLOAT_TO_BOOL(ctx->Fog.End);
327 	 break;
328       case GL_FOG_HINT:
329 	 *params = ENUM_TO_BOOL(ctx->Hint.Fog);
330 	 break;
331       case GL_FOG_INDEX:
332 	 *params = FLOAT_TO_BOOL(ctx->Fog.Index);
333 	 break;
334       case GL_FOG_MODE:
335 	 *params = ENUM_TO_BOOL(ctx->Fog.Mode);
336 	 break;
337       case GL_FOG_START:
338          *params = FLOAT_TO_BOOL(ctx->Fog.End);
339 	 break;
340       case GL_FRONT_FACE:
341 	 *params = ENUM_TO_BOOL(ctx->Polygon.FrontFace);
342 	 break;
343       case GL_GREEN_BIAS:
344          *params = FLOAT_TO_BOOL(ctx->Pixel.GreenBias);
345 	 break;
346       case GL_GREEN_BITS:
347          *params = INT_TO_BOOL( ctx->Visual->GreenBits );
348 	 break;
349       case GL_GREEN_SCALE:
350          *params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale);
351 	 break;
352       case GL_INDEX_BITS:
353          *params = INT_TO_BOOL( ctx->Visual->IndexBits );
354 	 break;
355       case GL_INDEX_CLEAR_VALUE:
356 	 *params = INT_TO_BOOL(ctx->Color.ClearIndex);
357 	 break;
358       case GL_INDEX_MODE:
359 	 *params = ctx->Visual->RGBAflag ? GL_FALSE : GL_TRUE;
360 	 break;
361       case GL_INDEX_OFFSET:
362 	 *params = INT_TO_BOOL(ctx->Pixel.IndexOffset);
363 	 break;
364       case GL_INDEX_SHIFT:
365 	 *params = INT_TO_BOOL(ctx->Pixel.IndexShift);
366 	 break;
367       case GL_INDEX_WRITEMASK:
368 	 *params = INT_TO_BOOL(ctx->Color.IndexMask);
369 	 break;
370       case GL_LIGHT0:
371       case GL_LIGHT1:
372       case GL_LIGHT2:
373       case GL_LIGHT3:
374       case GL_LIGHT4:
375       case GL_LIGHT5:
376       case GL_LIGHT6:
377       case GL_LIGHT7:
378 	 *params = ctx->Light.Light[pname-GL_LIGHT0].Enabled;
379 	 break;
380       case GL_LIGHTING:
381 	 *params = ctx->Light.Enabled;
382 	 break;
383       case GL_LIGHT_MODEL_AMBIENT:
384 	 params[0] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[0]);
385 	 params[1] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[1]);
386 	 params[2] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[2]);
387 	 params[3] = FLOAT_TO_BOOL(ctx->Light.Model.Ambient[3]);
388 	 break;
389       case GL_LIGHT_MODEL_LOCAL_VIEWER:
390 	 *params = ctx->Light.Model.LocalViewer;
391 	 break;
392       case GL_LIGHT_MODEL_TWO_SIDE:
393 	 *params = ctx->Light.Model.TwoSide;
394 	 break;
395       case GL_LINE_SMOOTH:
396 	 *params = ctx->Line.SmoothFlag;
397 	 break;
398       case GL_LINE_SMOOTH_HINT:
399 	 *params = ENUM_TO_BOOL(ctx->Hint.LineSmooth);
400 	 break;
401       case GL_LINE_STIPPLE:
402 	 *params = ctx->Line.StippleFlag;
403 	 break;
404       case GL_LINE_STIPPLE_PATTERN:
405 	 *params = INT_TO_BOOL(ctx->Line.StipplePattern);
406 	 break;
407       case GL_LINE_STIPPLE_REPEAT:
408 	 *params = INT_TO_BOOL(ctx->Line.StippleFactor);
409 	 break;
410       case GL_LINE_WIDTH:
411 	 *params = FLOAT_TO_BOOL(ctx->Line.Width);
412 	 break;
413       case GL_LINE_WIDTH_GRANULARITY:
414 	 *params = FLOAT_TO_BOOL(LINE_WIDTH_GRANULARITY);
415 	 break;
416       case GL_LINE_WIDTH_RANGE:
417 	 params[0] = FLOAT_TO_BOOL(MIN_LINE_WIDTH);
418 	 params[1] = FLOAT_TO_BOOL(MAX_LINE_WIDTH);
419 	 break;
420       case GL_LIST_BASE:
421 	 *params = INT_TO_BOOL(ctx->List.ListBase);
422 	 break;
423       case GL_LIST_INDEX:
424 	 *params = INT_TO_BOOL( ctx->CurrentListNum );
425 	 break;
426       case GL_LIST_MODE:
427 	 *params = ENUM_TO_BOOL( ctx->ExecuteFlag
428 				  ? GL_COMPILE_AND_EXECUTE : GL_COMPILE );
429 	 break;
430       case GL_INDEX_LOGIC_OP:
431 	 *params = ctx->Color.IndexLogicOpEnabled;
432 	 break;
433       case GL_COLOR_LOGIC_OP:
434 	 *params = ctx->Color.ColorLogicOpEnabled;
435 	 break;
436       case GL_LOGIC_OP_MODE:
437 	 *params = ENUM_TO_BOOL(ctx->Color.LogicOp);
438 	 break;
439       case GL_MAP1_COLOR_4:
440 	 *params = ctx->Eval.Map1Color4;
441 	 break;
442       case GL_MAP1_GRID_DOMAIN:
443 	 params[0] = FLOAT_TO_BOOL(ctx->Eval.MapGrid1u1);
444 	 params[1] = FLOAT_TO_BOOL(ctx->Eval.MapGrid1u2);
445 	 break;
446       case GL_MAP1_GRID_SEGMENTS:
447 	 *params = INT_TO_BOOL(ctx->Eval.MapGrid1un);
448 	 break;
449       case GL_MAP1_INDEX:
450 	 *params = ctx->Eval.Map1Index;
451 	 break;
452       case GL_MAP1_NORMAL:
453 	 *params = ctx->Eval.Map1Normal;
454 	 break;
455       case GL_MAP1_TEXTURE_COORD_1:
456 	 *params = ctx->Eval.Map1TextureCoord1;
457 	 break;
458       case GL_MAP1_TEXTURE_COORD_2:
459 	 *params = ctx->Eval.Map1TextureCoord2;
460 	 break;
461       case GL_MAP1_TEXTURE_COORD_3:
462 	 *params = ctx->Eval.Map1TextureCoord3;
463 	 break;
464       case GL_MAP1_TEXTURE_COORD_4:
465 	 *params = ctx->Eval.Map1TextureCoord4;
466 	 break;
467       case GL_MAP1_VERTEX_3:
468 	 *params = ctx->Eval.Map1Vertex3;
469 	 break;
470       case GL_MAP1_VERTEX_4:
471 	 *params = ctx->Eval.Map1Vertex4;
472 	 break;
473       case GL_MAP2_COLOR_4:
474 	 *params = ctx->Eval.Map2Color4;
475 	 break;
476       case GL_MAP2_GRID_DOMAIN:
477 	 params[0] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2u1);
478 	 params[1] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2u2);
479 	 params[2] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2v1);
480 	 params[3] = FLOAT_TO_BOOL(ctx->Eval.MapGrid2v2);
481 	 break;
482       case GL_MAP2_GRID_SEGMENTS:
483 	 params[0] = INT_TO_BOOL(ctx->Eval.MapGrid2un);
484 	 params[1] = INT_TO_BOOL(ctx->Eval.MapGrid2vn);
485 	 break;
486       case GL_MAP2_INDEX:
487 	 *params = ctx->Eval.Map2Index;
488 	 break;
489       case GL_MAP2_NORMAL:
490 	 *params = ctx->Eval.Map2Normal;
491 	 break;
492       case GL_MAP2_TEXTURE_COORD_1:
493 	 *params = ctx->Eval.Map2TextureCoord1;
494 	 break;
495       case GL_MAP2_TEXTURE_COORD_2:
496 	 *params = ctx->Eval.Map2TextureCoord2;
497 	 break;
498       case GL_MAP2_TEXTURE_COORD_3:
499 	 *params = ctx->Eval.Map2TextureCoord3;
500 	 break;
501       case GL_MAP2_TEXTURE_COORD_4:
502 	 *params = ctx->Eval.Map2TextureCoord4;
503 	 break;
504       case GL_MAP2_VERTEX_3:
505 	 *params = ctx->Eval.Map2Vertex3;
506 	 break;
507       case GL_MAP2_VERTEX_4:
508 	 *params = ctx->Eval.Map2Vertex4;
509 	 break;
510       case GL_MAP_COLOR:
511 	 *params = ctx->Pixel.MapColorFlag;
512 	 break;
513       case GL_MAP_STENCIL:
514 	 *params = ctx->Pixel.MapStencilFlag;
515 	 break;
516       case GL_MATRIX_MODE:
517 	 *params = ENUM_TO_BOOL( ctx->Transform.MatrixMode );
518 	 break;
519       case GL_MAX_ATTRIB_STACK_DEPTH:
520 	 *params = INT_TO_BOOL(MAX_ATTRIB_STACK_DEPTH);
521 	 break;
522       case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
523          *params = INT_TO_BOOL( MAX_CLIENT_ATTRIB_STACK_DEPTH);
524          break;
525       case GL_MAX_CLIP_PLANES:
526 	 *params = INT_TO_BOOL(MAX_CLIP_PLANES);
527 	 break;
528       case GL_MAX_EVAL_ORDER:
529 	 *params = INT_TO_BOOL(MAX_EVAL_ORDER);
530 	 break;
531       case GL_MAX_LIGHTS:
532 	 *params = INT_TO_BOOL(MAX_LIGHTS);
533 	 break;
534       case GL_MAX_LIST_NESTING:
535 	 *params = INT_TO_BOOL(MAX_LIST_NESTING);
536 	 break;
537       case GL_MAX_MODELVIEW_STACK_DEPTH:
538 	 *params = INT_TO_BOOL(MAX_MODELVIEW_STACK_DEPTH);
539 	 break;
540       case GL_MAX_NAME_STACK_DEPTH:
541 	 *params = INT_TO_BOOL(MAX_NAME_STACK_DEPTH);
542 	 break;
543       case GL_MAX_PIXEL_MAP_TABLE:
544 	 *params = INT_TO_BOOL(MAX_PIXEL_MAP_TABLE);
545 	 break;
546       case GL_MAX_PROJECTION_STACK_DEPTH:
547 	 *params = INT_TO_BOOL(MAX_PROJECTION_STACK_DEPTH);
548 	 break;
549       case GL_MAX_TEXTURE_SIZE:
550 	 *params = INT_TO_BOOL(MAX_TEXTURE_SIZE);
551 	 break;
552       case GL_MAX_TEXTURE_STACK_DEPTH:
553 	 *params = INT_TO_BOOL(MAX_TEXTURE_STACK_DEPTH);
554 	 break;
555       case GL_MAX_VIEWPORT_DIMS:
556 	 params[0] = INT_TO_BOOL(MAX_WIDTH);
557 	 params[1] = INT_TO_BOOL(MAX_HEIGHT);
558 	 break;
559       case GL_MODELVIEW_MATRIX:
560 	 for (i=0;i<16;i++) {
561 	    params[i] = FLOAT_TO_BOOL(ctx->ModelViewMatrix[i]);
562 	 }
563 	 break;
564       case GL_MODELVIEW_STACK_DEPTH:
565 	 *params = INT_TO_BOOL(ctx->ModelViewStackDepth);
566 	 break;
567       case GL_NAME_STACK_DEPTH:
568 	 *params = INT_TO_BOOL(ctx->Select.NameStackDepth);
569 	 break;
570       case GL_NORMALIZE:
571 	 *params = ctx->Transform.Normalize;
572 	 break;
573       case GL_PACK_ALIGNMENT:
574 	 *params = INT_TO_BOOL(ctx->Pack.Alignment);
575 	 break;
576       case GL_PACK_LSB_FIRST:
577 	 *params = ctx->Pack.LsbFirst;
578 	 break;
579       case GL_PACK_ROW_LENGTH:
580 	 *params = INT_TO_BOOL(ctx->Pack.RowLength);
581 	 break;
582       case GL_PACK_SKIP_PIXELS:
583 	 *params = INT_TO_BOOL(ctx->Pack.SkipPixels);
584 	 break;
585       case GL_PACK_SKIP_ROWS:
586 	 *params = INT_TO_BOOL(ctx->Pack.SkipRows);
587 	 break;
588       case GL_PACK_SWAP_BYTES:
589 	 *params = ctx->Pack.SwapBytes;
590 	 break;
591       case GL_PERSPECTIVE_CORRECTION_HINT:
592 	 *params = ENUM_TO_BOOL(ctx->Hint.PerspectiveCorrection);
593 	 break;
594       case GL_PIXEL_MAP_A_TO_A_SIZE:
595 	 *params = INT_TO_BOOL(ctx->Pixel.MapAtoAsize);
596 	 break;
597       case GL_PIXEL_MAP_B_TO_B_SIZE:
598 	 *params = INT_TO_BOOL(ctx->Pixel.MapBtoBsize);
599 	 break;
600       case GL_PIXEL_MAP_G_TO_G_SIZE:
601 	 *params = INT_TO_BOOL(ctx->Pixel.MapGtoGsize);
602 	 break;
603       case GL_PIXEL_MAP_I_TO_A_SIZE:
604 	 *params = INT_TO_BOOL(ctx->Pixel.MapItoAsize);
605 	 break;
606       case GL_PIXEL_MAP_I_TO_B_SIZE:
607 	 *params = INT_TO_BOOL(ctx->Pixel.MapItoBsize);
608 	 break;
609       case GL_PIXEL_MAP_I_TO_G_SIZE:
610 	 *params = INT_TO_BOOL(ctx->Pixel.MapItoGsize);
611 	 break;
612       case GL_PIXEL_MAP_I_TO_I_SIZE:
613 	 *params = INT_TO_BOOL(ctx->Pixel.MapItoIsize);
614 	 break;
615       case GL_PIXEL_MAP_I_TO_R_SIZE:
616 	 *params = INT_TO_BOOL(ctx->Pixel.MapItoRsize);
617 	 break;
618       case GL_PIXEL_MAP_R_TO_R_SIZE:
619 	 *params = INT_TO_BOOL(ctx->Pixel.MapRtoRsize);
620 	 break;
621       case GL_PIXEL_MAP_S_TO_S_SIZE:
622 	 *params = INT_TO_BOOL(ctx->Pixel.MapStoSsize);
623 	 break;
624       case GL_POINT_SIZE:
625 	 *params = FLOAT_TO_BOOL(ctx->Point.Size );
626 	 break;
627       case GL_POINT_SIZE_GRANULARITY:
628 	 *params = FLOAT_TO_BOOL(POINT_SIZE_GRANULARITY );
629 	 break;
630       case GL_POINT_SIZE_RANGE:
631 	 params[0] = FLOAT_TO_BOOL(MIN_POINT_SIZE );
632 	 params[1] = FLOAT_TO_BOOL(MAX_POINT_SIZE );
633 	 break;
634       case GL_POINT_SMOOTH:
635 	 *params = ctx->Point.SmoothFlag;
636 	 break;
637       case GL_POINT_SMOOTH_HINT:
638 	 *params = ENUM_TO_BOOL(ctx->Hint.PointSmooth);
639 	 break;
640       case GL_POLYGON_MODE:
641 	 params[0] = ENUM_TO_BOOL(ctx->Polygon.FrontMode);
642 	 params[1] = ENUM_TO_BOOL(ctx->Polygon.BackMode);
643 	 break;
644 #ifdef GL_EXT_polygon_offset
645       case GL_POLYGON_OFFSET_BIAS_EXT:
646          *params = FLOAT_TO_BOOL( ctx->Polygon.OffsetUnits );
647          break;
648 #endif
649       case GL_POLYGON_OFFSET_FACTOR:
650          *params = FLOAT_TO_BOOL( ctx->Polygon.OffsetFactor );
651          break;
652       case GL_POLYGON_OFFSET_UNITS:
653          *params = FLOAT_TO_BOOL( ctx->Polygon.OffsetUnits );
654          break;
655       case GL_POLYGON_SMOOTH:
656 	 *params = ctx->Polygon.SmoothFlag;
657 	 break;
658       case GL_POLYGON_SMOOTH_HINT:
659 	 *params = ENUM_TO_BOOL(ctx->Hint.PolygonSmooth);
660 	 break;
661       case GL_POLYGON_STIPPLE:
662 	 *params = ctx->Polygon.StippleFlag;
663 	 break;
664       case GL_PROJECTION_MATRIX:
665 	 for (i=0;i<16;i++) {
666 	    params[i] = FLOAT_TO_BOOL(ctx->ProjectionMatrix[i]);
667 	 }
668 	 break;
669       case GL_PROJECTION_STACK_DEPTH:
670 	 *params = INT_TO_BOOL(ctx->ProjectionStackDepth);
671 	 break;
672       case GL_READ_BUFFER:
673 	 *params = ENUM_TO_BOOL(ctx->Pixel.ReadBuffer);
674 	 break;
675       case GL_RED_BIAS:
676          *params = FLOAT_TO_BOOL(ctx->Pixel.RedBias);
677 	 break;
678       case GL_RED_BITS:
679          *params = INT_TO_BOOL( ctx->Visual->RedBits );
680 	 break;
681       case GL_RED_SCALE:
682          *params = FLOAT_TO_BOOL(ctx->Pixel.RedScale);
683 	 break;
684       case GL_RENDER_MODE:
685 	 *params = ENUM_TO_BOOL(ctx->RenderMode);
686 	 break;
687       case GL_RGBA_MODE:
688          *params = ctx->Visual->RGBAflag;
689 	 break;
690       case GL_SCISSOR_BOX:
691 	 params[0] = INT_TO_BOOL(ctx->Scissor.X);
692 	 params[1] = INT_TO_BOOL(ctx->Scissor.Y);
693 	 params[2] = INT_TO_BOOL(ctx->Scissor.Width);
694 	 params[3] = INT_TO_BOOL(ctx->Scissor.Height);
695 	 break;
696       case GL_SCISSOR_TEST:
697 	 *params = ctx->Scissor.Enabled;
698 	 break;
699       case GL_SHADE_MODEL:
700 	 *params = ENUM_TO_BOOL(ctx->Light.ShadeModel);
701 	 break;
702       case GL_STENCIL_BITS:
703 	 *params = INT_TO_BOOL(ctx->Visual->StencilBits);
704 	 break;
705       case GL_STENCIL_CLEAR_VALUE:
706 	 *params = INT_TO_BOOL(ctx->Stencil.Clear);
707 	 break;
708       case GL_STENCIL_FAIL:
709 	 *params = ENUM_TO_BOOL(ctx->Stencil.FailFunc);
710 	 break;
711       case GL_STENCIL_FUNC:
712 	 *params = ENUM_TO_BOOL(ctx->Stencil.Function);
713 	 break;
714       case GL_STENCIL_PASS_DEPTH_FAIL:
715 	 *params = ENUM_TO_BOOL(ctx->Stencil.ZFailFunc);
716 	 break;
717       case GL_STENCIL_PASS_DEPTH_PASS:
718 	 *params = ENUM_TO_BOOL(ctx->Stencil.ZPassFunc);
719 	 break;
720       case GL_STENCIL_REF:
721 	 *params = INT_TO_BOOL(ctx->Stencil.Ref);
722 	 break;
723       case GL_STENCIL_TEST:
724 	 *params = ctx->Stencil.Enabled;
725 	 break;
726       case GL_STENCIL_VALUE_MASK:
727 	 *params = INT_TO_BOOL(ctx->Stencil.ValueMask);
728 	 break;
729       case GL_STENCIL_WRITEMASK:
730 	 *params = INT_TO_BOOL(ctx->Stencil.WriteMask);
731 	 break;
732       case GL_STEREO:
733 	 *params = GL_FALSE;    /* TODO */
734 	 break;
735       case GL_SUBPIXEL_BITS:
736 	 *params = INT_TO_BOOL(0);  /* TODO */
737 	 break;
738       case GL_TEXTURE_1D:
739 	 *params = (ctx->Texture.Enabled & TEXTURE_1D) ? GL_TRUE : GL_FALSE;
740 	 break;
741       case GL_TEXTURE_2D:
742 	 *params = (ctx->Texture.Enabled & TEXTURE_2D) ? GL_TRUE : GL_FALSE;
743 	 break;
744       case GL_TEXTURE_ENV_COLOR:
745 	 params[0] = FLOAT_TO_BOOL(ctx->Texture.EnvColor[0]);
746 	 params[1] = FLOAT_TO_BOOL(ctx->Texture.EnvColor[1]);
747 	 params[2] = FLOAT_TO_BOOL(ctx->Texture.EnvColor[2]);
748 	 params[3] = FLOAT_TO_BOOL(ctx->Texture.EnvColor[3]);
749 	 break;
750       case GL_TEXTURE_ENV_MODE:
751 	 *params = ENUM_TO_BOOL(ctx->Texture.EnvMode);
752 	 break;
753       case GL_TEXTURE_GEN_S:
754 	 *params = (ctx->Texture.TexGenEnabled & S_BIT) ? GL_TRUE : GL_FALSE;
755 	 break;
756       case GL_TEXTURE_GEN_T:
757 	 *params = (ctx->Texture.TexGenEnabled & T_BIT) ? GL_TRUE : GL_FALSE;
758 	 break;
759       case GL_TEXTURE_GEN_R:
760 	 *params = (ctx->Texture.TexGenEnabled & R_BIT) ? GL_TRUE : GL_FALSE;
761 	 break;
762       case GL_TEXTURE_GEN_Q:
763 	 *params = (ctx->Texture.TexGenEnabled & Q_BIT) ? GL_TRUE : GL_FALSE;
764 	 break;
765       case GL_TEXTURE_MATRIX:
766 	 for (i=0;i<16;i++) {
767 	    params[i] = FLOAT_TO_BOOL(ctx->TextureMatrix[i]);
768 	 }
769 	 break;
770       case GL_TEXTURE_STACK_DEPTH:
771 	 *params = INT_TO_BOOL(ctx->TextureStackDepth);
772 	 break;
773       case GL_UNPACK_ALIGNMENT:
774 	 *params = INT_TO_BOOL(ctx->Unpack.Alignment);
775 	 break;
776       case GL_UNPACK_LSB_FIRST:
777 	 *params = ctx->Unpack.LsbFirst;
778 	 break;
779       case GL_UNPACK_ROW_LENGTH:
780 	 *params = INT_TO_BOOL(ctx->Unpack.RowLength);
781 	 break;
782       case GL_UNPACK_SKIP_PIXELS:
783 	 *params = INT_TO_BOOL(ctx->Unpack.SkipPixels);
784 	 break;
785       case GL_UNPACK_SKIP_ROWS:
786 	 *params = INT_TO_BOOL(ctx->Unpack.SkipRows);
787 	 break;
788       case GL_UNPACK_SWAP_BYTES:
789 	 *params = ctx->Unpack.SwapBytes;
790 	 break;
791       case GL_VIEWPORT:
792 	 params[0] = INT_TO_BOOL(ctx->Viewport.X);
793 	 params[1] = INT_TO_BOOL(ctx->Viewport.Y);
794 	 params[2] = INT_TO_BOOL(ctx->Viewport.Width);
795 	 params[3] = INT_TO_BOOL(ctx->Viewport.Height);
796 	 break;
797       case GL_ZOOM_X:
798 	 *params = FLOAT_TO_BOOL(ctx->Pixel.ZoomX);
799 	 break;
800       case GL_ZOOM_Y:
801 	 *params = FLOAT_TO_BOOL(ctx->Pixel.ZoomY);
802 	 break;
803       case GL_VERTEX_ARRAY_SIZE:
804          *params = INT_TO_BOOL(ctx->Array.VertexSize);
805          break;
806       case GL_VERTEX_ARRAY_TYPE:
807          *params = ENUM_TO_BOOL(ctx->Array.VertexType);
808          break;
809       case GL_VERTEX_ARRAY_STRIDE:
810          *params = INT_TO_BOOL(ctx->Array.VertexStride);
811          break;
812       case GL_VERTEX_ARRAY_COUNT_EXT:
813          *params = INT_TO_BOOL(0);
814          break;
815       case GL_NORMAL_ARRAY_TYPE:
816          *params = ENUM_TO_BOOL(ctx->Array.NormalType);
817          break;
818       case GL_NORMAL_ARRAY_STRIDE:
819          *params = INT_TO_BOOL(ctx->Array.NormalStride);
820          break;
821       case GL_NORMAL_ARRAY_COUNT_EXT:
822          *params = INT_TO_BOOL(0);
823          break;
824       case GL_COLOR_ARRAY_SIZE:
825          *params = INT_TO_BOOL(ctx->Array.ColorSize);
826          break;
827       case GL_COLOR_ARRAY_TYPE:
828          *params = ENUM_TO_BOOL(ctx->Array.ColorType);
829          break;
830       case GL_COLOR_ARRAY_STRIDE:
831          *params = INT_TO_BOOL(ctx->Array.ColorStride);
832          break;
833       case GL_COLOR_ARRAY_COUNT_EXT:
834          *params = INT_TO_BOOL(0);
835          break;
836       case GL_INDEX_ARRAY_TYPE:
837          *params = ENUM_TO_BOOL(ctx->Array.IndexType);
838          break;
839       case GL_INDEX_ARRAY_STRIDE:
840          *params = INT_TO_BOOL(ctx->Array.IndexStride);
841          break;
842       case GL_INDEX_ARRAY_COUNT_EXT:
843          *params = INT_TO_BOOL(0);
844          break;
845       case GL_TEXTURE_COORD_ARRAY_SIZE:
846          *params = INT_TO_BOOL(ctx->Array.TexCoordSize);
847          break;
848       case GL_TEXTURE_COORD_ARRAY_TYPE:
849          *params = ENUM_TO_BOOL(ctx->Array.TexCoordType);
850          break;
851       case GL_TEXTURE_COORD_ARRAY_STRIDE:
852          *params = INT_TO_BOOL(ctx->Array.TexCoordStride);
853          break;
854       case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
855          *params = INT_TO_BOOL(0);
856          break;
857       case GL_EDGE_FLAG_ARRAY_STRIDE:
858          *params = INT_TO_BOOL(ctx->Array.EdgeFlagStride);
859          break;
860       case GL_EDGE_FLAG_ARRAY_EXT:
861          *params = INT_TO_BOOL(0);
862          break;
863       case GL_TEXTURE_BINDING_1D:
864          *params = INT_TO_BOOL(ctx->Texture.Current1D->Name);
865           break;
866       case GL_TEXTURE_BINDING_2D:
867          *params = INT_TO_BOOL(ctx->Texture.Current2D->Name);
868           break;
869       case GL_TEXTURE_3D_BINDING_EXT:
870          *params = INT_TO_BOOL(ctx->Texture.Current2D->Name);
871           break;
872       default:
873          gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" );
874    }
875 }
876 
877 
878 
879 
880 void gl_GetDoublev( GLcontext *ctx, GLenum pname, GLdouble *params )
881 {
882    GLuint i;
883 
884    if (INSIDE_BEGIN_END(ctx)) {
885       gl_error( ctx, GL_INVALID_OPERATION, "glGetDoublev" );
886       return;
887    }
888 
889    switch (pname) {
890       case GL_ACCUM_RED_BITS:
891       case GL_ACCUM_GREEN_BITS:
892       case GL_ACCUM_BLUE_BITS:
893       case GL_ACCUM_ALPHA_BITS:
894          *params = (GLdouble) ctx->Visual->AccumBits;
895          break;
896       case GL_ACCUM_CLEAR_VALUE:
897          params[0] = (GLdouble) ctx->Accum.ClearColor[0];
898          params[1] = (GLdouble) ctx->Accum.ClearColor[1];
899          params[2] = (GLdouble) ctx->Accum.ClearColor[2];
900          params[3] = (GLdouble) ctx->Accum.ClearColor[3];
901          break;
902       case GL_ALPHA_BIAS:
903          *params = (GLdouble) ctx->Pixel.AlphaBias;
904          break;
905       case GL_ALPHA_BITS:
906          *params = (GLdouble) ctx->Visual->AlphaBits;
907          break;
908       case GL_ALPHA_SCALE:
909          *params = (GLdouble) ctx->Pixel.AlphaScale;
910          break;
911       case GL_ALPHA_TEST:
912          *params = (GLdouble) ctx->Color.AlphaEnabled;
913          break;
914       case GL_ALPHA_TEST_FUNC:
915          *params = ENUM_TO_DOUBLE(ctx->Color.AlphaFunc);
916          break;
917       case GL_ALPHA_TEST_REF:
918          *params = (GLdouble) ctx->Color.AlphaRef;
919          break;
920       case GL_ATTRIB_STACK_DEPTH:
921          *params = (GLdouble ) ctx->AttribStackDepth;
922          break;
923       case GL_AUTO_NORMAL:
924          *params = (GLdouble) ctx->Eval.AutoNormal;
925          break;
926       case GL_AUX_BUFFERS:
927          *params = (GLdouble) NUM_AUX_BUFFERS;
928          break;
929       case GL_BLEND:
930          *params = (GLdouble) ctx->Color.BlendEnabled;
931          break;
932       case GL_BLEND_DST:
933          *params = ENUM_TO_DOUBLE(ctx->Color.BlendDst);
934          break;
935       case GL_BLEND_SRC:
936          *params = ENUM_TO_DOUBLE(ctx->Color.BlendSrc);
937          break;
938       case GL_BLUE_BIAS:
939          *params = (GLdouble) ctx->Pixel.BlueBias;
940          break;
941       case GL_BLUE_BITS:
942          *params = (GLdouble) ctx->Visual->BlueBits;
943          break;
944       case GL_BLUE_SCALE:
945          *params = (GLdouble) ctx->Pixel.BlueScale;
946          break;
947       case GL_CLIENT_ATTRIB_STACK_DEPTH:
948          *params = (GLdouble) ctx->ClientAttribStackDepth;
949          break;
950       case GL_CLIP_PLANE0:
951       case GL_CLIP_PLANE1:
952       case GL_CLIP_PLANE2:
953       case GL_CLIP_PLANE3:
954       case GL_CLIP_PLANE4:
955       case GL_CLIP_PLANE5:
956          *params = (GLdouble) ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0];
957          break;
958       case GL_COLOR_CLEAR_VALUE:
959          params[0] = (GLdouble) ctx->Color.ClearColor[0];
960          params[1] = (GLdouble) ctx->Color.ClearColor[1];
961          params[2] = (GLdouble) ctx->Color.ClearColor[2];
962          params[3] = (GLdouble) ctx->Color.ClearColor[3];
963          break;
964       case GL_COLOR_MATERIAL:
965          *params = (GLdouble) ctx->Light.ColorMaterialEnabled;
966          break;
967       case GL_COLOR_MATERIAL_FACE:
968          *params = ENUM_TO_DOUBLE(ctx->Light.ColorMaterialFace);
969          break;
970       case GL_COLOR_MATERIAL_PARAMETER:
971          *params = ENUM_TO_DOUBLE(ctx->Light.ColorMaterialMode);
972          break;
973       case GL_COLOR_WRITEMASK:
974          params[0] = (ctx->Color.ColorMask & 8) ? 1.0 : 0.0;
975          params[1] = (ctx->Color.ColorMask & 4) ? 1.0 : 0.0;
976          params[2] = (ctx->Color.ColorMask & 2) ? 1.0 : 0.0;
977          params[3] = (ctx->Color.ColorMask & 1) ? 1.0 : 0.0;
978          break;
979       case GL_CULL_FACE:
980          *params = (GLdouble) ctx->Polygon.CullFlag;
981          break;
982       case GL_CULL_FACE_MODE:
983          *params = ENUM_TO_DOUBLE(ctx->Polygon.CullFaceMode);
984          break;
985       case GL_CURRENT_COLOR:
986          params[0] = ctx->Current.ByteColor[0] * ctx->Visual->InvRedScale;
987          params[1] = ctx->Current.ByteColor[1] * ctx->Visual->InvGreenScale;
988          params[2] = ctx->Current.ByteColor[2] * ctx->Visual->InvBlueScale;
989          params[3] = ctx->Current.ByteColor[3] * ctx->Visual->InvAlphaScale;
990          break;
991       case GL_CURRENT_INDEX:
992          *params = (GLdouble) ctx->Current.Index;
993          break;
994       case GL_CURRENT_NORMAL:
995          params[0] = (GLdouble) ctx->Current.Normal[0];
996          params[1] = (GLdouble) ctx->Current.Normal[1];
997          params[2] = (GLdouble) ctx->Current.Normal[2];
998          break;
999       case GL_CURRENT_RASTER_COLOR:
1000 	 params[0] = (GLdouble) ctx->Current.RasterColor[0];
1001 	 params[1] = (GLdouble) ctx->Current.RasterColor[1];
1002 	 params[2] = (GLdouble) ctx->Current.RasterColor[2];
1003 	 params[3] = (GLdouble) ctx->Current.RasterColor[3];
1004 	 break;
1005       case GL_CURRENT_RASTER_DISTANCE:
1006 	 params[0] = (GLdouble) ctx->Current.RasterDistance;
1007 	 break;
1008       case GL_CURRENT_RASTER_INDEX:
1009 	 *params = (GLdouble) ctx->Current.RasterIndex;
1010 	 break;
1011       case GL_CURRENT_RASTER_POSITION:
1012 	 params[0] = (GLdouble) ctx->Current.RasterPos[0];
1013 	 params[1] = (GLdouble) ctx->Current.RasterPos[1];
1014 	 params[2] = (GLdouble) ctx->Current.RasterPos[2];
1015 	 params[3] = (GLdouble) ctx->Current.RasterPos[3];
1016 	 break;
1017       case GL_CURRENT_RASTER_TEXTURE_COORDS:
1018 	 params[0] = (GLdouble) ctx->Current.RasterTexCoord[0];
1019 	 params[1] = (GLdouble) ctx->Current.RasterTexCoord[1];
1020 	 params[2] = (GLdouble) ctx->Current.RasterTexCoord[2];
1021 	 params[3] = (GLdouble) ctx->Current.RasterTexCoord[3];
1022 	 break;
1023       case GL_CURRENT_RASTER_POSITION_VALID:
1024 	 *params = (GLdouble) ctx->Current.RasterPosValid;
1025 	 break;
1026       case GL_CURRENT_TEXTURE_COORDS:
1027 	 params[0] = (GLdouble) ctx->Current.TexCoord[0];
1028 	 params[1] = (GLdouble) ctx->Current.TexCoord[1];
1029 	 params[2] = (GLdouble) ctx->Current.TexCoord[2];
1030 	 params[3] = (GLdouble) ctx->Current.TexCoord[3];
1031 	 break;
1032       case GL_DEPTH_BIAS:
1033 	 *params = (GLdouble) ctx->Pixel.DepthBias;
1034 	 break;
1035       case GL_DEPTH_BITS:
1036 	 *params = (GLdouble) ctx->Visual->DepthBits;
1037 	 break;
1038       case GL_DEPTH_CLEAR_VALUE:
1039 	 *params = (GLdouble) ctx->Depth.Clear;
1040 	 break;
1041       case GL_DEPTH_FUNC:
1042 	 *params = ENUM_TO_DOUBLE(ctx->Depth.Func);
1043 	 break;
1044       case GL_DEPTH_RANGE:
1045          params[0] = (GLdouble) ctx->Viewport.Near;
1046          params[1] = (GLdouble) ctx->Viewport.Far;
1047 	 break;
1048       case GL_DEPTH_SCALE:
1049 	 *params = (GLdouble) ctx->Pixel.DepthScale;
1050 	 break;
1051       case GL_DEPTH_TEST:
1052 	 *params = (GLdouble) ctx->Depth.Test;
1053 	 break;
1054       case GL_DEPTH_WRITEMASK:
1055 	 *params = (GLdouble) ctx->Depth.Mask;
1056 	 break;
1057       case GL_DITHER:
1058 	 *params = (GLdouble) ctx->Color.DitherFlag;
1059 	 break;
1060       case GL_DOUBLEBUFFER:
1061 	 *params = (GLdouble) ctx->Visual->DBflag;
1062 	 break;
1063       case GL_DRAW_BUFFER:
1064 	 *params = ENUM_TO_DOUBLE(ctx->Color.DrawBuffer);
1065 	 break;
1066       case GL_EDGE_FLAG:
1067 	 *params = (GLdouble) ctx->Current.EdgeFlag;
1068 	 break;
1069       case GL_FEEDBACK_BUFFER_SIZE:
1070          /* TODO: is this right?  Or, return number of entries in buffer? */
1071          *params = (GLdouble) ctx->Feedback.BufferSize;
1072          break;
1073       case GL_FEEDBACK_BUFFER_TYPE:
1074          *params = ENUM_TO_DOUBLE(ctx->Feedback.Type);
1075          break;
1076       case GL_FOG:
1077 	 *params = (GLdouble) ctx->Fog.Enabled;
1078 	 break;
1079       case GL_FOG_COLOR:
1080 	 params[0] = (GLdouble) ctx->Fog.Color[0];
1081 	 params[1] = (GLdouble) ctx->Fog.Color[1];
1082 	 params[2] = (GLdouble) ctx->Fog.Color[2];
1083 	 params[3] = (GLdouble) ctx->Fog.Color[3];
1084 	 break;
1085       case GL_FOG_DENSITY:
1086 	 *params = (GLdouble) ctx->Fog.Density;
1087 	 break;
1088       case GL_FOG_END:
1089 	 *params = (GLdouble) ctx->Fog.End;
1090 	 break;
1091       case GL_FOG_HINT:
1092 	 *params = ENUM_TO_DOUBLE(ctx->Hint.Fog);
1093 	 break;
1094       case GL_FOG_INDEX:
1095 	 *params = (GLdouble) ctx->Fog.Index;
1096 	 break;
1097       case GL_FOG_MODE:
1098 	 *params = ENUM_TO_DOUBLE(ctx->Fog.Mode);
1099 	 break;
1100       case GL_FOG_START:
1101 	 *params = (GLdouble) ctx->Fog.Start;
1102 	 break;
1103       case GL_FRONT_FACE:
1104 	 *params = ENUM_TO_DOUBLE(ctx->Polygon.FrontFace);
1105 	 break;
1106       case GL_GREEN_BIAS:
1107          *params = (GLdouble) ctx->Pixel.GreenBias;
1108          break;
1109       case GL_GREEN_BITS:
1110          *params = (GLdouble) ctx->Visual->GreenBits;
1111          break;
1112       case GL_GREEN_SCALE:
1113          *params = (GLdouble) ctx->Pixel.GreenScale;
1114          break;
1115       case GL_INDEX_BITS:
1116          *params = (GLdouble) ctx->Visual->IndexBits;
1117 	 break;
1118       case GL_INDEX_CLEAR_VALUE:
1119          *params = (GLdouble) ctx->Color.ClearIndex;
1120 	 break;
1121       case GL_INDEX_MODE:
1122 	 *params = ctx->Visual->RGBAflag ? 0.0 : 1.0;
1123 	 break;
1124       case GL_INDEX_OFFSET:
1125 	 *params = (GLdouble) ctx->Pixel.IndexOffset;
1126 	 break;
1127       case GL_INDEX_SHIFT:
1128 	 *params = (GLdouble) ctx->Pixel.IndexShift;
1129 	 break;
1130       case GL_INDEX_WRITEMASK:
1131 	 *params = (GLdouble) ctx->Color.IndexMask;
1132 	 break;
1133       case GL_LIGHT0:
1134       case GL_LIGHT1:
1135       case GL_LIGHT2:
1136       case GL_LIGHT3:
1137       case GL_LIGHT4:
1138       case GL_LIGHT5:
1139       case GL_LIGHT6:
1140       case GL_LIGHT7:
1141 	 *params = (GLdouble) ctx->Light.Light[pname-GL_LIGHT0].Enabled;
1142 	 break;
1143       case GL_LIGHTING:
1144 	 *params = (GLdouble) ctx->Light.Enabled;
1145 	 break;
1146       case GL_LIGHT_MODEL_AMBIENT:
1147 	 params[0] = (GLdouble) ctx->Light.Model.Ambient[0];
1148 	 params[1] = (GLdouble) ctx->Light.Model.Ambient[1];
1149 	 params[2] = (GLdouble) ctx->Light.Model.Ambient[2];
1150 	 params[3] = (GLdouble) ctx->Light.Model.Ambient[3];
1151 	 break;
1152       case GL_LIGHT_MODEL_LOCAL_VIEWER:
1153 	 *params = (GLdouble) ctx->Light.Model.LocalViewer;
1154 	 break;
1155       case GL_LIGHT_MODEL_TWO_SIDE:
1156 	 *params = (GLdouble) ctx->Light.Model.TwoSide;
1157 	 break;
1158       case GL_LINE_SMOOTH:
1159 	 *params = (GLdouble) ctx->Line.SmoothFlag;
1160 	 break;
1161       case GL_LINE_SMOOTH_HINT:
1162 	 *params = ENUM_TO_DOUBLE(ctx->Hint.LineSmooth);
1163 	 break;
1164       case GL_LINE_STIPPLE:
1165 	 *params = (GLdouble) ctx->Line.StippleFlag;
1166 	 break;
1167       case GL_LINE_STIPPLE_PATTERN:
1168          *params = (GLdouble) ctx->Line.StipplePattern;
1169          break;
1170       case GL_LINE_STIPPLE_REPEAT:
1171          *params = (GLdouble) ctx->Line.StippleFactor;
1172          break;
1173       case GL_LINE_WIDTH:
1174 	 *params = (GLdouble) ctx->Line.Width;
1175 	 break;
1176       case GL_LINE_WIDTH_GRANULARITY:
1177 	 *params = (GLdouble) LINE_WIDTH_GRANULARITY;
1178 	 break;
1179       case GL_LINE_WIDTH_RANGE:
1180 	 params[0] = (GLdouble) MIN_LINE_WIDTH;
1181 	 params[1] = (GLdouble) MAX_LINE_WIDTH;
1182 	 break;
1183       case GL_LIST_BASE:
1184 	 *params = (GLdouble) ctx->List.ListBase;
1185 	 break;
1186       case GL_LIST_INDEX:
1187 	 *params = (GLdouble) ctx->CurrentListNum;
1188 	 break;
1189       case GL_LIST_MODE:
1190 	 *params = ctx->ExecuteFlag ? ENUM_TO_DOUBLE(GL_COMPILE_AND_EXECUTE)
1191 	   			  : ENUM_TO_DOUBLE(GL_COMPILE);
1192 	 break;
1193       case GL_INDEX_LOGIC_OP:
1194 	 *params = (GLdouble) ctx->Color.IndexLogicOpEnabled;
1195 	 break;
1196       case GL_COLOR_LOGIC_OP:
1197 	 *params = (GLdouble) ctx->Color.ColorLogicOpEnabled;
1198 	 break;
1199       case GL_LOGIC_OP_MODE:
1200          *params = ENUM_TO_DOUBLE(ctx->Color.LogicOp);
1201 	 break;
1202       case GL_MAP1_COLOR_4:
1203 	 *params = (GLdouble) ctx->Eval.Map1Color4;
1204 	 break;
1205       case GL_MAP1_GRID_DOMAIN:
1206 	 params[0] = (GLdouble) ctx->Eval.MapGrid1u1;
1207 	 params[1] = (GLdouble) ctx->Eval.MapGrid1u2;
1208 	 break;
1209       case GL_MAP1_GRID_SEGMENTS:
1210 	 *params = (GLdouble) ctx->Eval.MapGrid1un;
1211 	 break;
1212       case GL_MAP1_INDEX:
1213 	 *params = (GLdouble) ctx->Eval.Map1Index;
1214 	 break;
1215       case GL_MAP1_NORMAL:
1216 	 *params = (GLdouble) ctx->Eval.Map1Normal;
1217 	 break;
1218       case GL_MAP1_TEXTURE_COORD_1:
1219 	 *params = (GLdouble) ctx->Eval.Map1TextureCoord1;
1220 	 break;
1221       case GL_MAP1_TEXTURE_COORD_2:
1222 	 *params = (GLdouble) ctx->Eval.Map1TextureCoord2;
1223 	 break;
1224       case GL_MAP1_TEXTURE_COORD_3:
1225 	 *params = (GLdouble) ctx->Eval.Map1TextureCoord3;
1226 	 break;
1227       case GL_MAP1_TEXTURE_COORD_4:
1228 	 *params = (GLdouble) ctx->Eval.Map1TextureCoord4;
1229 	 break;
1230       case GL_MAP1_VERTEX_3:
1231 	 *params = (GLdouble) ctx->Eval.Map1Vertex3;
1232 	 break;
1233       case GL_MAP1_VERTEX_4:
1234 	 *params = (GLdouble) ctx->Eval.Map1Vertex4;
1235 	 break;
1236       case GL_MAP2_COLOR_4:
1237 	 *params = (GLdouble) ctx->Eval.Map2Color4;
1238 	 break;
1239       case GL_MAP2_GRID_DOMAIN:
1240 	 params[0] = (GLdouble) ctx->Eval.MapGrid2u1;
1241 	 params[1] = (GLdouble) ctx->Eval.MapGrid2u2;
1242 	 params[2] = (GLdouble) ctx->Eval.MapGrid2v1;
1243 	 params[3] = (GLdouble) ctx->Eval.MapGrid2v2;
1244 	 break;
1245       case GL_MAP2_GRID_SEGMENTS:
1246 	 params[0] = (GLdouble) ctx->Eval.MapGrid2un;
1247 	 params[1] = (GLdouble) ctx->Eval.MapGrid2vn;
1248 	 break;
1249       case GL_MAP2_INDEX:
1250 	 *params = (GLdouble) ctx->Eval.Map2Index;
1251 	 break;
1252       case GL_MAP2_NORMAL:
1253 	 *params = (GLdouble) ctx->Eval.Map2Normal;
1254 	 break;
1255       case GL_MAP2_TEXTURE_COORD_1:
1256 	 *params = (GLdouble) ctx->Eval.Map2TextureCoord1;
1257 	 break;
1258       case GL_MAP2_TEXTURE_COORD_2:
1259 	 *params = (GLdouble) ctx->Eval.Map2TextureCoord2;
1260 	 break;
1261       case GL_MAP2_TEXTURE_COORD_3:
1262 	 *params = (GLdouble) ctx->Eval.Map2TextureCoord3;
1263 	 break;
1264       case GL_MAP2_TEXTURE_COORD_4:
1265 	 *params = (GLdouble) ctx->Eval.Map2TextureCoord4;
1266 	 break;
1267       case GL_MAP2_VERTEX_3:
1268 	 *params = (GLdouble) ctx->Eval.Map2Vertex3;
1269 	 break;
1270       case GL_MAP2_VERTEX_4:
1271 	 *params = (GLdouble) ctx->Eval.Map2Vertex4;
1272 	 break;
1273       case GL_MAP_COLOR:
1274 	 *params = (GLdouble) ctx->Pixel.MapColorFlag;
1275 	 break;
1276       case GL_MAP_STENCIL:
1277 	 *params = (GLdouble) ctx->Pixel.MapStencilFlag;
1278 	 break;
1279       case GL_MATRIX_MODE:
1280 	 *params = ENUM_TO_DOUBLE(ctx->Transform.MatrixMode);
1281 	 break;
1282       case GL_MAX_ATTRIB_STACK_DEPTH:
1283 	 *params = (GLdouble) MAX_ATTRIB_STACK_DEPTH;
1284 	 break;
1285       case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
1286          *params = (GLdouble) MAX_CLIENT_ATTRIB_STACK_DEPTH;
1287          break;
1288       case GL_MAX_CLIP_PLANES:
1289 	 *params = (GLdouble) MAX_CLIP_PLANES;
1290 	 break;
1291       case GL_MAX_EVAL_ORDER:
1292 	 *params = (GLdouble) MAX_EVAL_ORDER;
1293 	 break;
1294       case GL_MAX_LIGHTS:
1295 	 *params = (GLdouble) MAX_LIGHTS;
1296 	 break;
1297       case GL_MAX_LIST_NESTING:
1298 	 *params = (GLdouble) MAX_LIST_NESTING;
1299 	 break;
1300       case GL_MAX_MODELVIEW_STACK_DEPTH:
1301 	 *params = (GLdouble) MAX_MODELVIEW_STACK_DEPTH;
1302 	 break;
1303       case GL_MAX_NAME_STACK_DEPTH:
1304 	 *params = (GLdouble) MAX_NAME_STACK_DEPTH;
1305 	 break;
1306       case GL_MAX_PIXEL_MAP_TABLE:
1307 	 *params = (GLdouble) MAX_PIXEL_MAP_TABLE;
1308 	 break;
1309       case GL_MAX_PROJECTION_STACK_DEPTH:
1310 	 *params = (GLdouble) MAX_PROJECTION_STACK_DEPTH;
1311 	 break;
1312       case GL_MAX_TEXTURE_SIZE:
1313 	 *params = (GLdouble) MAX_TEXTURE_SIZE;
1314 	 break;
1315       case GL_MAX_TEXTURE_STACK_DEPTH:
1316 	 *params = (GLdouble) MAX_TEXTURE_STACK_DEPTH;
1317 	 break;
1318       case GL_MAX_VIEWPORT_DIMS:
1319          params[0] = (GLdouble) MAX_WIDTH;
1320          params[1] = (GLdouble) MAX_HEIGHT;
1321          break;
1322       case GL_MODELVIEW_MATRIX:
1323 	 for (i=0;i<16;i++) {
1324 	    params[i] = (GLdouble) ctx->ModelViewMatrix[i];
1325 	 }
1326 	 break;
1327       case GL_MODELVIEW_STACK_DEPTH:
1328 	 *params = (GLdouble) ctx->ModelViewStackDepth;
1329 	 break;
1330       case GL_NAME_STACK_DEPTH:
1331 	 *params = (GLdouble) ctx->Select.NameStackDepth;
1332 	 break;
1333       case GL_NORMALIZE:
1334 	 *params = (GLdouble) ctx->Transform.Normalize;
1335 	 break;
1336       case GL_PACK_ALIGNMENT:
1337 	 *params = (GLdouble) ctx->Pack.Alignment;
1338 	 break;
1339       case GL_PACK_LSB_FIRST:
1340 	 *params = (GLdouble) ctx->Pack.LsbFirst;
1341 	 break;
1342       case GL_PACK_ROW_LENGTH:
1343 	 *params = (GLdouble) ctx->Pack.RowLength;
1344 	 break;
1345       case GL_PACK_SKIP_PIXELS:
1346 	 *params = (GLdouble) ctx->Pack.SkipPixels;
1347 	 break;
1348       case GL_PACK_SKIP_ROWS:
1349 	 *params = (GLdouble) ctx->Pack.SkipRows;
1350 	 break;
1351       case GL_PACK_SWAP_BYTES:
1352 	 *params = (GLdouble) ctx->Pack.SwapBytes;
1353 	 break;
1354       case GL_PERSPECTIVE_CORRECTION_HINT:
1355 	 *params = ENUM_TO_DOUBLE(ctx->Hint.PerspectiveCorrection);
1356 	 break;
1357       case GL_PIXEL_MAP_A_TO_A_SIZE:
1358 	 *params = (GLdouble) ctx->Pixel.MapAtoAsize;
1359 	 break;
1360       case GL_PIXEL_MAP_B_TO_B_SIZE:
1361 	 *params = (GLdouble) ctx->Pixel.MapBtoBsize;
1362 	 break;
1363       case GL_PIXEL_MAP_G_TO_G_SIZE:
1364 	 *params = (GLdouble) ctx->Pixel.MapGtoGsize;
1365 	 break;
1366       case GL_PIXEL_MAP_I_TO_A_SIZE:
1367 	 *params = (GLdouble) ctx->Pixel.MapItoAsize;
1368 	 break;
1369       case GL_PIXEL_MAP_I_TO_B_SIZE:
1370 	 *params = (GLdouble) ctx->Pixel.MapItoBsize;
1371 	 break;
1372       case GL_PIXEL_MAP_I_TO_G_SIZE:
1373 	 *params = (GLdouble) ctx->Pixel.MapItoGsize;
1374 	 break;
1375       case GL_PIXEL_MAP_I_TO_I_SIZE:
1376 	 *params = (GLdouble) ctx->Pixel.MapItoIsize;
1377 	 break;
1378       case GL_PIXEL_MAP_I_TO_R_SIZE:
1379 	 *params = (GLdouble) ctx->Pixel.MapItoRsize;
1380 	 break;
1381       case GL_PIXEL_MAP_R_TO_R_SIZE:
1382 	 *params = (GLdouble) ctx->Pixel.MapRtoRsize;
1383 	 break;
1384       case GL_PIXEL_MAP_S_TO_S_SIZE:
1385 	 *params = (GLdouble) ctx->Pixel.MapStoSsize;
1386 	 break;
1387       case GL_POINT_SIZE:
1388          *params = (GLdouble) ctx->Point.Size;
1389          break;
1390       case GL_POINT_SIZE_GRANULARITY:
1391 	 *params = (GLdouble) POINT_SIZE_GRANULARITY;
1392 	 break;
1393       case GL_POINT_SIZE_RANGE:
1394 	 params[0] = (GLdouble) MIN_POINT_SIZE;
1395 	 params[1] = (GLdouble) MAX_POINT_SIZE;
1396 	 break;
1397       case GL_POINT_SMOOTH:
1398 	 *params = (GLdouble) ctx->Point.SmoothFlag;
1399 	 break;
1400       case GL_POINT_SMOOTH_HINT:
1401 	 *params = ENUM_TO_DOUBLE(ctx->Hint.PointSmooth);
1402 	 break;
1403       case GL_POLYGON_MODE:
1404 	 params[0] = ENUM_TO_DOUBLE(ctx->Polygon.FrontMode);
1405 	 params[1] = ENUM_TO_DOUBLE(ctx->Polygon.BackMode);
1406 	 break;
1407 #ifdef GL_EXT_polygon_offset
1408       case GL_POLYGON_OFFSET_BIAS_EXT:
1409          *params = (GLdouble) ctx->Polygon.OffsetUnits;
1410          break;
1411 #endif
1412       case GL_POLYGON_OFFSET_FACTOR:
1413          *params = (GLdouble) ctx->Polygon.OffsetFactor;
1414          break;
1415       case GL_POLYGON_OFFSET_UNITS:
1416          *params = (GLdouble) ctx->Polygon.OffsetUnits;
1417          break;
1418       case GL_POLYGON_SMOOTH:
1419 	 *params = (GLdouble) ctx->Polygon.SmoothFlag;
1420 	 break;
1421       case GL_POLYGON_SMOOTH_HINT:
1422 	 *params = ENUM_TO_DOUBLE(ctx->Hint.PolygonSmooth);
1423 	 break;
1424       case GL_POLYGON_STIPPLE:
1425 	 for (i=0;i<32;i++) {		/* RIGHT? */
1426 	    params[i] = (GLdouble) ctx->PolygonStipple[i];
1427 	 }
1428 	 break;
1429       case GL_PROJECTION_MATRIX:
1430 	 for (i=0;i<16;i++) {
1431 	    params[i] = (GLdouble) ctx->ProjectionMatrix[i];
1432 	 }
1433 	 break;
1434       case GL_PROJECTION_STACK_DEPTH:
1435 	 *params = (GLdouble) ctx->ProjectionStackDepth;
1436 	 break;
1437       case GL_READ_BUFFER:
1438 	 *params = ENUM_TO_DOUBLE(ctx->Pixel.ReadBuffer);
1439 	 break;
1440       case GL_RED_BIAS:
1441          *params = (GLdouble) ctx->Pixel.RedBias;
1442          break;
1443       case GL_RED_BITS:
1444          *params = (GLdouble) ctx->Visual->RedBits;
1445          break;
1446       case GL_RED_SCALE:
1447          *params = (GLdouble) ctx->Pixel.RedScale;
1448          break;
1449       case GL_RENDER_MODE:
1450 	 *params = ENUM_TO_DOUBLE(ctx->RenderMode);
1451 	 break;
1452       case GL_RGBA_MODE:
1453 	 *params = (GLdouble) ctx->Visual->RGBAflag;
1454 	 break;
1455       case GL_SCISSOR_BOX:
1456 	 params[0] = (GLdouble) ctx->Scissor.X;
1457 	 params[1] = (GLdouble) ctx->Scissor.Y;
1458 	 params[2] = (GLdouble) ctx->Scissor.Width;
1459 	 params[3] = (GLdouble) ctx->Scissor.Height;
1460 	 break;
1461       case GL_SCISSOR_TEST:
1462 	 *params = (GLdouble) ctx->Scissor.Enabled;
1463 	 break;
1464       case GL_SHADE_MODEL:
1465 	 *params = ENUM_TO_DOUBLE(ctx->Light.ShadeModel);
1466 	 break;
1467       case GL_STENCIL_BITS:
1468          *params = (GLdouble) ctx->Visual->StencilBits;
1469          break;
1470       case GL_STENCIL_CLEAR_VALUE:
1471 	 *params = (GLdouble) ctx->Stencil.Clear;
1472 	 break;
1473       case GL_STENCIL_FAIL:
1474 	 *params = ENUM_TO_DOUBLE(ctx->Stencil.FailFunc);
1475 	 break;
1476       case GL_STENCIL_FUNC:
1477 	 *params = ENUM_TO_DOUBLE(ctx->Stencil.Function);
1478 	 break;
1479       case GL_STENCIL_PASS_DEPTH_FAIL:
1480 	 *params = ENUM_TO_DOUBLE(ctx->Stencil.ZFailFunc);
1481 	 break;
1482       case GL_STENCIL_PASS_DEPTH_PASS:
1483 	 *params = ENUM_TO_DOUBLE(ctx->Stencil.ZPassFunc);
1484 	 break;
1485       case GL_STENCIL_REF:
1486 	 *params = (GLdouble) ctx->Stencil.Ref;
1487 	 break;
1488       case GL_STENCIL_TEST:
1489 	 *params = (GLdouble) ctx->Stencil.Enabled;
1490 	 break;
1491       case GL_STENCIL_VALUE_MASK:
1492 	 *params = (GLdouble) ctx->Stencil.ValueMask;
1493 	 break;
1494       case GL_STENCIL_WRITEMASK:
1495 	 *params = (GLdouble) ctx->Stencil.WriteMask;
1496 	 break;
1497       case GL_STEREO:
1498 	 *params = 0.0;   /* TODO */
1499 	 break;
1500       case GL_SUBPIXEL_BITS:
1501 	 *params = 0.0;   /* TODO */
1502 	 break;
1503       case GL_TEXTURE_1D:
1504 	 *params = (ctx->Texture.Enabled & TEXTURE_1D) ? 1.0 : 0.0;
1505 	 break;
1506       case GL_TEXTURE_2D:
1507 	 *params = (ctx->Texture.Enabled & TEXTURE_2D) ? 1.0 : 0.0;
1508 	 break;
1509       case GL_TEXTURE_ENV_COLOR:
1510 	 params[0] = (GLdouble) ctx->Texture.EnvColor[0];
1511 	 params[1] = (GLdouble) ctx->Texture.EnvColor[1];
1512 	 params[2] = (GLdouble) ctx->Texture.EnvColor[2];
1513 	 params[3] = (GLdouble) ctx->Texture.EnvColor[3];
1514 	 break;
1515       case GL_TEXTURE_ENV_MODE:
1516 	 *params = ENUM_TO_DOUBLE(ctx->Texture.EnvMode);
1517 	 break;
1518       case GL_TEXTURE_GEN_S:
1519 	 *params = (ctx->Texture.TexGenEnabled & S_BIT) ? 1.0 : 0.0;
1520 	 break;
1521       case GL_TEXTURE_GEN_T:
1522 	 *params = (ctx->Texture.TexGenEnabled & T_BIT) ? 1.0 : 0.0;
1523 	 break;
1524       case GL_TEXTURE_GEN_R:
1525 	 *params = (ctx->Texture.TexGenEnabled & R_BIT) ? 1.0 : 0.0;
1526 	 break;
1527       case GL_TEXTURE_GEN_Q:
1528 	 *params = (ctx->Texture.TexGenEnabled & Q_BIT) ? 1.0 : 0.0;
1529 	 break;
1530       case GL_TEXTURE_MATRIX:
1531          for (i=0;i<16;i++) {
1532 	    params[i] = (GLdouble) ctx->TextureMatrix[i];
1533 	 }
1534 	 break;
1535       case GL_TEXTURE_STACK_DEPTH:
1536 	 *params = (GLdouble) ctx->TextureStackDepth;
1537 	 break;
1538       case GL_UNPACK_ALIGNMENT:
1539 	 *params = (GLdouble) ctx->Unpack.Alignment;
1540 	 break;
1541       case GL_UNPACK_LSB_FIRST:
1542 	 *params = (GLdouble) ctx->Unpack.LsbFirst;
1543 	 break;
1544       case GL_UNPACK_ROW_LENGTH:
1545 	 *params = (GLdouble) ctx->Unpack.RowLength;
1546 	 break;
1547       case GL_UNPACK_SKIP_PIXELS:
1548 	 *params = (GLdouble) ctx->Unpack.SkipPixels;
1549 	 break;
1550       case GL_UNPACK_SKIP_ROWS:
1551 	 *params = (GLdouble) ctx->Unpack.SkipRows;
1552 	 break;
1553       case GL_UNPACK_SWAP_BYTES:
1554 	 *params = (GLdouble) ctx->Unpack.SwapBytes;
1555 	 break;
1556       case GL_VIEWPORT:
1557 	 params[0] = (GLdouble) ctx->Viewport.X;
1558 	 params[1] = (GLdouble) ctx->Viewport.Y;
1559 	 params[2] = (GLdouble) ctx->Viewport.Width;
1560 	 params[3] = (GLdouble) ctx->Viewport.Height;
1561 	 break;
1562       case GL_ZOOM_X:
1563 	 *params = (GLdouble) ctx->Pixel.ZoomX;
1564 	 break;
1565       case GL_ZOOM_Y:
1566 	 *params = (GLdouble) ctx->Pixel.ZoomY;
1567 	 break;
1568       case GL_VERTEX_ARRAY_SIZE:
1569          *params = (GLdouble) ctx->Array.VertexSize;
1570          break;
1571       case GL_VERTEX_ARRAY_TYPE:
1572          *params = ENUM_TO_DOUBLE(ctx->Array.VertexType);
1573          break;
1574       case GL_VERTEX_ARRAY_STRIDE:
1575          *params = (GLdouble) ctx->Array.VertexStride;
1576          break;
1577       case GL_VERTEX_ARRAY_COUNT_EXT:
1578          *params = 0.0;
1579          break;
1580       case GL_NORMAL_ARRAY_TYPE:
1581          *params = ENUM_TO_DOUBLE(ctx->Array.NormalType);
1582          break;
1583       case GL_NORMAL_ARRAY_STRIDE:
1584          *params = (GLdouble) ctx->Array.NormalStride;
1585          break;
1586       case GL_NORMAL_ARRAY_COUNT_EXT:
1587          *params = 0.0;
1588          break;
1589       case GL_COLOR_ARRAY_SIZE:
1590          *params = (GLdouble) ctx->Array.ColorSize;
1591          break;
1592       case GL_COLOR_ARRAY_TYPE:
1593          *params = ENUM_TO_DOUBLE(ctx->Array.ColorType);
1594          break;
1595       case GL_COLOR_ARRAY_STRIDE:
1596          *params = (GLdouble) ctx->Array.ColorStride;
1597          break;
1598       case GL_COLOR_ARRAY_COUNT_EXT:
1599          *params = 0.0;
1600          break;
1601       case GL_INDEX_ARRAY_TYPE:
1602          *params = ENUM_TO_DOUBLE(ctx->Array.IndexType);
1603          break;
1604       case GL_INDEX_ARRAY_STRIDE:
1605          *params = (GLdouble) ctx->Array.IndexStride;
1606          break;
1607       case GL_INDEX_ARRAY_COUNT_EXT:
1608          *params = 0.0;
1609          break;
1610       case GL_TEXTURE_COORD_ARRAY_SIZE:
1611          *params = (GLdouble) ctx->Array.TexCoordSize;
1612          break;
1613       case GL_TEXTURE_COORD_ARRAY_TYPE:
1614          *params = ENUM_TO_DOUBLE(ctx->Array.TexCoordType);
1615          break;
1616       case GL_TEXTURE_COORD_ARRAY_STRIDE:
1617          *params = (GLdouble) ctx->Array.TexCoordStride;
1618          break;
1619       case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
1620          *params = 0.0;
1621          break;
1622       case GL_EDGE_FLAG_ARRAY_STRIDE:
1623          *params = (GLdouble) ctx->Array.EdgeFlagStride;
1624          break;
1625       case GL_EDGE_FLAG_ARRAY_COUNT_EXT:
1626          *params = 0.0;
1627          break;
1628       case GL_TEXTURE_BINDING_1D:
1629          *params = (GLdouble) ctx->Texture.Current1D->Name;
1630           break;
1631       case GL_TEXTURE_BINDING_2D:
1632          *params = (GLdouble) ctx->Texture.Current2D->Name;
1633           break;
1634 
1635       default:
1636          gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" );
1637    }
1638 }
1639 
1640 
1641 
1642 
1643 void gl_GetFloatv( GLcontext *ctx, GLenum pname, GLfloat *params )
1644 {
1645    GLuint i;
1646 
1647    if (INSIDE_BEGIN_END(ctx)) {
1648       gl_error( ctx, GL_INVALID_OPERATION, "glGetFloatv" );
1649       return;
1650    }
1651    switch (pname) {
1652       case GL_ACCUM_RED_BITS:
1653       case GL_ACCUM_GREEN_BITS:
1654       case GL_ACCUM_BLUE_BITS:
1655       case GL_ACCUM_ALPHA_BITS:
1656          *params = (GLfloat) ctx->Visual->AccumBits;
1657          break;
1658       case GL_ACCUM_CLEAR_VALUE:
1659          params[0] = ctx->Accum.ClearColor[0];
1660          params[1] = ctx->Accum.ClearColor[1];
1661          params[2] = ctx->Accum.ClearColor[2];
1662          params[3] = ctx->Accum.ClearColor[3];
1663          break;
1664       case GL_ALPHA_BIAS:
1665          *params = ctx->Pixel.AlphaBias;
1666          break;
1667       case GL_ALPHA_BITS:
1668          *params = (GLfloat) ctx->Visual->AlphaBits;
1669          break;
1670       case GL_ALPHA_SCALE:
1671          *params = ctx->Pixel.AlphaScale;
1672          break;
1673       case GL_ALPHA_TEST:
1674          *params = (GLfloat) ctx->Color.AlphaEnabled;
1675          break;
1676       case GL_ALPHA_TEST_FUNC:
1677          *params = ENUM_TO_FLOAT(ctx->Color.AlphaFunc);
1678          break;
1679       case GL_ALPHA_TEST_REF:
1680          *params = (GLfloat) ctx->Color.AlphaRef;
1681          break;
1682       case GL_ATTRIB_STACK_DEPTH:
1683          *params = (GLfloat ) ctx->AttribStackDepth;
1684          break;
1685       case GL_AUTO_NORMAL:
1686          *params = (GLfloat) ctx->Eval.AutoNormal;
1687          break;
1688       case GL_AUX_BUFFERS:
1689          *params = (GLfloat) NUM_AUX_BUFFERS;
1690          break;
1691       case GL_BLEND:
1692          *params = (GLfloat) ctx->Color.BlendEnabled;
1693          break;
1694       case GL_BLEND_DST:
1695          *params = ENUM_TO_FLOAT(ctx->Color.BlendDst);
1696          break;
1697       case GL_BLEND_SRC:
1698          *params = ENUM_TO_FLOAT(ctx->Color.BlendSrc);
1699          break;
1700       case GL_BLUE_BIAS:
1701          *params = ctx->Pixel.BlueBias;
1702          break;
1703       case GL_BLUE_BITS:
1704          *params = (GLfloat) ctx->Visual->BlueBits;
1705          break;
1706       case GL_BLUE_SCALE:
1707          *params = ctx->Pixel.BlueScale;
1708          break;
1709       case GL_CLIENT_ATTRIB_STACK_DEPTH:
1710          *params = (GLfloat) ctx->ClientAttribStackDepth;
1711          break;
1712       case GL_CLIP_PLANE0:
1713       case GL_CLIP_PLANE1:
1714       case GL_CLIP_PLANE2:
1715       case GL_CLIP_PLANE3:
1716       case GL_CLIP_PLANE4:
1717       case GL_CLIP_PLANE5:
1718          *params = (GLfloat) ctx->Transform.ClipEnabled[pname-GL_CLIP_PLANE0];
1719          break;
1720       case GL_COLOR_CLEAR_VALUE:
1721          params[0] = (GLfloat) ctx->Color.ClearColor[0];
1722          params[1] = (GLfloat) ctx->Color.ClearColor[1];
1723          params[2] = (GLfloat) ctx->Color.ClearColor[2];
1724          params[3] = (GLfloat) ctx->Color.ClearColor[3];
1725          break;
1726       case GL_COLOR_MATERIAL:
1727          *params = (GLfloat) ctx->Light.ColorMaterialEnabled;
1728          break;
1729       case GL_COLOR_MATERIAL_FACE:
1730          *params = ENUM_TO_FLOAT(ctx->Light.ColorMaterialFace);
1731          break;
1732       case GL_COLOR_MATERIAL_PARAMETER:
1733          *params = ENUM_TO_FLOAT(ctx->Light.ColorMaterialMode);
1734          break;
1735       case GL_COLOR_WRITEMASK:
1736          params[0] = (ctx->Color.ColorMask & 8) ? 1.0F : 0.0F;
1737          params[1] = (ctx->Color.ColorMask & 4) ? 1.0F : 0.0F;
1738          params[2] = (ctx->Color.ColorMask & 2) ? 1.0F : 0.0F;
1739          params[3] = (ctx->Color.ColorMask & 1) ? 1.0F : 0.0F;
1740          break;
1741       case GL_CULL_FACE:
1742          *params = (GLfloat) ctx->Polygon.CullFlag;
1743          break;
1744       case GL_CULL_FACE_MODE:
1745          *params = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode);
1746          break;
1747       case GL_CURRENT_COLOR:
1748          params[0] = ctx->Current.ByteColor[0] * ctx->Visual->InvRedScale;
1749          params[1] = ctx->Current.ByteColor[1] * ctx->Visual->InvGreenScale;
1750          params[2] = ctx->Current.ByteColor[2] * ctx->Visual->InvBlueScale;
1751          params[3] = ctx->Current.ByteColor[3] * ctx->Visual->InvAlphaScale;
1752          break;
1753       case GL_CURRENT_INDEX:
1754          *params = (GLfloat) ctx->Current.Index;
1755          break;
1756       case GL_CURRENT_NORMAL:
1757          params[0] = ctx->Current.Normal[0];
1758          params[1] = ctx->Current.Normal[1];
1759          params[2] = ctx->Current.Normal[2];
1760          break;
1761       case GL_CURRENT_RASTER_COLOR:
1762 	 params[0] = ctx->Current.RasterColor[0];
1763 	 params[1] = ctx->Current.RasterColor[1];
1764 	 params[2] = ctx->Current.RasterColor[2];
1765 	 params[3] = ctx->Current.RasterColor[3];
1766 	 break;
1767       case GL_CURRENT_RASTER_DISTANCE:
1768 	 params[0] = ctx->Current.RasterDistance;
1769 	 break;
1770       case GL_CURRENT_RASTER_INDEX:
1771 	 *params = (GLfloat) ctx->Current.RasterIndex;
1772 	 break;
1773       case GL_CURRENT_RASTER_POSITION:
1774 	 params[0] = ctx->Current.RasterPos[0];
1775 	 params[1] = ctx->Current.RasterPos[1];
1776 	 params[2] = ctx->Current.RasterPos[2];
1777 	 params[3] = ctx->Current.RasterPos[3];
1778 	 break;
1779       case GL_CURRENT_RASTER_TEXTURE_COORDS:
1780 	 params[0] = ctx->Current.RasterTexCoord[0];
1781 	 params[1] = ctx->Current.RasterTexCoord[1];
1782 	 params[2] = ctx->Current.RasterTexCoord[2];
1783 	 params[3] = ctx->Current.RasterTexCoord[3];
1784 	 break;
1785       case GL_CURRENT_RASTER_POSITION_VALID:
1786 	 *params = (GLfloat) ctx->Current.RasterPosValid;
1787 	 break;
1788       case GL_CURRENT_TEXTURE_COORDS:
1789 	 params[0] = (GLfloat) ctx->Current.TexCoord[0];
1790 	 params[1] = (GLfloat) ctx->Current.TexCoord[1];
1791 	 params[2] = (GLfloat) ctx->Current.TexCoord[2];
1792 	 params[3] = (GLfloat) ctx->Current.TexCoord[3];
1793 	 break;
1794       case GL_DEPTH_BIAS:
1795 	 *params = (GLfloat) ctx->Pixel.DepthBias;
1796 	 break;
1797       case GL_DEPTH_BITS:
1798 	 *params = (GLfloat) ctx->Visual->DepthBits;
1799 	 break;
1800       case GL_DEPTH_CLEAR_VALUE:
1801 	 *params = (GLfloat) ctx->Depth.Clear;
1802 	 break;
1803       case GL_DEPTH_FUNC:
1804 	 *params = ENUM_TO_FLOAT(ctx->Depth.Func);
1805 	 break;
1806       case GL_DEPTH_RANGE:
1807          params[0] = (GLfloat) ctx->Viewport.Near;
1808          params[1] = (GLfloat) ctx->Viewport.Far;
1809 	 break;
1810       case GL_DEPTH_SCALE:
1811 	 *params = (GLfloat) ctx->Pixel.DepthScale;
1812 	 break;
1813       case GL_DEPTH_TEST:
1814 	 *params = (GLfloat) ctx->Depth.Test;
1815 	 break;
1816       case GL_DEPTH_WRITEMASK:
1817 	 *params = (GLfloat) ctx->Depth.Mask;
1818 	 break;
1819       case GL_DITHER:
1820 	 *params = (GLfloat) ctx->Color.DitherFlag;
1821 	 break;
1822       case GL_DOUBLEBUFFER:
1823 	 *params = (GLfloat) ctx->Visual->DBflag;
1824 	 break;
1825       case GL_DRAW_BUFFER:
1826 	 *params = ENUM_TO_FLOAT(ctx->Color.DrawBuffer);
1827 	 break;
1828       case GL_EDGE_FLAG:
1829 	 *params = (GLfloat) ctx->Current.EdgeFlag;
1830 	 break;
1831       case GL_FEEDBACK_BUFFER_SIZE:
1832          /* TODO: is this right?  Or, return number of entries in buffer? */
1833          *params = (GLfloat) ctx->Feedback.BufferSize;
1834          break;
1835       case GL_FEEDBACK_BUFFER_TYPE:
1836          *params = ENUM_TO_FLOAT(ctx->Feedback.Type);
1837          break;
1838       case GL_FOG:
1839 	 *params = (GLfloat) ctx->Fog.Enabled;
1840 	 break;
1841       case GL_FOG_COLOR:
1842 	 params[0] = ctx->Fog.Color[0];
1843 	 params[1] = ctx->Fog.Color[1];
1844 	 params[2] = ctx->Fog.Color[2];
1845 	 params[3] = ctx->Fog.Color[3];
1846 	 break;
1847       case GL_FOG_DENSITY:
1848 	 *params = ctx->Fog.Density;
1849 	 break;
1850       case GL_FOG_END:
1851 	 *params = ctx->Fog.End;
1852 	 break;
1853       case GL_FOG_HINT:
1854 	 *params = ENUM_TO_FLOAT(ctx->Hint.Fog);
1855 	 break;
1856       case GL_FOG_INDEX:
1857 	 *params = ctx->Fog.Index;
1858 	 break;
1859       case GL_FOG_MODE:
1860 	 *params = ENUM_TO_FLOAT(ctx->Fog.Mode);
1861 	 break;
1862       case GL_FOG_START:
1863 	 *params = ctx->Fog.Start;
1864 	 break;
1865       case GL_FRONT_FACE:
1866 	 *params = ENUM_TO_FLOAT(ctx->Polygon.FrontFace);
1867 	 break;
1868       case GL_GREEN_BIAS:
1869          *params = (GLfloat) ctx->Pixel.GreenBias;
1870          break;
1871       case GL_GREEN_BITS:
1872          *params = (GLfloat) ctx->Visual->GreenBits;
1873          break;
1874       case GL_GREEN_SCALE:
1875          *params = (GLfloat) ctx->Pixel.GreenScale;
1876          break;
1877       case GL_INDEX_BITS:
1878          *params = (GLfloat) ctx->Visual->IndexBits;
1879 	 break;
1880       case GL_INDEX_CLEAR_VALUE:
1881          *params = (GLfloat) ctx->Color.ClearIndex;
1882 	 break;
1883       case GL_INDEX_MODE:
1884 	 *params = ctx->Visual->RGBAflag ? 0.0F : 1.0F;
1885 	 break;
1886       case GL_INDEX_OFFSET:
1887 	 *params = (GLfloat) ctx->Pixel.IndexOffset;
1888 	 break;
1889       case GL_INDEX_SHIFT:
1890 	 *params = (GLfloat) ctx->Pixel.IndexShift;
1891 	 break;
1892       case GL_INDEX_WRITEMASK:
1893 	 *params = (GLfloat) ctx->Color.IndexMask;
1894 	 break;
1895       case GL_LIGHT0:
1896       case GL_LIGHT1:
1897       case GL_LIGHT2:
1898       case GL_LIGHT3:
1899       case GL_LIGHT4:
1900       case GL_LIGHT5:
1901       case GL_LIGHT6:
1902       case GL_LIGHT7:
1903 	 *params = (GLfloat) ctx->Light.Light[pname-GL_LIGHT0].Enabled;
1904 	 break;
1905       case GL_LIGHTING:
1906 	 *params = (GLfloat) ctx->Light.Enabled;
1907 	 break;
1908       case GL_LIGHT_MODEL_AMBIENT:
1909 	 params[0] = ctx->Light.Model.Ambient[0];
1910 	 params[1] = ctx->Light.Model.Ambient[1];
1911 	 params[2] = ctx->Light.Model.Ambient[2];
1912 	 params[3] = ctx->Light.Model.Ambient[3];
1913 	 break;
1914       case GL_LIGHT_MODEL_LOCAL_VIEWER:
1915 	 *params = (GLfloat) ctx->Light.Model.LocalViewer;
1916 	 break;
1917       case GL_LIGHT_MODEL_TWO_SIDE:
1918 	 *params = (GLfloat) ctx->Light.Model.TwoSide;
1919 	 break;
1920       case GL_LINE_SMOOTH:
1921 	 *params = (GLfloat) ctx->Line.SmoothFlag;
1922 	 break;
1923       case GL_LINE_SMOOTH_HINT:
1924 	 *params = ENUM_TO_FLOAT(ctx->Hint.LineSmooth);
1925 	 break;
1926       case GL_LINE_STIPPLE:
1927 	 *params = (GLfloat) ctx->Line.StippleFlag;
1928 	 break;
1929       case GL_LINE_STIPPLE_PATTERN:
1930          *params = (GLfloat) ctx->Line.StipplePattern;
1931          break;
1932       case GL_LINE_STIPPLE_REPEAT:
1933          *params = (GLfloat) ctx->Line.StippleFactor;
1934          break;
1935       case GL_LINE_WIDTH:
1936 	 *params = (GLfloat) ctx->Line.Width;
1937 	 break;
1938       case GL_LINE_WIDTH_GRANULARITY:
1939 	 *params = (GLfloat) LINE_WIDTH_GRANULARITY;
1940 	 break;
1941       case GL_LINE_WIDTH_RANGE:
1942 	 params[0] = (GLfloat) MIN_LINE_WIDTH;
1943 	 params[1] = (GLfloat) MAX_LINE_WIDTH;
1944 	 break;
1945       case GL_LIST_BASE:
1946 	 *params = (GLfloat) ctx->List.ListBase;
1947 	 break;
1948       case GL_LIST_INDEX:
1949 	 *params = (GLfloat) ctx->CurrentListNum;
1950 	 break;
1951       case GL_LIST_MODE:
1952 	 *params = ctx->ExecuteFlag ? ENUM_TO_FLOAT(GL_COMPILE_AND_EXECUTE)
1953 	   			  : ENUM_TO_FLOAT(GL_COMPILE);
1954 	 break;
1955       case GL_INDEX_LOGIC_OP:
1956 	 *params = (GLfloat) ctx->Color.IndexLogicOpEnabled;
1957 	 break;
1958       case GL_COLOR_LOGIC_OP:
1959 	 *params = (GLfloat) ctx->Color.ColorLogicOpEnabled;
1960 	 break;
1961       case GL_LOGIC_OP_MODE:
1962          *params = ENUM_TO_FLOAT(ctx->Color.LogicOp);
1963 	 break;
1964       case GL_MAP1_COLOR_4:
1965 	 *params = (GLfloat) ctx->Eval.Map1Color4;
1966 	 break;
1967       case GL_MAP1_GRID_DOMAIN:
1968 	 params[0] = ctx->Eval.MapGrid1u1;
1969 	 params[1] = ctx->Eval.MapGrid1u2;
1970 	 break;
1971       case GL_MAP1_GRID_SEGMENTS:
1972 	 *params = (GLfloat) ctx->Eval.MapGrid1un;
1973 	 break;
1974       case GL_MAP1_INDEX:
1975 	 *params = (GLfloat) ctx->Eval.Map1Index;
1976 	 break;
1977       case GL_MAP1_NORMAL:
1978 	 *params = (GLfloat) ctx->Eval.Map1Normal;
1979 	 break;
1980       case GL_MAP1_TEXTURE_COORD_1:
1981 	 *params = (GLfloat) ctx->Eval.Map1TextureCoord1;
1982 	 break;
1983       case GL_MAP1_TEXTURE_COORD_2:
1984 	 *params = (GLfloat) ctx->Eval.Map1TextureCoord2;
1985 	 break;
1986       case GL_MAP1_TEXTURE_COORD_3:
1987 	 *params = (GLfloat) ctx->Eval.Map1TextureCoord3;
1988 	 break;
1989       case GL_MAP1_TEXTURE_COORD_4:
1990 	 *params = (GLfloat) ctx->Eval.Map1TextureCoord4;
1991 	 break;
1992       case GL_MAP1_VERTEX_3:
1993 	 *params = (GLfloat) ctx->Eval.Map1Vertex3;
1994 	 break;
1995       case GL_MAP1_VERTEX_4:
1996 	 *params = (GLfloat) ctx->Eval.Map1Vertex4;
1997 	 break;
1998       case GL_MAP2_COLOR_4:
1999 	 *params = (GLfloat) ctx->Eval.Map2Color4;
2000 	 break;
2001       case GL_MAP2_GRID_DOMAIN:
2002 	 params[0] = ctx->Eval.MapGrid2u1;
2003 	 params[1] = ctx->Eval.MapGrid2u2;
2004 	 params[2] = ctx->Eval.MapGrid2v1;
2005 	 params[3] = ctx->Eval.MapGrid2v2;
2006 	 break;
2007       case GL_MAP2_GRID_SEGMENTS:
2008 	 params[0] = (GLfloat) ctx->Eval.MapGrid2un;
2009 	 params[1] = (GLfloat) ctx->Eval.MapGrid2vn;
2010 	 break;
2011       case GL_MAP2_INDEX:
2012 	 *params = (GLfloat) ctx->Eval.Map2Index;
2013 	 break;
2014       case GL_MAP2_NORMAL:
2015 	 *params = (GLfloat) ctx->Eval.Map2Normal;
2016 	 break;
2017       case GL_MAP2_TEXTURE_COORD_1:
2018 	 *params = ctx->Eval.Map2TextureCoord1;
2019 	 break;
2020       case GL_MAP2_TEXTURE_COORD_2:
2021 	 *params = ctx->Eval.Map2TextureCoord2;
2022 	 break;
2023       case GL_MAP2_TEXTURE_COORD_3:
2024 	 *params = ctx->Eval.Map2TextureCoord3;
2025 	 break;
2026       case GL_MAP2_TEXTURE_COORD_4:
2027 	 *params = ctx->Eval.Map2TextureCoord4;
2028 	 break;
2029       case GL_MAP2_VERTEX_3:
2030 	 *params = (GLfloat) ctx->Eval.Map2Vertex3;
2031 	 break;
2032       case GL_MAP2_VERTEX_4:
2033 	 *params = (GLfloat) ctx->Eval.Map2Vertex4;
2034 	 break;
2035       case GL_MAP_COLOR:
2036 	 *params = (GLfloat) ctx->Pixel.MapColorFlag;
2037 	 break;
2038       case GL_MAP_STENCIL:
2039 	 *params = (GLfloat) ctx->Pixel.MapStencilFlag;
2040 	 break;
2041       case GL_MATRIX_MODE:
2042 	 *params = ENUM_TO_FLOAT(ctx->Transform.MatrixMode);
2043 	 break;
2044       case GL_MAX_ATTRIB_STACK_DEPTH:
2045 	 *params = (GLfloat) MAX_ATTRIB_STACK_DEPTH;
2046 	 break;
2047       case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
2048          *params = (GLfloat) MAX_CLIENT_ATTRIB_STACK_DEPTH;
2049          break;
2050       case GL_MAX_CLIP_PLANES:
2051 	 *params = (GLfloat) MAX_CLIP_PLANES;
2052 	 break;
2053       case GL_MAX_EVAL_ORDER:
2054 	 *params = (GLfloat) MAX_EVAL_ORDER;
2055 	 break;
2056       case GL_MAX_LIGHTS:
2057 	 *params = (GLfloat) MAX_LIGHTS;
2058 	 break;
2059       case GL_MAX_LIST_NESTING:
2060 	 *params = (GLfloat) MAX_LIST_NESTING;
2061 	 break;
2062       case GL_MAX_MODELVIEW_STACK_DEPTH:
2063 	 *params = (GLfloat) MAX_MODELVIEW_STACK_DEPTH;
2064 	 break;
2065       case GL_MAX_NAME_STACK_DEPTH:
2066 	 *params = (GLfloat) MAX_NAME_STACK_DEPTH;
2067 	 break;
2068       case GL_MAX_PIXEL_MAP_TABLE:
2069 	 *params = (GLfloat) MAX_PIXEL_MAP_TABLE;
2070 	 break;
2071       case GL_MAX_PROJECTION_STACK_DEPTH:
2072 	 *params = (GLfloat) MAX_PROJECTION_STACK_DEPTH;
2073 	 break;
2074       case GL_MAX_TEXTURE_SIZE:
2075 	 *params = (GLfloat) MAX_TEXTURE_SIZE;
2076 	 break;
2077       case GL_MAX_TEXTURE_STACK_DEPTH:
2078 	 *params = (GLfloat) MAX_TEXTURE_STACK_DEPTH;
2079 	 break;
2080       case GL_MAX_VIEWPORT_DIMS:
2081          params[0] = (GLfloat) MAX_WIDTH;
2082          params[1] = (GLfloat) MAX_HEIGHT;
2083          break;
2084       case GL_MODELVIEW_MATRIX:
2085 	 for (i=0;i<16;i++) {
2086 	    params[i] = ctx->ModelViewMatrix[i];
2087 	 }
2088 	 break;
2089       case GL_MODELVIEW_STACK_DEPTH:
2090 	 *params = (GLfloat) ctx->ModelViewStackDepth;
2091 	 break;
2092       case GL_NAME_STACK_DEPTH:
2093 	 *params = (GLfloat) ctx->Select.NameStackDepth;
2094 	 break;
2095       case GL_NORMALIZE:
2096 	 *params = (GLfloat) ctx->Transform.Normalize;
2097 	 break;
2098       case GL_PACK_ALIGNMENT:
2099 	 *params = (GLfloat) ctx->Pack.Alignment;
2100 	 break;
2101       case GL_PACK_LSB_FIRST:
2102 	 *params = (GLfloat) ctx->Pack.LsbFirst;
2103 	 break;
2104       case GL_PACK_ROW_LENGTH:
2105 	 *params = (GLfloat) ctx->Pack.RowLength;
2106 	 break;
2107       case GL_PACK_SKIP_PIXELS:
2108 	 *params = (GLfloat) ctx->Pack.SkipPixels;
2109 	 break;
2110       case GL_PACK_SKIP_ROWS:
2111 	 *params = (GLfloat) ctx->Pack.SkipRows;
2112 	 break;
2113       case GL_PACK_SWAP_BYTES:
2114 	 *params = (GLfloat) ctx->Pack.SwapBytes;
2115 	 break;
2116       case GL_PERSPECTIVE_CORRECTION_HINT:
2117 	 *params = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection);
2118 	 break;
2119       case GL_PIXEL_MAP_A_TO_A_SIZE:
2120 	 *params = (GLfloat) ctx->Pixel.MapAtoAsize;
2121 	 break;
2122       case GL_PIXEL_MAP_B_TO_B_SIZE:
2123 	 *params = (GLfloat) ctx->Pixel.MapBtoBsize;
2124 	 break;
2125       case GL_PIXEL_MAP_G_TO_G_SIZE:
2126 	 *params = (GLfloat) ctx->Pixel.MapGtoGsize;
2127 	 break;
2128       case GL_PIXEL_MAP_I_TO_A_SIZE:
2129 	 *params = (GLfloat) ctx->Pixel.MapItoAsize;
2130 	 break;
2131       case GL_PIXEL_MAP_I_TO_B_SIZE:
2132 	 *params = (GLfloat) ctx->Pixel.MapItoBsize;
2133 	 break;
2134       case GL_PIXEL_MAP_I_TO_G_SIZE:
2135 	 *params = (GLfloat) ctx->Pixel.MapItoGsize;
2136 	 break;
2137       case GL_PIXEL_MAP_I_TO_I_SIZE:
2138 	 *params = (GLfloat) ctx->Pixel.MapItoIsize;
2139 	 break;
2140       case GL_PIXEL_MAP_I_TO_R_SIZE:
2141 	 *params = (GLfloat) ctx->Pixel.MapItoRsize;
2142 	 break;
2143       case GL_PIXEL_MAP_R_TO_R_SIZE:
2144 	 *params = (GLfloat) ctx->Pixel.MapRtoRsize;
2145 	 break;
2146       case GL_PIXEL_MAP_S_TO_S_SIZE:
2147 	 *params = (GLfloat) ctx->Pixel.MapStoSsize;
2148 	 break;
2149       case GL_POINT_SIZE:
2150          *params = (GLfloat) ctx->Point.Size;
2151          break;
2152       case GL_POINT_SIZE_GRANULARITY:
2153 	 *params = (GLfloat) POINT_SIZE_GRANULARITY;
2154 	 break;
2155       case GL_POINT_SIZE_RANGE:
2156 	 params[0] = (GLfloat) MIN_POINT_SIZE;
2157 	 params[1] = (GLfloat) MAX_POINT_SIZE;
2158 	 break;
2159       case GL_POINT_SMOOTH:
2160 	 *params = (GLfloat) ctx->Point.SmoothFlag;
2161 	 break;
2162       case GL_POINT_SMOOTH_HINT:
2163 	 *params = ENUM_TO_FLOAT(ctx->Hint.PointSmooth);
2164 	 break;
2165       case GL_POLYGON_MODE:
2166 	 params[0] = ENUM_TO_FLOAT(ctx->Polygon.FrontMode);
2167 	 params[1] = ENUM_TO_FLOAT(ctx->Polygon.BackMode);
2168 	 break;
2169 #ifdef GL_EXT_polygon_offset
2170       case GL_POLYGON_OFFSET_BIAS_EXT:
2171          *params = ctx->Polygon.OffsetUnits;
2172          break;
2173 #endif
2174       case GL_POLYGON_OFFSET_FACTOR:
2175          *params = ctx->Polygon.OffsetFactor;
2176          break;
2177       case GL_POLYGON_OFFSET_UNITS:
2178          *params = ctx->Polygon.OffsetUnits;
2179          break;
2180       case GL_POLYGON_SMOOTH:
2181 	 *params = (GLfloat) ctx->Polygon.SmoothFlag;
2182 	 break;
2183       case GL_POLYGON_SMOOTH_HINT:
2184 	 *params = ENUM_TO_FLOAT(ctx->Hint.PolygonSmooth);
2185 	 break;
2186       case GL_POLYGON_STIPPLE:
2187 	 for (i=0;i<32;i++) {		/* RIGHT? */
2188 	    params[i] = (GLfloat) ctx->PolygonStipple[i];
2189 	 }
2190 	 break;
2191       case GL_PROJECTION_MATRIX:
2192 	 for (i=0;i<16;i++) {
2193 	    params[i] = ctx->ProjectionMatrix[i];
2194 	 }
2195 	 break;
2196       case GL_PROJECTION_STACK_DEPTH:
2197 	 *params = (GLfloat) ctx->ProjectionStackDepth;
2198 	 break;
2199       case GL_READ_BUFFER:
2200 	 *params = ENUM_TO_FLOAT(ctx->Pixel.ReadBuffer);
2201 	 break;
2202       case GL_RED_BIAS:
2203          *params = ctx->Pixel.RedBias;
2204          break;
2205       case GL_RED_BITS:
2206          *params = (GLfloat) ctx->Visual->RedBits;
2207          break;
2208       case GL_RED_SCALE:
2209          *params = ctx->Pixel.RedScale;
2210          break;
2211       case GL_RENDER_MODE:
2212 	 *params = ENUM_TO_FLOAT(ctx->RenderMode);
2213 	 break;
2214       case GL_RGBA_MODE:
2215 	 *params = (GLfloat) ctx->Visual->RGBAflag;
2216 	 break;
2217       case GL_SCISSOR_BOX:
2218 	 params[0] = (GLfloat) ctx->Scissor.X;
2219 	 params[1] = (GLfloat) ctx->Scissor.Y;
2220 	 params[2] = (GLfloat) ctx->Scissor.Width;
2221 	 params[3] = (GLfloat) ctx->Scissor.Height;
2222 	 break;
2223       case GL_SCISSOR_TEST:
2224 	 *params = (GLfloat) ctx->Scissor.Enabled;
2225 	 break;
2226       case GL_SHADE_MODEL:
2227 	 *params = ENUM_TO_FLOAT(ctx->Light.ShadeModel);
2228 	 break;
2229       case GL_STENCIL_BITS:
2230          *params = (GLfloat) ctx->Visual->StencilBits;
2231          break;
2232       case GL_STENCIL_CLEAR_VALUE:
2233 	 *params = (GLfloat) ctx->Stencil.Clear;
2234 	 break;
2235       case GL_STENCIL_FAIL:
2236 	 *params = ENUM_TO_FLOAT(ctx->Stencil.FailFunc);
2237 	 break;
2238       case GL_STENCIL_FUNC:
2239 	 *params = ENUM_TO_FLOAT(ctx->Stencil.Function);
2240 	 break;
2241       case GL_STENCIL_PASS_DEPTH_FAIL:
2242 	 *params = ENUM_TO_FLOAT(ctx->Stencil.ZFailFunc);
2243 	 break;
2244       case GL_STENCIL_PASS_DEPTH_PASS:
2245 	 *params = ENUM_TO_FLOAT(ctx->Stencil.ZPassFunc);
2246 	 break;
2247       case GL_STENCIL_REF:
2248 	 *params = (GLfloat) ctx->Stencil.Ref;
2249 	 break;
2250       case GL_STENCIL_TEST:
2251 	 *params = (GLfloat) ctx->Stencil.Enabled;
2252 	 break;
2253       case GL_STENCIL_VALUE_MASK:
2254 	 *params = (GLfloat) ctx->Stencil.ValueMask;
2255 	 break;
2256       case GL_STENCIL_WRITEMASK:
2257 	 *params = (GLfloat) ctx->Stencil.WriteMask;
2258 	 break;
2259       case GL_STEREO:
2260 	 *params = 0.0F;  /* TODO */
2261 	 break;
2262       case GL_SUBPIXEL_BITS:
2263 	 *params = 0.0F;  /* TODO */
2264 	 break;
2265       case GL_TEXTURE_1D:
2266 	 *params = (ctx->Texture.Enabled & TEXTURE_1D) ? 1.0 : 0.0;
2267 	 break;
2268       case GL_TEXTURE_2D:
2269 	 *params = (ctx->Texture.Enabled & TEXTURE_2D) ? 1.0 : 0.0;
2270 	 break;
2271       case GL_TEXTURE_ENV_COLOR:
2272 	 params[0] = ctx->Texture.EnvColor[0];
2273 	 params[1] = ctx->Texture.EnvColor[1];
2274 	 params[2] = ctx->Texture.EnvColor[2];
2275 	 params[3] = ctx->Texture.EnvColor[3];
2276 	 break;
2277       case GL_TEXTURE_ENV_MODE:
2278 	 *params = ENUM_TO_FLOAT(ctx->Texture.EnvMode);
2279 	 break;
2280       case GL_TEXTURE_GEN_S:
2281 	 *params = (ctx->Texture.TexGenEnabled & S_BIT) ? 1.0 : 0.0;
2282 	 break;
2283       case GL_TEXTURE_GEN_T:
2284 	 *params = (ctx->Texture.TexGenEnabled & T_BIT) ? 1.0 : 0.0;
2285 	 break;
2286       case GL_TEXTURE_GEN_R:
2287 	 *params = (ctx->Texture.TexGenEnabled & R_BIT) ? 1.0 : 0.0;
2288 	 break;
2289       case GL_TEXTURE_GEN_Q:
2290 	 *params = (ctx->Texture.TexGenEnabled & Q_BIT) ? 1.0 : 0.0;
2291 	 break;
2292       case GL_TEXTURE_MATRIX:
2293          for (i=0;i<16;i++) {
2294 	    params[i] = ctx->TextureMatrix[i];
2295 	 }
2296 	 break;
2297       case GL_TEXTURE_STACK_DEPTH:
2298 	 *params = (GLfloat) ctx->TextureStackDepth;
2299 	 break;
2300       case GL_UNPACK_ALIGNMENT:
2301 	 *params = (GLfloat) ctx->Unpack.Alignment;
2302 	 break;
2303       case GL_UNPACK_LSB_FIRST:
2304 	 *params = (GLfloat) ctx->Unpack.LsbFirst;
2305 	 break;
2306       case GL_UNPACK_ROW_LENGTH:
2307 	 *params = (GLfloat) ctx->Unpack.RowLength;
2308 	 break;
2309       case GL_UNPACK_SKIP_PIXELS:
2310 	 *params = (GLfloat) ctx->Unpack.SkipPixels;
2311 	 break;
2312       case GL_UNPACK_SKIP_ROWS:
2313 	 *params = (GLfloat) ctx->Unpack.SkipRows;
2314 	 break;
2315       case GL_UNPACK_SWAP_BYTES:
2316 	 *params = (GLfloat) ctx->Unpack.SwapBytes;
2317 	 break;
2318       case GL_VIEWPORT:
2319 	 params[0] = (GLfloat) ctx->Viewport.X;
2320 	 params[1] = (GLfloat) ctx->Viewport.Y;
2321 	 params[2] = (GLfloat) ctx->Viewport.Width;
2322 	 params[3] = (GLfloat) ctx->Viewport.Height;
2323 	 break;
2324       case GL_ZOOM_X:
2325 	 *params = (GLfloat) ctx->Pixel.ZoomX;
2326 	 break;
2327       case GL_ZOOM_Y:
2328 	 *params = (GLfloat) ctx->Pixel.ZoomY;
2329 	 break;
2330       case GL_VERTEX_ARRAY_SIZE:
2331          *params = (GLfloat) ctx->Array.VertexSize;
2332          break;
2333       case GL_VERTEX_ARRAY_TYPE:
2334          *params = ENUM_TO_FLOAT(ctx->Array.VertexType);
2335          break;
2336       case GL_VERTEX_ARRAY_STRIDE:
2337          *params = (GLfloat) ctx->Array.VertexStride;
2338          break;
2339       case GL_VERTEX_ARRAY_COUNT_EXT:
2340          *params = 0.0;
2341          break;
2342       case GL_NORMAL_ARRAY_TYPE:
2343          *params = ENUM_TO_FLOAT(ctx->Array.NormalType);
2344          break;
2345       case GL_NORMAL_ARRAY_STRIDE:
2346          *params = (GLfloat) ctx->Array.NormalStride;
2347          break;
2348       case GL_NORMAL_ARRAY_COUNT_EXT:
2349          *params = 0.0;
2350          break;
2351       case GL_COLOR_ARRAY_SIZE:
2352          *params = (GLfloat) ctx->Array.ColorSize;
2353          break;
2354       case GL_COLOR_ARRAY_TYPE:
2355          *params = ENUM_TO_FLOAT(ctx->Array.ColorType);
2356          break;
2357       case GL_COLOR_ARRAY_STRIDE:
2358          *params = (GLfloat) ctx->Array.ColorStride;
2359          break;
2360       case GL_COLOR_ARRAY_COUNT_EXT:
2361          *params = 0.0;
2362          break;
2363       case GL_INDEX_ARRAY_TYPE:
2364          *params = ENUM_TO_FLOAT(ctx->Array.IndexType);
2365          break;
2366       case GL_INDEX_ARRAY_STRIDE:
2367          *params = (GLfloat) ctx->Array.IndexStride;
2368          break;
2369       case GL_INDEX_ARRAY_COUNT_EXT:
2370          *params = 0.0;
2371          break;
2372       case GL_TEXTURE_COORD_ARRAY_SIZE:
2373          *params = (GLfloat) ctx->Array.TexCoordSize;
2374          break;
2375       case GL_TEXTURE_COORD_ARRAY_TYPE:
2376          *params = ENUM_TO_FLOAT(ctx->Array.TexCoordType);
2377          break;
2378       case GL_TEXTURE_COORD_ARRAY_STRIDE:
2379          *params = (GLfloat) ctx->Array.TexCoordStride;
2380          break;
2381       case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
2382          *params = 0.0;
2383          break;
2384       case GL_EDGE_FLAG_ARRAY_STRIDE:
2385          *params = (GLfloat) ctx->Array.EdgeFlagStride;
2386          break;
2387       case GL_EDGE_FLAG_ARRAY_COUNT_EXT:
2388          *params = 0.0;
2389          break;
2390       case GL_TEXTURE_BINDING_1D:
2391          *params = (GLfloat) ctx->Texture.Current1D->Name;
2392           break;
2393       case GL_TEXTURE_BINDING_2D:
2394          *params = (GLfloat) ctx->Texture.Current2D->Name;
2395           break;
2396       case GL_TEXTURE_3D_BINDING_EXT:
2397          *params = (GLfloat) ctx->Texture.Current2D->Name;
2398           break;
2399 
2400       default:
2401          gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" );
2402    }
2403 }
2404 
2405 
2406 
2407 
2408 void gl_GetIntegerv( GLcontext *ctx, GLenum pname, GLint *params )
2409 {
2410    GLuint i;
2411 
2412    if (INSIDE_BEGIN_END(ctx)) {
2413       gl_error( ctx, GL_INVALID_OPERATION, "glGetIntegerv" );
2414       return;
2415    }
2416    switch (pname) {
2417       case GL_ACCUM_RED_BITS:
2418       case GL_ACCUM_GREEN_BITS:
2419       case GL_ACCUM_BLUE_BITS:
2420       case GL_ACCUM_ALPHA_BITS:
2421          *params = (GLint) ctx->Visual->AccumBits;
2422          break;
2423       case GL_ACCUM_CLEAR_VALUE:
2424          params[0] = FLOAT_TO_INT( ctx->Accum.ClearColor[0] );
2425          params[1] = FLOAT_TO_INT( ctx->Accum.ClearColor[1] );
2426          params[2] = FLOAT_TO_INT( ctx->Accum.ClearColor[2] );
2427          params[3] = FLOAT_TO_INT( ctx->Accum.ClearColor[3] );
2428          break;
2429       case GL_ALPHA_BIAS:
2430          *params = (GLint) ctx->Pixel.AlphaBias;
2431          break;
2432       case GL_ALPHA_BITS:
2433          *params = ctx->Visual->AlphaBits;
2434          break;
2435       case GL_ALPHA_SCALE:
2436          *params = (GLint) ctx->Pixel.AlphaScale;
2437          break;
2438       case GL_ALPHA_TEST:
2439          *params = (GLint) ctx->Color.AlphaEnabled;
2440          break;
2441       case GL_ALPHA_TEST_REF:
2442          *params = FLOAT_TO_INT( ctx->Color.AlphaRef );
2443          break;
2444       case GL_ALPHA_TEST_FUNC:
2445          *params = (GLint) ctx->Color.AlphaFunc;
2446          break;
2447       case GL_ATTRIB_STACK_DEPTH:
2448          *params = (GLint) ctx->AttribStackDepth;
2449          break;
2450       case GL_AUTO_NORMAL:
2451          *params = (GLint) ctx->Eval.AutoNormal;
2452          break;
2453       case GL_AUX_BUFFERS:
2454          *params = (GLint) NUM_AUX_BUFFERS;
2455          break;
2456       case GL_BLEND:
2457          *params = (GLint) ctx->Color.BlendEnabled;
2458          break;
2459       case GL_BLEND_DST:
2460          *params = (GLint) ctx->Color.BlendDst;
2461          break;
2462       case GL_BLEND_SRC:
2463          *params = (GLint) ctx->Color.BlendSrc;
2464          break;
2465       case GL_BLUE_BIAS:
2466          *params = (GLint) ctx->Pixel.BlueBias;
2467          break;
2468       case GL_BLUE_BITS:
2469          *params = (GLint) ctx->Visual->BlueBits;
2470          break;
2471       case GL_BLUE_SCALE:
2472          *params = (GLint) ctx->Pixel.BlueScale;
2473          break;
2474       case GL_CLIENT_ATTRIB_STACK_DEPTH:
2475          *params = ctx->ClientAttribStackDepth;
2476          break;
2477       case GL_CLIP_PLANE0:
2478       case GL_CLIP_PLANE1:
2479       case GL_CLIP_PLANE2:
2480       case GL_CLIP_PLANE3:
2481       case GL_CLIP_PLANE4:
2482       case GL_CLIP_PLANE5:
2483          i = (GLint) (pname - GL_CLIP_PLANE0);
2484          *params = (GLint) ctx->Transform.ClipEnabled[i];
2485          break;
2486       case GL_COLOR_CLEAR_VALUE:
2487          params[0] = FLOAT_TO_INT( ctx->Color.ClearColor[0] );
2488          params[1] = FLOAT_TO_INT( ctx->Color.ClearColor[1] );
2489          params[2] = FLOAT_TO_INT( ctx->Color.ClearColor[2] );
2490          params[3] = FLOAT_TO_INT( ctx->Color.ClearColor[3] );
2491          break;
2492       case GL_COLOR_MATERIAL:
2493          *params = (GLint) ctx->Light.ColorMaterialEnabled;
2494          break;
2495       case GL_COLOR_MATERIAL_FACE:
2496          *params = (GLint) ctx->Light.ColorMaterialFace;
2497          break;
2498       case GL_COLOR_MATERIAL_PARAMETER:
2499          *params = (GLint) ctx->Light.ColorMaterialMode;
2500          break;
2501       case GL_COLOR_WRITEMASK:
2502          params[0] = (ctx->Color.ColorMask & 8) ? 1 : 0;
2503          params[1] = (ctx->Color.ColorMask & 4) ? 1 : 0;
2504          params[2] = (ctx->Color.ColorMask & 2) ? 1 : 0;
2505          params[3] = (ctx->Color.ColorMask & 1) ? 1 : 0;
2506          break;
2507       case GL_CULL_FACE:
2508          *params = (GLint) ctx->Polygon.CullFlag;
2509          break;
2510       case GL_CULL_FACE_MODE:
2511          *params = (GLint) ctx->Polygon.CullFaceMode;
2512          break;
2513       case GL_CURRENT_COLOR:
2514          params[0] = FLOAT_TO_INT( (ctx->Current.ByteColor[0]*ctx->Visual->InvRedScale) );
2515          params[1] = FLOAT_TO_INT( (ctx->Current.ByteColor[1]*ctx->Visual->InvGreenScale) );
2516          params[2] = FLOAT_TO_INT( (ctx->Current.ByteColor[2]*ctx->Visual->InvBlueScale) );
2517          params[3] = FLOAT_TO_INT( (ctx->Current.ByteColor[3]*ctx->Visual->InvAlphaScale) );
2518          break;
2519       case GL_CURRENT_INDEX:
2520          *params = (GLint) ctx->Current.Index;
2521          break;
2522       case GL_CURRENT_NORMAL:
2523          params[0] = FLOAT_TO_INT( ctx->Current.Normal[0] );
2524          params[1] = FLOAT_TO_INT( ctx->Current.Normal[1] );
2525          params[2] = FLOAT_TO_INT( ctx->Current.Normal[2] );
2526          break;
2527       case GL_CURRENT_RASTER_COLOR:
2528 	 params[0] = FLOAT_TO_INT( ctx->Current.RasterColor[0] );
2529 	 params[1] = FLOAT_TO_INT( ctx->Current.RasterColor[1] );
2530 	 params[2] = FLOAT_TO_INT( ctx->Current.RasterColor[2] );
2531 	 params[3] = FLOAT_TO_INT( ctx->Current.RasterColor[3] );
2532 	 break;
2533       case GL_CURRENT_RASTER_DISTANCE:
2534 	 params[0] = (GLint) ctx->Current.RasterDistance;
2535 	 break;
2536       case GL_CURRENT_RASTER_INDEX:
2537 	 *params = (GLint) ctx->Current.RasterIndex;
2538 	 break;
2539       case GL_CURRENT_RASTER_POSITION:
2540 	 params[0] = (GLint) ctx->Current.RasterPos[0];
2541 	 params[1] = (GLint) ctx->Current.RasterPos[1];
2542 	 params[2] = (GLint) ctx->Current.RasterPos[2];
2543 	 params[3] = (GLint) ctx->Current.RasterPos[3];
2544 	 break;
2545       case GL_CURRENT_RASTER_TEXTURE_COORDS:
2546 	 params[0] = (GLint) ctx->Current.RasterTexCoord[0];
2547 	 params[1] = (GLint) ctx->Current.RasterTexCoord[1];
2548 	 params[2] = (GLint) ctx->Current.RasterTexCoord[2];
2549 	 params[3] = (GLint) ctx->Current.RasterTexCoord[3];
2550 	 break;
2551       case GL_CURRENT_RASTER_POSITION_VALID:
2552 	 *params = (GLint) ctx->Current.RasterPosValid;
2553 	 break;
2554       case GL_CURRENT_TEXTURE_COORDS:
2555          params[0] = (GLint) ctx->Current.TexCoord[0];
2556          params[1] = (GLint) ctx->Current.TexCoord[1];
2557          params[2] = (GLint) ctx->Current.TexCoord[2];
2558          params[3] = (GLint) ctx->Current.TexCoord[3];
2559 	 break;
2560       case GL_DEPTH_BIAS:
2561          *params = (GLint) ctx->Pixel.DepthBias;
2562 	 break;
2563       case GL_DEPTH_BITS:
2564 	 *params = ctx->Visual->DepthBits;
2565 	 break;
2566       case GL_DEPTH_CLEAR_VALUE:
2567          *params = (GLint) ctx->Depth.Clear;
2568 	 break;
2569       case GL_DEPTH_FUNC:
2570          *params = (GLint) ctx->Depth.Func;
2571 	 break;
2572       case GL_DEPTH_RANGE:
2573          params[0] = (GLint) ctx->Viewport.Near;
2574          params[1] = (GLint) ctx->Viewport.Far;
2575 	 break;
2576       case GL_DEPTH_SCALE:
2577          *params = (GLint) ctx->Pixel.DepthScale;
2578 	 break;
2579       case GL_DEPTH_TEST:
2580          *params = (GLint) ctx->Depth.Test;
2581 	 break;
2582       case GL_DEPTH_WRITEMASK:
2583 	 *params = (GLint) ctx->Depth.Mask;
2584 	 break;
2585       case GL_DITHER:
2586 	 *params = (GLint) ctx->Color.DitherFlag;
2587 	 break;
2588       case GL_DOUBLEBUFFER:
2589 	 *params = (GLint) ctx->Visual->DBflag;
2590 	 break;
2591       case GL_DRAW_BUFFER:
2592 	 *params = (GLint) ctx->Color.DrawBuffer;
2593 	 break;
2594       case GL_EDGE_FLAG:
2595 	 *params = (GLint) ctx->Current.EdgeFlag;
2596 	 break;
2597       case GL_FEEDBACK_BUFFER_SIZE:
2598          /* TODO: is this right?  Or, return number of entries in buffer? */
2599          *params = ctx->Feedback.BufferSize;
2600          break;
2601       case GL_FEEDBACK_BUFFER_TYPE:
2602          *params = ctx->Feedback.Type;
2603          break;
2604       case GL_FOG:
2605 	 *params = (GLint) ctx->Fog.Enabled;
2606 	 break;
2607       case GL_FOG_COLOR:
2608 	 params[0] = FLOAT_TO_INT( ctx->Fog.Color[0] );
2609 	 params[1] = FLOAT_TO_INT( ctx->Fog.Color[1] );
2610 	 params[2] = FLOAT_TO_INT( ctx->Fog.Color[2] );
2611 	 params[3] = FLOAT_TO_INT( ctx->Fog.Color[3] );
2612 	 break;
2613       case GL_FOG_DENSITY:
2614 	 *params = (GLint) ctx->Fog.Density;
2615 	 break;
2616       case GL_FOG_END:
2617 	 *params = (GLint) ctx->Fog.End;
2618 	 break;
2619       case GL_FOG_HINT:
2620 	 *params = (GLint) ctx->Hint.Fog;
2621 	 break;
2622       case GL_FOG_INDEX:
2623 	 *params = (GLint) ctx->Fog.Index;
2624 	 break;
2625       case GL_FOG_MODE:
2626 	 *params = (GLint) ctx->Fog.Mode;
2627 	 break;
2628       case GL_FOG_START:
2629 	 *params = (GLint) ctx->Fog.Start;
2630 	 break;
2631       case GL_FRONT_FACE:
2632 	 *params = (GLint) ctx->Polygon.FrontFace;
2633 	 break;
2634       case GL_GREEN_BIAS:
2635          *params = (GLint) ctx->Pixel.GreenBias;
2636          break;
2637       case GL_GREEN_BITS:
2638          *params = (GLint) ctx->Visual->GreenBits;
2639          break;
2640       case GL_GREEN_SCALE:
2641          *params = (GLint) ctx->Pixel.GreenScale;
2642          break;
2643       case GL_INDEX_BITS:
2644          *params = (GLint) ctx->Visual->IndexBits;
2645          break;
2646       case GL_INDEX_CLEAR_VALUE:
2647          *params = (GLint) ctx->Color.ClearIndex;
2648          break;
2649       case GL_INDEX_MODE:
2650 	 *params = ctx->Visual->RGBAflag ? 0 : 1;
2651 	 break;
2652       case GL_INDEX_OFFSET:
2653 	 *params = ctx->Pixel.IndexOffset;
2654 	 break;
2655       case GL_INDEX_SHIFT:
2656 	 *params = ctx->Pixel.IndexShift;
2657 	 break;
2658       case GL_INDEX_WRITEMASK:
2659 	 *params = (GLint) ctx->Color.IndexMask;
2660 	 break;
2661       case GL_LIGHT0:
2662       case GL_LIGHT1:
2663       case GL_LIGHT2:
2664       case GL_LIGHT3:
2665       case GL_LIGHT4:
2666       case GL_LIGHT5:
2667       case GL_LIGHT6:
2668       case GL_LIGHT7:
2669 	 *params = (GLint) ctx->Light.Light[pname-GL_LIGHT0].Enabled;
2670 	 break;
2671       case GL_LIGHTING:
2672 	 *params = (GLint) ctx->Light.Enabled;
2673 	 break;
2674       case GL_LIGHT_MODEL_AMBIENT:
2675 	 params[0] = FLOAT_TO_INT( ctx->Light.Model.Ambient[0] );
2676 	 params[1] = FLOAT_TO_INT( ctx->Light.Model.Ambient[1] );
2677 	 params[2] = FLOAT_TO_INT( ctx->Light.Model.Ambient[2] );
2678 	 params[3] = FLOAT_TO_INT( ctx->Light.Model.Ambient[3] );
2679 	 break;
2680       case GL_LIGHT_MODEL_LOCAL_VIEWER:
2681 	 *params = (GLint) ctx->Light.Model.LocalViewer;
2682 	 break;
2683       case GL_LIGHT_MODEL_TWO_SIDE:
2684 	 *params = (GLint) ctx->Light.Model.TwoSide;
2685 	 break;
2686       case GL_LINE_SMOOTH:
2687 	 *params = (GLint) ctx->Line.SmoothFlag;
2688 	 break;
2689       case GL_LINE_SMOOTH_HINT:
2690 	 *params = (GLint) ctx->Hint.LineSmooth;
2691 	 break;
2692       case GL_LINE_STIPPLE:
2693 	 *params = (GLint) ctx->Line.StippleFlag;
2694 	 break;
2695       case GL_LINE_STIPPLE_PATTERN:
2696          *params = (GLint) ctx->Line.StipplePattern;
2697          break;
2698       case GL_LINE_STIPPLE_REPEAT:
2699          *params = (GLint) ctx->Line.StippleFactor;
2700          break;
2701       case GL_LINE_WIDTH:
2702 	 *params = (GLint) ctx->Line.Width;
2703 	 break;
2704       case GL_LINE_WIDTH_GRANULARITY:
2705 	 *params = (GLint) LINE_WIDTH_GRANULARITY;
2706 	 break;
2707       case GL_LINE_WIDTH_RANGE:
2708 	 params[0] = (GLint) MIN_LINE_WIDTH;
2709 	 params[1] = (GLint) MAX_LINE_WIDTH;
2710 	 break;
2711       case GL_LIST_BASE:
2712 	 *params = (GLint) ctx->List.ListBase;
2713 	 break;
2714       case GL_LIST_INDEX:
2715 	 *params = (GLint) ctx->CurrentListNum;
2716 	 break;
2717       case GL_LIST_MODE:
2718 	 *params = ctx->ExecuteFlag ? (GLint) GL_COMPILE_AND_EXECUTE
2719 	   			  : (GLint) GL_COMPILE;
2720 	 break;
2721       case GL_INDEX_LOGIC_OP:
2722 	 *params = (GLint) ctx->Color.IndexLogicOpEnabled;
2723 	 break;
2724       case GL_COLOR_LOGIC_OP:
2725 	 *params = (GLint) ctx->Color.ColorLogicOpEnabled;
2726 	 break;
2727       case GL_LOGIC_OP_MODE:
2728          *params = (GLint) ctx->Color.LogicOp;
2729          break;
2730       case GL_MAP1_COLOR_4:
2731 	 *params = (GLint) ctx->Eval.Map1Color4;
2732 	 break;
2733       case GL_MAP1_GRID_DOMAIN:
2734 	 params[0] = (GLint) ctx->Eval.MapGrid1u1;
2735 	 params[1] = (GLint) ctx->Eval.MapGrid1u2;
2736 	 break;
2737       case GL_MAP1_GRID_SEGMENTS:
2738 	 *params = (GLint) ctx->Eval.MapGrid1un;
2739 	 break;
2740       case GL_MAP1_INDEX:
2741 	 *params = (GLint) ctx->Eval.Map1Index;
2742 	 break;
2743       case GL_MAP1_NORMAL:
2744 	 *params = (GLint) ctx->Eval.Map1Normal;
2745 	 break;
2746       case GL_MAP1_TEXTURE_COORD_1:
2747 	 *params = (GLint) ctx->Eval.Map1TextureCoord1;
2748 	 break;
2749       case GL_MAP1_TEXTURE_COORD_2:
2750 	 *params = (GLint) ctx->Eval.Map1TextureCoord2;
2751 	 break;
2752       case GL_MAP1_TEXTURE_COORD_3:
2753 	 *params = (GLint) ctx->Eval.Map1TextureCoord3;
2754 	 break;
2755       case GL_MAP1_TEXTURE_COORD_4:
2756 	 *params = (GLint) ctx->Eval.Map1TextureCoord4;
2757 	 break;
2758       case GL_MAP1_VERTEX_3:
2759 	 *params = (GLint) ctx->Eval.Map1Vertex3;
2760 	 break;
2761       case GL_MAP1_VERTEX_4:
2762 	 *params = (GLint) ctx->Eval.Map1Vertex4;
2763 	 break;
2764       case GL_MAP2_COLOR_4:
2765 	 *params = (GLint) ctx->Eval.Map2Color4;
2766 	 break;
2767       case GL_MAP2_GRID_DOMAIN:
2768 	 params[0] = (GLint) ctx->Eval.MapGrid2u1;
2769 	 params[1] = (GLint) ctx->Eval.MapGrid2u2;
2770 	 params[2] = (GLint) ctx->Eval.MapGrid2v1;
2771 	 params[3] = (GLint) ctx->Eval.MapGrid2v2;
2772 	 break;
2773       case GL_MAP2_GRID_SEGMENTS:
2774 	 params[0] = (GLint) ctx->Eval.MapGrid2un;
2775 	 params[1] = (GLint) ctx->Eval.MapGrid2vn;
2776 	 break;
2777       case GL_MAP2_INDEX:
2778 	 *params = (GLint) ctx->Eval.Map2Index;
2779 	 break;
2780       case GL_MAP2_NORMAL:
2781 	 *params = (GLint) ctx->Eval.Map2Normal;
2782 	 break;
2783       case GL_MAP2_TEXTURE_COORD_1:
2784 	 *params = (GLint) ctx->Eval.Map2TextureCoord1;
2785 	 break;
2786       case GL_MAP2_TEXTURE_COORD_2:
2787 	 *params = (GLint) ctx->Eval.Map2TextureCoord2;
2788 	 break;
2789       case GL_MAP2_TEXTURE_COORD_3:
2790 	 *params = (GLint) ctx->Eval.Map2TextureCoord3;
2791 	 break;
2792       case GL_MAP2_TEXTURE_COORD_4:
2793 	 *params = (GLint) ctx->Eval.Map2TextureCoord4;
2794 	 break;
2795       case GL_MAP2_VERTEX_3:
2796 	 *params = (GLint) ctx->Eval.Map2Vertex3;
2797 	 break;
2798       case GL_MAP2_VERTEX_4:
2799 	 *params = (GLint) ctx->Eval.Map2Vertex4;
2800 	 break;
2801       case GL_MAP_COLOR:
2802 	 *params = (GLint) ctx->Pixel.MapColorFlag;
2803 	 break;
2804       case GL_MAP_STENCIL:
2805 	 *params = (GLint) ctx->Pixel.MapStencilFlag;
2806 	 break;
2807       case GL_MATRIX_MODE:
2808 	 *params = (GLint) ctx->Transform.MatrixMode;
2809 	 break;
2810       case GL_MAX_ATTRIB_STACK_DEPTH:
2811          *params = (GLint) MAX_ATTRIB_STACK_DEPTH;
2812          break;
2813       case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
2814          *params = (GLint) MAX_CLIENT_ATTRIB_STACK_DEPTH;
2815          break;
2816       case GL_MAX_CLIP_PLANES:
2817          *params = (GLint) MAX_CLIP_PLANES;
2818          break;
2819       case GL_MAX_EVAL_ORDER:
2820 	 *params = (GLint) MAX_EVAL_ORDER;
2821 	 break;
2822       case GL_MAX_LIGHTS:
2823          *params = (GLint) MAX_LIGHTS;
2824          break;
2825       case GL_MAX_LIST_NESTING:
2826          *params = (GLint) MAX_LIST_NESTING;
2827          break;
2828       case GL_MAX_MODELVIEW_STACK_DEPTH:
2829          *params = (GLint) MAX_MODELVIEW_STACK_DEPTH;
2830          break;
2831       case GL_MAX_NAME_STACK_DEPTH:
2832 	 *params = (GLint) MAX_NAME_STACK_DEPTH;
2833 	 break;
2834       case GL_MAX_PIXEL_MAP_TABLE:
2835 	 *params = (GLint) MAX_PIXEL_MAP_TABLE;
2836 	 break;
2837       case GL_MAX_PROJECTION_STACK_DEPTH:
2838          *params = (GLint) MAX_PROJECTION_STACK_DEPTH;
2839          break;
2840       case GL_MAX_TEXTURE_SIZE:
2841 	 *params = (GLint) MAX_TEXTURE_SIZE;
2842 	 break;
2843       case GL_MAX_TEXTURE_STACK_DEPTH:
2844 	 *params = (GLint) MAX_TEXTURE_STACK_DEPTH;
2845 	 break;
2846       case GL_MAX_VIEWPORT_DIMS:
2847          params[0] = (GLint) MAX_WIDTH;
2848          params[1] = (GLint) MAX_HEIGHT;
2849          break;
2850       case GL_MODELVIEW_MATRIX:
2851 	 for (i=0;i<16;i++) {
2852 	    params[i] = (GLint) ctx->ModelViewMatrix[i];
2853 	 }
2854 	 break;
2855       case GL_MODELVIEW_STACK_DEPTH:
2856 	 *params = (GLint) ctx->ModelViewStackDepth;
2857 	 break;
2858       case GL_NAME_STACK_DEPTH:
2859 	 *params = (GLint) ctx->Select.NameStackDepth;
2860 	 break;
2861       case GL_NORMALIZE:
2862 	 *params = (GLint) ctx->Transform.Normalize;
2863 	 break;
2864       case GL_PACK_ALIGNMENT:
2865 	 *params = ctx->Pack.Alignment;
2866 	 break;
2867       case GL_PACK_LSB_FIRST:
2868 	 *params = (GLint) ctx->Pack.LsbFirst;
2869 	 break;
2870       case GL_PACK_ROW_LENGTH:
2871 	 *params = ctx->Pack.RowLength;
2872 	 break;
2873       case GL_PACK_SKIP_PIXELS:
2874 	 *params = ctx->Pack.SkipPixels;
2875 	 break;
2876       case GL_PACK_SKIP_ROWS:
2877 	 *params = ctx->Pack.SkipRows;
2878 	 break;
2879       case GL_PACK_SWAP_BYTES:
2880 	 *params = (GLint) ctx->Pack.SwapBytes;
2881 	 break;
2882       case GL_PERSPECTIVE_CORRECTION_HINT:
2883 	 *params = (GLint) ctx->Hint.PerspectiveCorrection;
2884 	 break;
2885       case GL_PIXEL_MAP_A_TO_A_SIZE:
2886 	 *params = ctx->Pixel.MapAtoAsize;
2887 	 break;
2888       case GL_PIXEL_MAP_B_TO_B_SIZE:
2889 	 *params = ctx->Pixel.MapBtoBsize;
2890 	 break;
2891       case GL_PIXEL_MAP_G_TO_G_SIZE:
2892 	 *params = ctx->Pixel.MapGtoGsize;
2893 	 break;
2894       case GL_PIXEL_MAP_I_TO_A_SIZE:
2895 	 *params = ctx->Pixel.MapItoAsize;
2896 	 break;
2897       case GL_PIXEL_MAP_I_TO_B_SIZE:
2898 	 *params = ctx->Pixel.MapItoBsize;
2899 	 break;
2900       case GL_PIXEL_MAP_I_TO_G_SIZE:
2901 	 *params = ctx->Pixel.MapItoGsize;
2902 	 break;
2903       case GL_PIXEL_MAP_I_TO_I_SIZE:
2904 	 *params = ctx->Pixel.MapItoIsize;
2905 	 break;
2906       case GL_PIXEL_MAP_I_TO_R_SIZE:
2907 	 *params = ctx->Pixel.MapItoRsize;
2908 	 break;
2909       case GL_PIXEL_MAP_R_TO_R_SIZE:
2910 	 *params = ctx->Pixel.MapRtoRsize;
2911 	 break;
2912       case GL_PIXEL_MAP_S_TO_S_SIZE:
2913 	 *params = ctx->Pixel.MapStoSsize;
2914 	 break;
2915       case GL_POINT_SIZE:
2916          *params = (GLint) ctx->Point.Size;
2917          break;
2918       case GL_POINT_SIZE_GRANULARITY:
2919 	 *params = (GLint) POINT_SIZE_GRANULARITY;
2920 	 break;
2921       case GL_POINT_SIZE_RANGE:
2922 	 params[0] = (GLint) MIN_POINT_SIZE;
2923 	 params[1] = (GLint) MAX_POINT_SIZE;
2924 	 break;
2925       case GL_POINT_SMOOTH:
2926 	 *params = (GLint) ctx->Point.SmoothFlag;
2927 	 break;
2928       case GL_POINT_SMOOTH_HINT:
2929 	 *params = (GLint) ctx->Hint.PointSmooth;
2930 	 break;
2931       case GL_POLYGON_MODE:
2932 	 params[0] = (GLint) ctx->Polygon.FrontMode;
2933 	 params[1] = (GLint) ctx->Polygon.BackMode;
2934 	 break;
2935 #ifdef GL_EXT_polygon_offset
2936       case GL_POLYGON_OFFSET_BIAS_EXT:
2937          *params = (GLint) ctx->Polygon.OffsetUnits;
2938          break;
2939 #endif
2940       case GL_POLYGON_OFFSET_FACTOR:
2941          *params = (GLint) ctx->Polygon.OffsetFactor;
2942          break;
2943       case GL_POLYGON_OFFSET_UNITS:
2944          *params = (GLint) ctx->Polygon.OffsetUnits;
2945          break;
2946       case GL_POLYGON_SMOOTH:
2947 	 *params = (GLint) ctx->Polygon.SmoothFlag;
2948 	 break;
2949       case GL_POLYGON_SMOOTH_HINT:
2950 	 *params = (GLint) ctx->Hint.PolygonSmooth;
2951 	 break;
2952       case GL_POLYGON_STIPPLE:
2953 	 for (i=0;i<32;i++) {		/* RIGHT? */
2954 	    params[i] = (GLint) ctx->PolygonStipple[i];
2955 	 }
2956 	 break;
2957       case GL_PROJECTION_MATRIX:
2958 	 for (i=0;i<16;i++) {
2959 	    params[i] = (GLint) ctx->ProjectionMatrix[i];
2960 	 }
2961 	 break;
2962       case GL_PROJECTION_STACK_DEPTH:
2963 	 *params = (GLint) ctx->ProjectionStackDepth;
2964 	 break;
2965       case GL_READ_BUFFER:
2966 	 *params = (GLint) ctx->Pixel.ReadBuffer;
2967 	 break;
2968       case GL_RED_BIAS:
2969          *params = (GLint) ctx->Pixel.RedBias;
2970          break;
2971       case GL_RED_BITS:
2972          *params = (GLint) ctx->Visual->RedBits;
2973          break;
2974       case GL_RED_SCALE:
2975          *params = (GLint) ctx->Pixel.RedScale;
2976          break;
2977       case GL_RENDER_MODE:
2978 	 *params = (GLint) ctx->RenderMode;
2979 	 break;
2980       case GL_RGBA_MODE:
2981 	 *params = (GLint) ctx->Visual->RGBAflag;
2982 	 break;
2983       case GL_SCISSOR_BOX:
2984 	 params[0] = (GLint) ctx->Scissor.X;
2985 	 params[1] = (GLint) ctx->Scissor.Y;
2986 	 params[2] = (GLint) ctx->Scissor.Width;
2987 	 params[3] = (GLint) ctx->Scissor.Height;
2988 	 break;
2989       case GL_SCISSOR_TEST:
2990 	 *params = (GLint) ctx->Scissor.Enabled;
2991 	 break;
2992       case GL_SHADE_MODEL:
2993 	 *params = (GLint) ctx->Light.ShadeModel;
2994 	 break;
2995       case GL_STENCIL_BITS:
2996          *params = ctx->Visual->StencilBits;
2997          break;
2998       case GL_STENCIL_CLEAR_VALUE:
2999 	 *params = (GLint) ctx->Stencil.Clear;
3000 	 break;
3001       case GL_STENCIL_FAIL:
3002 	 *params = (GLint) ctx->Stencil.FailFunc;
3003 	 break;
3004       case GL_STENCIL_FUNC:
3005 	 *params = (GLint) ctx->Stencil.Function;
3006 	 break;
3007       case GL_STENCIL_PASS_DEPTH_FAIL:
3008 	 *params = (GLint) ctx->Stencil.ZFailFunc;
3009 	 break;
3010       case GL_STENCIL_PASS_DEPTH_PASS:
3011 	 *params = (GLint) ctx->Stencil.ZPassFunc;
3012 	 break;
3013       case GL_STENCIL_REF:
3014 	 *params = (GLint) ctx->Stencil.Ref;
3015 	 break;
3016       case GL_STENCIL_TEST:
3017 	 *params = (GLint) ctx->Stencil.Enabled;
3018 	 break;
3019       case GL_STENCIL_VALUE_MASK:
3020 	 *params = (GLint) ctx->Stencil.ValueMask;
3021 	 break;
3022       case GL_STENCIL_WRITEMASK:
3023 	 *params = (GLint) ctx->Stencil.WriteMask;
3024 	 break;
3025       case GL_STEREO:
3026 	 *params = 0;  /* TODO */
3027 	 break;
3028       case GL_SUBPIXEL_BITS:
3029 	 *params = 0;  /* TODO */
3030 	 break;
3031       case GL_TEXTURE_1D:
3032 	 *params = (ctx->Texture.Enabled & TEXTURE_1D) ? 1.0 : 0.0;
3033 	 break;
3034       case GL_TEXTURE_2D:
3035 	 *params = (ctx->Texture.Enabled & TEXTURE_2D) ? 1.0 : 0.0;
3036 	 break;
3037       case GL_TEXTURE_ENV_COLOR:
3038 	 params[0] = FLOAT_TO_INT( ctx->Texture.EnvColor[0] );
3039 	 params[1] = FLOAT_TO_INT( ctx->Texture.EnvColor[1] );
3040 	 params[2] = FLOAT_TO_INT( ctx->Texture.EnvColor[2] );
3041 	 params[3] = FLOAT_TO_INT( ctx->Texture.EnvColor[3] );
3042 	 break;
3043       case GL_TEXTURE_ENV_MODE:
3044 	 *params = (GLint) ctx->Texture.EnvMode;
3045 	 break;
3046       case GL_TEXTURE_GEN_S:
3047 	 *params = (ctx->Texture.TexGenEnabled & S_BIT) ? 1 : 0;
3048 	 break;
3049       case GL_TEXTURE_GEN_T:
3050 	 *params = (ctx->Texture.TexGenEnabled & T_BIT) ? 1 : 0;
3051 	 break;
3052       case GL_TEXTURE_GEN_R:
3053 	 *params = (ctx->Texture.TexGenEnabled & R_BIT) ? 1 : 0;
3054 	 break;
3055       case GL_TEXTURE_GEN_Q:
3056 	 *params = (ctx->Texture.TexGenEnabled & Q_BIT) ? 1 : 0;
3057 	 break;
3058       case GL_TEXTURE_MATRIX:
3059          for (i=0;i<16;i++) {
3060 	    params[i] = (GLint) ctx->TextureMatrix[i];
3061 	 }
3062 	 break;
3063       case GL_TEXTURE_STACK_DEPTH:
3064 	 *params = (GLint) ctx->TextureStackDepth;
3065 	 break;
3066       case GL_UNPACK_ALIGNMENT:
3067 	 *params = ctx->Unpack.Alignment;
3068 	 break;
3069       case GL_UNPACK_LSB_FIRST:
3070 	 *params = (GLint) ctx->Unpack.LsbFirst;
3071 	 break;
3072       case GL_UNPACK_ROW_LENGTH:
3073 	 *params = ctx->Unpack.RowLength;
3074 	 break;
3075       case GL_UNPACK_SKIP_PIXELS:
3076 	 *params = ctx->Unpack.SkipPixels;
3077 	 break;
3078       case GL_UNPACK_SKIP_ROWS:
3079 	 *params = ctx->Unpack.SkipRows;
3080 	 break;
3081       case GL_UNPACK_SWAP_BYTES:
3082 	 *params = (GLint) ctx->Unpack.SwapBytes;
3083 	 break;
3084       case GL_VIEWPORT:
3085          params[0] = (GLint) ctx->Viewport.X;
3086          params[1] = (GLint) ctx->Viewport.Y;
3087          params[2] = (GLint) ctx->Viewport.Width;
3088          params[3] = (GLint) ctx->Viewport.Height;
3089          break;
3090       case GL_ZOOM_X:
3091 	 *params = (GLint) ctx->Pixel.ZoomX;
3092 	 break;
3093       case GL_ZOOM_Y:
3094 	 *params = (GLint) ctx->Pixel.ZoomY;
3095 	 break;
3096       case GL_VERTEX_ARRAY_SIZE:
3097          *params = ctx->Array.VertexSize;
3098          break;
3099       case GL_VERTEX_ARRAY_TYPE:
3100          *params = ctx->Array.VertexType;
3101          break;
3102       case GL_VERTEX_ARRAY_STRIDE:
3103          *params = ctx->Array.VertexStride;
3104          break;
3105       case GL_VERTEX_ARRAY_COUNT_EXT:
3106          *params = 0;
3107          break;
3108       case GL_NORMAL_ARRAY_TYPE:
3109          *params = ctx->Array.NormalType;
3110          break;
3111       case GL_NORMAL_ARRAY_STRIDE:
3112          *params = ctx->Array.NormalStride;
3113          break;
3114       case GL_NORMAL_ARRAY_COUNT_EXT:
3115          *params = 0;
3116          break;
3117       case GL_COLOR_ARRAY_SIZE:
3118          *params = ctx->Array.ColorSize;
3119          break;
3120       case GL_COLOR_ARRAY_TYPE:
3121          *params = ctx->Array.ColorType;
3122          break;
3123       case GL_COLOR_ARRAY_STRIDE:
3124          *params = ctx->Array.ColorStride;
3125          break;
3126       case GL_COLOR_ARRAY_COUNT_EXT:
3127          *params = 0;
3128          break;
3129       case GL_INDEX_ARRAY_TYPE:
3130          *params = ctx->Array.IndexType;
3131          break;
3132       case GL_INDEX_ARRAY_STRIDE:
3133          *params = ctx->Array.IndexStride;
3134          break;
3135       case GL_INDEX_ARRAY_COUNT_EXT:
3136          *params = 0;
3137          break;
3138       case GL_TEXTURE_COORD_ARRAY_SIZE:
3139          *params = ctx->Array.TexCoordSize;
3140          break;
3141       case GL_TEXTURE_COORD_ARRAY_TYPE:
3142          *params = ctx->Array.TexCoordType;
3143          break;
3144       case GL_TEXTURE_COORD_ARRAY_STRIDE:
3145          *params = ctx->Array.TexCoordStride;
3146          break;
3147       case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
3148          *params = 0;
3149          break;
3150       case GL_EDGE_FLAG_ARRAY_STRIDE:
3151          *params = ctx->Array.EdgeFlagStride;
3152          break;
3153       case GL_EDGE_FLAG_ARRAY_COUNT_EXT:
3154          *params = 0;
3155          break;
3156       case GL_TEXTURE_BINDING_1D:
3157          *params = ctx->Texture.Current1D->Name;
3158           break;
3159       case GL_TEXTURE_BINDING_2D:
3160          *params = ctx->Texture.Current2D->Name;
3161           break;
3162 
3163       default:
3164          gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" );
3165    }
3166 }
3167 
3168 
3169 
3170 void gl_GetPointerv( GLcontext *ctx, GLenum pname, GLvoid **params )
3171 {
3172    switch (pname) {
3173       case GL_VERTEX_ARRAY_POINTER:
3174          *params = ctx->Array.VertexPtr;
3175          break;
3176       case GL_NORMAL_ARRAY_POINTER:
3177          *params = ctx->Array.NormalPtr;
3178          break;
3179       case GL_COLOR_ARRAY_POINTER:
3180          *params = ctx->Array.ColorPtr;
3181          break;
3182       case GL_INDEX_ARRAY_POINTER:
3183          *params = ctx->Array.IndexPtr;
3184          break;
3185       case GL_TEXTURE_COORD_ARRAY_POINTER:
3186          *params = ctx->Array.TexCoordPtr;
3187          break;
3188       case GL_EDGE_FLAG_ARRAY_POINTER:
3189          *params = ctx->Array.EdgeFlagPtr;
3190          break;
3191       case GL_FEEDBACK_BUFFER_POINTER:
3192          *params = ctx->Feedback.Buffer;
3193          break;
3194       default:
3195          gl_error( ctx, GL_INVALID_ENUM, "glGetPointerv" );
3196          return;
3197    }
3198 }
3199