Committing patch "[#27676] Change window size/resolution in realtime" by me.
[blender-staging.git] / source / blender / python / generic / bgl.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19  * All rights reserved.
20  *
21  * This is a new part of Blender.
22  *
23  * Contributor(s): Willian P. Germano, Campbell Barton
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  */
27
28 /** \file blender/python/generic/bgl.c
29  *  \ingroup pygen
30  *
31  * This file is the 'bgl' module which wraps OpenGL functions and constants,
32  * allowing script writers to make OpenGL calls in their Python scripts.
33  *
34  * \note
35  * This module is very similar to 'PyOpenGL' which could replace 'bgl' one day.
36  */
37
38 #include <Python.h>
39
40 #include "bgl.h" /*This must come first */
41 #include <GL/glew.h>
42 #include "MEM_guardedalloc.h"
43
44 #include "BLI_utildefines.h"
45
46 static PyObject *Buffer_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
47
48 /* Buffer sequence methods */
49
50 static int Buffer_len(Buffer *self);
51 static PyObject *Buffer_item(Buffer *self, int i);
52 static PyObject *Buffer_slice(Buffer *self, int begin, int end);
53 static int Buffer_ass_item(Buffer *self, int i, PyObject *v);
54 static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq);
55 static PyObject *Buffer_subscript(Buffer *self, PyObject *item);
56 static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value);
57
58 static PySequenceMethods Buffer_SeqMethods = {
59         (lenfunc) Buffer_len,                                           /*sq_length */
60         (binaryfunc) NULL,                                                      /*sq_concat */
61         (ssizeargfunc) NULL,                                            /*sq_repeat */
62         (ssizeargfunc) Buffer_item,                                     /*sq_item */
63         (ssizessizeargfunc) NULL,                                       /*sq_slice, deprecated, handled in Buffer_item */
64         (ssizeobjargproc) Buffer_ass_item,                      /*sq_ass_item */
65         (ssizessizeobjargproc) NULL,                            /*sq_ass_slice, deprecated handled in Buffer_ass_item */
66         (objobjproc) NULL,                                                      /* sq_contains */
67         (binaryfunc) NULL,                                                      /* sq_inplace_concat */
68         (ssizeargfunc) NULL,                                            /* sq_inplace_repeat */
69 };
70
71
72 static PyMappingMethods Buffer_AsMapping = {
73         (lenfunc)Buffer_len,
74         (binaryfunc)Buffer_subscript,
75         (objobjargproc)Buffer_ass_subscript
76 };
77
78 static void Buffer_dealloc(Buffer *self);
79 static PyObject *Buffer_repr(Buffer *self);
80
81 static PyObject *Buffer_to_list(Buffer *self)
82 {
83         int i, len= self->dimensions[0];
84         PyObject *list= PyList_New(len);
85
86         for (i=0; i<len; i++) {
87                 PyList_SET_ITEM(list, i, Buffer_item(self, i));
88         }
89
90         return list;
91 }
92
93 static PyObject *Buffer_to_list_recursive(Buffer *self)
94 {
95         PyObject *list;
96
97         if (self->ndimensions > 1) {
98                 int i, len= self->dimensions[0];
99                 list= PyList_New(len);
100
101                 for (i=0; i<len; i++) {
102                         Buffer *sub= (Buffer *)Buffer_item(self, i);
103                         PyList_SET_ITEM(list, i, Buffer_to_list_recursive(sub));
104                         Py_DECREF(sub);
105                 }
106         }
107         else {
108                 list= Buffer_to_list(self);
109         }
110
111         return list;
112 }
113
114 static PyObject *Buffer_dimensions(Buffer *self, void *UNUSED(arg))
115 {
116         PyObject *list= PyList_New(self->ndimensions);
117         int i;
118
119         for (i= 0; i<self->ndimensions; i++) {
120                 PyList_SET_ITEM(list, i, PyLong_FromLong(self->dimensions[i]));
121         }
122
123         return list;
124 }
125
126 static PyMethodDef Buffer_methods[] = {
127         {"to_list", (PyCFunction)Buffer_to_list_recursive, METH_NOARGS,
128      "return the buffer as a list"},
129         {NULL, NULL, 0, NULL}
130 };
131
132 static PyGetSetDef Buffer_getseters[] = {
133         {(char *)"dimensions", (getter)Buffer_dimensions, NULL, NULL, NULL},
134          {NULL, NULL, NULL, NULL, NULL}
135 };
136
137
138 PyTypeObject BGL_bufferType = {
139         PyVarObject_HEAD_INIT(NULL, 0)
140         "bgl.Buffer",               /*tp_name */
141         sizeof(Buffer),             /*tp_basicsize */
142         0,                          /*tp_itemsize */
143         (destructor)Buffer_dealloc, /*tp_dealloc */
144         (printfunc)NULL,            /*tp_print */
145         NULL,                       /*tp_getattr */
146         NULL,                       /*tp_setattr */
147         NULL,           /*tp_compare */
148         (reprfunc) Buffer_repr, /*tp_repr */
149         NULL,                   /*tp_as_number */
150         &Buffer_SeqMethods,     /*tp_as_sequence */
151         &Buffer_AsMapping,              /* PyMappingMethods *tp_as_mapping; */
152
153         /* More standard operations (here for binary compatibility) */
154
155         NULL, /* hashfunc tp_hash; */
156         NULL,                       /* ternaryfunc tp_call; */
157         NULL,                       /* reprfunc tp_str; */
158         NULL,                       /* getattrofunc tp_getattro; */
159         NULL,                       /* setattrofunc tp_setattro; */
160
161         /* Functions to access object as input/output buffer */
162         NULL,                       /* PyBufferProcs *tp_as_buffer; */
163
164         /*** Flags to define presence of optional/expanded features ***/
165         Py_TPFLAGS_DEFAULT,         /* long tp_flags; */
166
167         NULL,                       /*  char *tp_doc;  Documentation string */
168         /*** Assigned meaning in release 2.0 ***/
169         /* call function for all accessible objects */
170         NULL,                       /* traverseproc tp_traverse; */
171
172         /* delete references to contained objects */
173         NULL,                       /* inquiry tp_clear; */
174
175         /***  Assigned meaning in release 2.1 ***/
176         /*** rich comparisons ***/
177         NULL,                       /* richcmpfunc tp_richcompare; */
178
179         /***  weak reference enabler ***/
180         0,                          /* long tp_weaklistoffset; */
181
182         /*** Added in release 2.2 ***/
183         /*   Iterators */
184         NULL, /* getiterfunc tp_iter; */
185         NULL,                       /* iternextfunc tp_iternext; */
186         /*** Attribute descriptor and subclassing stuff ***/
187         Buffer_methods,             /* struct PyMethodDef *tp_methods; */
188         NULL,                       /* struct PyMemberDef *tp_members; */
189         Buffer_getseters,           /* struct PyGetSetDef *tp_getset; */
190         NULL,                                           /*tp_base*/
191         NULL,                                           /*tp_dict*/
192         NULL,                                           /*tp_descr_get*/
193         NULL,                                           /*tp_descr_set*/
194         0,                                                      /*tp_dictoffset*/
195         NULL,                                           /*tp_init*/
196         NULL,                                           /*tp_alloc*/
197         Buffer_new,                                     /*tp_new*/
198         NULL,                                           /*tp_free*/
199         NULL,                                           /*tp_is_gc*/
200         NULL,                                           /*tp_bases*/
201         NULL,                                           /*tp_mro*/
202         NULL,                                           /*tp_cache*/
203         NULL,                                           /*tp_subclasses*/
204         NULL,                                           /*tp_weaklist*/
205         NULL                                            /*tp_del*/
206 };
207
208 #define BGL_Wrap(nargs, funcname, ret, arg_list)                              \
209 static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args)   \
210 {                                                                             \
211         arg_def##nargs arg_list;                                                  \
212         ret_def_##ret;                                                            \
213         if (!PyArg_ParseTuple(args,                                               \
214                               arg_str##nargs arg_list,                            \
215                               arg_ref##nargs arg_list))                           \
216         {                                                                         \
217                 return NULL;                                                          \
218         }                                                                         \
219         ret_set_##ret gl##funcname (arg_var##nargs arg_list);                     \
220         ret_ret_##ret;                                                            \
221 }
222
223 #define BGLU_Wrap(nargs, funcname, ret, arg_list)                             \
224 static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args)   \
225 {                                                                             \
226         arg_def##nargs arg_list;                                                  \
227         ret_def_##ret;                                                            \
228         if (!PyArg_ParseTuple(args,                                               \
229                                                   arg_str##nargs arg_list,                            \
230                                                   arg_ref##nargs arg_list))                           \
231         {                                                                         \
232                 return NULL;                                                          \
233         }                                                                         \
234         ret_set_##ret glu##funcname (arg_var##nargs arg_list);                    \
235         ret_ret_##ret;                                                            \
236 }
237
238 /********/
239 int BGL_typeSize(int type)
240 {
241         switch (type) {
242         case GL_BYTE:
243                 return sizeof(char);
244         case GL_SHORT:
245                 return sizeof(short);
246         case GL_INT:
247                 return sizeof(int);
248         case GL_FLOAT:
249                 return sizeof(float);
250         case GL_DOUBLE:
251                 return sizeof(double);
252         }
253         return -1;
254 }
255
256 Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuffer)
257 {
258         Buffer *buffer;
259         void *buf= NULL;
260         int i, size, length;
261  
262         length= 1;
263         for (i=0; i<ndimensions; i++) 
264                 length*= dimensions[i];
265  
266         size= BGL_typeSize(type);
267  
268         buf= MEM_mallocN(length*size, "Buffer buffer");
269
270         buffer= (Buffer *) PyObject_NEW(Buffer, &BGL_bufferType);
271         buffer->parent= NULL;
272         buffer->ndimensions= ndimensions;
273         buffer->dimensions= MEM_mallocN(ndimensions*sizeof(int), "Buffer dimensions");
274         memcpy(buffer->dimensions, dimensions, ndimensions*sizeof(int));
275         buffer->type= type;
276         buffer->buf.asvoid= buf;
277
278         if (initbuffer) {
279                 memcpy(buffer->buf.asvoid, initbuffer, length*size);
280         }
281         else {
282                 memset(buffer->buf.asvoid, 0, length*size);
283         }
284         return buffer;
285 }
286
287
288 #define MAX_DIMENSIONS  256
289 static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
290 {
291         PyObject *length_ob= NULL, *init= NULL;
292         Buffer *buffer;
293         int dimensions[MAX_DIMENSIONS];
294         
295         int type;
296         Py_ssize_t i, ndimensions = 0;
297
298         if (kwds && PyDict_Size(kwds)) {
299                 PyErr_SetString(PyExc_TypeError,
300                                 "bgl.Buffer(): takes no keyword args");
301                 return NULL;
302         }
303
304         if (!PyArg_ParseTuple(args, "iO|O: bgl.Buffer", &type, &length_ob, &init)) {
305                 return NULL;
306         }
307         if (!ELEM5(type, GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT, GL_DOUBLE)) {
308                 PyErr_SetString(PyExc_AttributeError,
309                                 "invalid first argument type, should be one of "
310                                 "GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT or GL_DOUBLE");
311                 return NULL;
312         }
313
314         if (PyLong_Check(length_ob)) {
315                 ndimensions= 1;
316                 if (((dimensions[0]= PyLong_AsLong(length_ob)) < 1)) {
317                         PyErr_SetString(PyExc_AttributeError,
318                                         "dimensions must be between 1 and "STRINGIFY(MAX_DIMENSIONS));
319                         return NULL;
320                 }
321         }
322         else if (PySequence_Check(length_ob)) {
323                 ndimensions= PySequence_Size(length_ob);
324                 if (ndimensions > MAX_DIMENSIONS) {
325                         PyErr_SetString(PyExc_AttributeError,
326                                         "too many dimensions, max is "STRINGIFY(MAX_DIMENSIONS));
327                         return NULL;
328                 }
329                 else if (ndimensions < 1) {
330                         PyErr_SetString(PyExc_AttributeError,
331                                         "sequence must have at least one dimension");
332                         return NULL;
333                 }
334                 for (i=0; i<ndimensions; i++) {
335                         PyObject *ob= PySequence_GetItem(length_ob, i);
336
337                         if (!PyLong_Check(ob)) dimensions[i]= 1;
338                         else dimensions[i]= PyLong_AsLong(ob);
339                         Py_DECREF(ob);
340
341                         if (dimensions[i] < 1) {
342                                 PyErr_SetString(PyExc_AttributeError,
343                                                 "dimensions must be between 1 and "STRINGIFY(MAX_DIMENSIONS));
344                                 return NULL;
345                         }
346                 }
347         }
348         else {
349                 PyErr_Format(PyExc_TypeError,
350                              "invalid second argument argument expected a sequence "
351                              "or an int, not a %.200s", Py_TYPE(length_ob)->tp_name);
352                 return NULL;
353         }
354         
355         buffer= BGL_MakeBuffer(type, ndimensions, dimensions, NULL);
356         if (init && ndimensions) {
357                 if (Buffer_ass_slice(buffer, 0, dimensions[0], init)) {
358                         Py_DECREF(buffer);
359                         return NULL;
360                 }
361         }
362         
363         return (PyObject *) buffer;
364 }
365
366 /*@ Buffer sequence methods */
367
368 static int Buffer_len(Buffer *self)
369 {
370         return self->dimensions[0];
371 }
372
373 static PyObject *Buffer_item(Buffer *self, int i)
374 {
375         if (i >= self->dimensions[0] || i < 0) {
376                 PyErr_SetString(PyExc_IndexError, "array index out of range");
377                 return NULL;
378         }
379
380         if (self->ndimensions==1) {
381                 switch (self->type) {
382                         case GL_BYTE: return Py_BuildValue("b", self->buf.asbyte[i]);
383                         case GL_SHORT: return Py_BuildValue("h", self->buf.asshort[i]);
384                         case GL_INT: return Py_BuildValue("i", self->buf.asint[i]);
385                         case GL_FLOAT: return PyFloat_FromDouble(self->buf.asfloat[i]);
386                         case GL_DOUBLE: return Py_BuildValue("d", self->buf.asdouble[i]);
387                 }
388         }
389         else {
390                 Buffer *newbuf;
391                 int j, length, size;
392
393                 length= 1;
394                 for (j=1; j < self->ndimensions; j++) {
395                         length *= self->dimensions[j];
396                 }
397                 size= BGL_typeSize(self->type);
398
399                 newbuf= (Buffer *) PyObject_NEW(Buffer, &BGL_bufferType);
400
401                 Py_INCREF(self);
402                 newbuf->parent= (PyObject *)self;
403
404                 newbuf->ndimensions= self->ndimensions - 1;
405                 newbuf->type= self->type;
406                 newbuf->buf.asvoid= self->buf.asbyte + i*length*size;
407                 newbuf->dimensions= MEM_mallocN(newbuf->ndimensions*sizeof(int),
408                         "Buffer dimensions");
409                 memcpy(newbuf->dimensions, self->dimensions+1,
410                         newbuf->ndimensions*sizeof(int));
411
412                 return (PyObject *) newbuf;
413         }
414
415         return NULL;
416 }
417
418 static PyObject *Buffer_slice(Buffer *self, int begin, int end)
419 {
420         PyObject *list;
421         int count;
422         
423         if (begin < 0) begin= 0;
424         if (end > self->dimensions[0]) end= self->dimensions[0];
425         if (begin > end) begin= end;
426           
427         list= PyList_New(end-begin);
428
429         for (count= begin; count<end; count++) {
430                 PyList_SET_ITEM(list, count-begin, Buffer_item(self, count));
431         }
432         return list;
433 }
434
435 static int Buffer_ass_item(Buffer *self, int i, PyObject *v)
436 {
437         if (i >= self->dimensions[0] || i < 0) {
438                 PyErr_SetString(PyExc_IndexError,
439                                 "array assignment index out of range");
440                 return -1;
441         }
442
443         if (self->ndimensions!=1) {
444                 Buffer *row= (Buffer *)Buffer_item(self, i);
445
446                 if (row) {
447                         int ret= Buffer_ass_slice(row, 0, self->dimensions[1], v);
448                         Py_DECREF(row);
449                         return ret;
450                 }
451                 else {
452                         return -1;
453                 }
454         }
455
456         switch (self->type) {
457         case GL_BYTE:
458                 return PyArg_Parse(v, "b:Expected ints", &self->buf.asbyte[i]) ? 0:-1;
459         case GL_SHORT:
460                 return PyArg_Parse(v, "h:Expected ints", &self->buf.asshort[i]) ? 0:-1;
461         case GL_INT:
462                 return PyArg_Parse(v, "i:Expected ints", &self->buf.asint[i]) ? 0:-1;
463         case GL_FLOAT:
464                 return PyArg_Parse(v, "f:Expected floats", &self->buf.asfloat[i]) ? 0:-1;
465         case GL_DOUBLE:
466                 return PyArg_Parse(v, "d:Expected floats", &self->buf.asdouble[i]) ? 0:-1;
467         default:
468                 return 0; /* should never happen */
469         }
470 }
471
472 static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
473 {
474         PyObject *item;
475         int count, err=0;
476         
477         if (begin < 0) begin= 0;
478         if (end > self->dimensions[0]) end= self->dimensions[0];
479         if (begin > end) begin= end;
480         
481         if (!PySequence_Check(seq)) {
482                 PyErr_Format(PyExc_TypeError,
483                              "buffer[:] = value, invalid assignment. "
484                              "Expected a sequence, not an %.200s type",
485                              Py_TYPE(seq)->tp_name);
486                 return -1;
487         }
488
489         /* re-use count var */
490         if ((count= PySequence_Size(seq)) != (end - begin)) {
491                 PyErr_Format(PyExc_TypeError,
492                              "buffer[:] = value, size mismatch in assignment. "
493                              "Expected: %d (given: %d)", count, end - begin);
494                 return -1;
495         }
496         
497         for (count= begin; count < end; count++) {
498                 item= PySequence_GetItem(seq, count - begin);
499                 if (item) {
500                         err= Buffer_ass_item(self, count, item);
501                         Py_DECREF(item);
502                 }
503                 else {
504                         err= -1;
505                 }
506                 if (err) break;
507         }
508         return err;
509 }
510
511 static PyObject *Buffer_subscript(Buffer *self, PyObject *item)
512 {
513         if (PyIndex_Check(item)) {
514                 Py_ssize_t i;
515                 i = PyNumber_AsSsize_t(item, PyExc_IndexError);
516                 if (i == -1 && PyErr_Occurred())
517                         return NULL;
518                 if (i < 0)
519                         i += self->dimensions[0];
520                 return Buffer_item(self, i);
521         }
522         else if (PySlice_Check(item)) {
523                 Py_ssize_t start, stop, step, slicelength;
524
525                 if (PySlice_GetIndicesEx((void *)item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
526                         return NULL;
527
528                 if (slicelength <= 0) {
529                         return PyTuple_New(0);
530                 }
531                 else if (step == 1) {
532                         return Buffer_slice(self, start, stop);
533                 }
534                 else {
535                         PyErr_SetString(PyExc_IndexError,
536                                         "slice steps not supported with vectors");
537                         return NULL;
538                 }
539         }
540         else {
541                 PyErr_Format(PyExc_TypeError,
542                              "buffer indices must be integers, not %.200s",
543                              Py_TYPE(item)->tp_name);
544                 return NULL;
545         }
546 }
547
548 static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value)
549 {
550         if (PyIndex_Check(item)) {
551                 Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
552                 if (i == -1 && PyErr_Occurred())
553                         return -1;
554                 if (i < 0)
555                         i += self->dimensions[0];
556                 return Buffer_ass_item(self, i, value);
557         }
558         else if (PySlice_Check(item)) {
559                 Py_ssize_t start, stop, step, slicelength;
560
561                 if (PySlice_GetIndicesEx((void *)item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
562                         return -1;
563
564                 if (step == 1)
565                         return Buffer_ass_slice(self, start, stop, value);
566                 else {
567                         PyErr_SetString(PyExc_IndexError,
568                                         "slice steps not supported with vectors");
569                         return -1;
570                 }
571         }
572         else {
573                 PyErr_Format(PyExc_TypeError,
574                              "buffer indices must be integers, not %.200s",
575                              Py_TYPE(item)->tp_name);
576                 return -1;
577         }
578 }
579
580
581 static void Buffer_dealloc(Buffer *self)
582 {
583         if (self->parent) Py_DECREF(self->parent);
584         else MEM_freeN (self->buf.asvoid);
585
586         MEM_freeN(self->dimensions);
587
588         PyObject_DEL(self);
589 }
590
591
592 static PyObject *Buffer_repr(Buffer *self)
593 {
594         PyObject *list= Buffer_to_list_recursive(self);
595         PyObject *repr;
596         const char *typestr= "UNKNOWN";
597
598         switch (self->type) {
599         case GL_BYTE:   typestr= "GL_BYTE"; break;
600         case GL_SHORT:  typestr= "GL_SHORT"; break;
601         case GL_INT:    typestr= "GL_BYTE"; break;
602         case GL_FLOAT:  typestr= "GL_FLOAT"; break;
603         case GL_DOUBLE: typestr= "GL_DOUBLE"; break;
604         }
605
606         repr= PyUnicode_FromFormat("Buffer(%s, %R)", typestr, list);
607         Py_DECREF(list);
608
609         return repr;
610 }
611
612
613 BGL_Wrap(2, Accum,          void,     (GLenum, GLfloat))
614 BGL_Wrap(2, AlphaFunc,      void,     (GLenum, GLclampf))
615 BGL_Wrap(3, AreTexturesResident,  GLboolean,  (GLsizei, GLuintP, GLbooleanP))
616 BGL_Wrap(1, Begin,          void,     (GLenum))
617 BGL_Wrap(2, BindTexture,    void,   (GLenum, GLuint))
618 BGL_Wrap(7, Bitmap,         void,     (GLsizei, GLsizei, GLfloat,
619                                                 GLfloat, GLfloat, GLfloat, GLubyteP))
620 BGL_Wrap(2, BlendFunc,        void,     (GLenum, GLenum))
621 BGL_Wrap(1, CallList,         void,     (GLuint))
622 BGL_Wrap(3, CallLists,        void,     (GLsizei, GLenum, GLvoidP))
623 BGL_Wrap(1, Clear,            void,     (GLbitfield))
624 BGL_Wrap(4, ClearAccum,       void,     (GLfloat, GLfloat, GLfloat, GLfloat))
625 BGL_Wrap(4, ClearColor,       void,     (GLclampf, GLclampf, GLclampf, GLclampf))
626 BGL_Wrap(1, ClearDepth,       void,     (GLclampd))
627 BGL_Wrap(1, ClearIndex,       void,     (GLfloat))
628 BGL_Wrap(1, ClearStencil,     void,     (GLint))
629 BGL_Wrap(2, ClipPlane,        void,     (GLenum, GLdoubleP))
630 BGL_Wrap(3, Color3b,          void,     (GLbyte, GLbyte, GLbyte))
631 BGL_Wrap(1, Color3bv,         void,     (GLbyteP))
632 BGL_Wrap(3, Color3d,          void,     (GLdouble, GLdouble, GLdouble))
633 BGL_Wrap(1, Color3dv,         void,     (GLdoubleP))
634 BGL_Wrap(3, Color3f,          void,     (GLfloat, GLfloat, GLfloat))
635 BGL_Wrap(1, Color3fv,         void,     (GLfloatP))
636 BGL_Wrap(3, Color3i,          void,     (GLint, GLint, GLint))
637 BGL_Wrap(1, Color3iv,         void,     (GLintP))
638 BGL_Wrap(3, Color3s,          void,     (GLshort, GLshort, GLshort))
639 BGL_Wrap(1, Color3sv,         void,     (GLshortP))
640 BGL_Wrap(3, Color3ub,         void,     (GLubyte, GLubyte, GLubyte))
641 BGL_Wrap(1, Color3ubv,        void,     (GLubyteP))
642 BGL_Wrap(3, Color3ui,         void,     (GLuint, GLuint, GLuint))
643 BGL_Wrap(1, Color3uiv,        void,     (GLuintP))
644 BGL_Wrap(3, Color3us,         void,     (GLushort, GLushort, GLushort))
645 BGL_Wrap(1, Color3usv,        void,     (GLushortP))
646 BGL_Wrap(4, Color4b,          void,     (GLbyte, GLbyte, GLbyte, GLbyte))
647 BGL_Wrap(1, Color4bv,         void,     (GLbyteP))
648 BGL_Wrap(4, Color4d,          void,     (GLdouble, GLdouble, GLdouble, GLdouble))
649 BGL_Wrap(1, Color4dv,         void,     (GLdoubleP))
650 BGL_Wrap(4, Color4f,          void,     (GLfloat, GLfloat, GLfloat, GLfloat))
651 BGL_Wrap(1, Color4fv,         void,     (GLfloatP))
652 BGL_Wrap(4, Color4i,          void,     (GLint, GLint, GLint, GLint))
653 BGL_Wrap(1, Color4iv,         void,     (GLintP))
654 BGL_Wrap(4, Color4s,          void,     (GLshort, GLshort, GLshort, GLshort))
655 BGL_Wrap(1, Color4sv,         void,     (GLshortP))
656 BGL_Wrap(4, Color4ub,         void,     (GLubyte, GLubyte, GLubyte, GLubyte))
657 BGL_Wrap(1, Color4ubv,        void,     (GLubyteP))
658 BGL_Wrap(4, Color4ui,         void,     (GLuint, GLuint, GLuint, GLuint))
659 BGL_Wrap(1, Color4uiv,        void,     (GLuintP))
660 BGL_Wrap(4, Color4us,         void,     (GLushort, GLushort, GLushort, GLushort))
661 BGL_Wrap(1, Color4usv,        void,     (GLushortP))
662 BGL_Wrap(4, ColorMask,        void,     (GLboolean, GLboolean, GLboolean, GLboolean))
663 BGL_Wrap(2, ColorMaterial,    void,     (GLenum, GLenum))
664 BGL_Wrap(5, CopyPixels,       void,     (GLint, GLint, GLsizei, GLsizei, GLenum))
665 BGL_Wrap(8, CopyTexImage2D,   void,     (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint))
666 BGL_Wrap(1, CullFace,         void,     (GLenum))
667 BGL_Wrap(2, DeleteLists,      void,     (GLuint, GLsizei))
668 BGL_Wrap(2, DeleteTextures,   void,   (GLsizei, GLuintP))
669 BGL_Wrap(1, DepthFunc,        void,     (GLenum))
670 BGL_Wrap(1, DepthMask,        void,     (GLboolean))
671 BGL_Wrap(2, DepthRange,       void,     (GLclampd, GLclampd))
672 BGL_Wrap(1, Disable,          void,     (GLenum))
673 BGL_Wrap(1, DrawBuffer,       void,     (GLenum))
674 BGL_Wrap(5, DrawPixels,       void,     (GLsizei, GLsizei, GLenum, GLenum, GLvoidP))
675 BGL_Wrap(1, EdgeFlag,         void,     (GLboolean))
676 BGL_Wrap(1, EdgeFlagv,        void,     (GLbooleanP))
677 BGL_Wrap(1, Enable,           void,     (GLenum))
678 BGL_Wrap(1, End,              void,     (void))
679 BGL_Wrap(1, EndList,          void,     (void))
680 BGL_Wrap(1, EvalCoord1d,      void,     (GLdouble))
681 BGL_Wrap(1, EvalCoord1dv,     void,     (GLdoubleP))
682 BGL_Wrap(1, EvalCoord1f,      void,     (GLfloat))
683 BGL_Wrap(1, EvalCoord1fv,     void,     (GLfloatP))
684 BGL_Wrap(2, EvalCoord2d,      void,     (GLdouble, GLdouble))
685 BGL_Wrap(1, EvalCoord2dv,     void,     (GLdoubleP))
686 BGL_Wrap(2, EvalCoord2f,      void,     (GLfloat, GLfloat))
687 BGL_Wrap(1, EvalCoord2fv,     void,     (GLfloatP))
688 BGL_Wrap(3, EvalMesh1,        void,     (GLenum, GLint, GLint))
689 BGL_Wrap(5, EvalMesh2,        void,     (GLenum, GLint, GLint, GLint, GLint))
690 BGL_Wrap(1, EvalPoint1,       void,     (GLint))
691 BGL_Wrap(2, EvalPoint2,       void,     (GLint, GLint))
692 BGL_Wrap(3, FeedbackBuffer,   void,     (GLsizei, GLenum, GLfloatP))
693 BGL_Wrap(1, Finish,           void,     (void))
694 BGL_Wrap(1, Flush,            void,     (void))
695 BGL_Wrap(2, Fogf,             void,     (GLenum, GLfloat))
696 BGL_Wrap(2, Fogfv,            void,     (GLenum, GLfloatP))
697 BGL_Wrap(2, Fogi,             void,     (GLenum, GLint))
698 BGL_Wrap(2, Fogiv,            void,     (GLenum, GLintP))
699 BGL_Wrap(1, FrontFace,        void,     (GLenum))
700 BGL_Wrap(6, Frustum,          void,     (GLdouble, GLdouble,
701                                                 GLdouble, GLdouble, GLdouble, GLdouble))
702 BGL_Wrap(1, GenLists,         GLuint,   (GLsizei))
703 BGL_Wrap(2, GenTextures,      void,   (GLsizei, GLuintP))
704 BGL_Wrap(2, GetBooleanv,      void,     (GLenum, GLbooleanP))
705 BGL_Wrap(2, GetClipPlane,     void,     (GLenum, GLdoubleP))
706 BGL_Wrap(2, GetDoublev,       void,     (GLenum, GLdoubleP))
707 BGL_Wrap(1, GetError,         GLenum,   (void))
708 BGL_Wrap(2, GetFloatv,        void,     (GLenum, GLfloatP))
709 BGL_Wrap(2, GetIntegerv,      void,     (GLenum, GLintP))
710 BGL_Wrap(3, GetLightfv,       void,     (GLenum, GLenum, GLfloatP))
711 BGL_Wrap(3, GetLightiv,       void,     (GLenum, GLenum, GLintP))
712 BGL_Wrap(3, GetMapdv,         void,     (GLenum, GLenum, GLdoubleP))
713 BGL_Wrap(3, GetMapfv,         void,     (GLenum, GLenum, GLfloatP))
714 BGL_Wrap(3, GetMapiv,         void,     (GLenum, GLenum, GLintP))
715 BGL_Wrap(3, GetMaterialfv,    void,     (GLenum, GLenum, GLfloatP))
716 BGL_Wrap(3, GetMaterialiv,    void,     (GLenum, GLenum, GLintP))
717 BGL_Wrap(2, GetPixelMapfv,    void,     (GLenum, GLfloatP))
718 BGL_Wrap(2, GetPixelMapuiv,   void,     (GLenum, GLuintP))
719 BGL_Wrap(2, GetPixelMapusv,   void,     (GLenum, GLushortP))
720 BGL_Wrap(1, GetPolygonStipple,void,     (GLubyteP))
721 BGL_Wrap(1, GetString,        GLstring,   (GLenum))
722 BGL_Wrap(3, GetTexEnvfv,      void,     (GLenum, GLenum, GLfloatP))
723 BGL_Wrap(3, GetTexEnviv,      void,     (GLenum, GLenum, GLintP))
724 BGL_Wrap(3, GetTexGendv,      void,     (GLenum, GLenum, GLdoubleP))
725 BGL_Wrap(3, GetTexGenfv,      void,     (GLenum, GLenum, GLfloatP))
726 BGL_Wrap(3, GetTexGeniv,      void,     (GLenum, GLenum, GLintP))
727 BGL_Wrap(5, GetTexImage,      void,     (GLenum, GLint, GLenum, GLenum, GLvoidP))
728 BGL_Wrap(4, GetTexLevelParameterfv, void,     (GLenum, GLint, GLenum, GLfloatP))
729 BGL_Wrap(4, GetTexLevelParameteriv, void,     (GLenum, GLint, GLenum, GLintP))
730 BGL_Wrap(3, GetTexParameterfv,    void,     (GLenum, GLenum, GLfloatP))
731 BGL_Wrap(3, GetTexParameteriv,    void,     (GLenum, GLenum, GLintP))
732 BGL_Wrap(2, Hint,           void,     (GLenum, GLenum))
733 BGL_Wrap(1, IndexMask,      void,     (GLuint))
734 BGL_Wrap(1, Indexd,         void,     (GLdouble))
735 BGL_Wrap(1, Indexdv,        void,     (GLdoubleP))
736 BGL_Wrap(1, Indexf,         void,     (GLfloat))
737 BGL_Wrap(1, Indexfv,        void,     (GLfloatP))
738 BGL_Wrap(1, Indexi,         void,     (GLint))
739 BGL_Wrap(1, Indexiv,        void,     (GLintP))
740 BGL_Wrap(1, Indexs,         void,     (GLshort))
741 BGL_Wrap(1, Indexsv,        void,     (GLshortP))
742 BGL_Wrap(1, InitNames,      void,     (void))
743 BGL_Wrap(1, IsEnabled,      GLboolean,  (GLenum))
744 BGL_Wrap(1, IsList,         GLboolean,  (GLuint))
745 BGL_Wrap(1, IsTexture,      GLboolean,  (GLuint))
746 BGL_Wrap(2, LightModelf,    void,     (GLenum, GLfloat))
747 BGL_Wrap(2, LightModelfv,   void,     (GLenum, GLfloatP))
748 BGL_Wrap(2, LightModeli,    void,     (GLenum, GLint))
749 BGL_Wrap(2, LightModeliv,   void,     (GLenum, GLintP))
750 BGL_Wrap(3, Lightf,         void,     (GLenum, GLenum, GLfloat))
751 BGL_Wrap(3, Lightfv,        void,     (GLenum, GLenum, GLfloatP))
752 BGL_Wrap(3, Lighti,         void,     (GLenum, GLenum, GLint))
753 BGL_Wrap(3, Lightiv,        void,     (GLenum, GLenum, GLintP))
754 BGL_Wrap(2, LineStipple,    void,     (GLint, GLushort))
755 BGL_Wrap(1, LineWidth,      void,     (GLfloat))
756 BGL_Wrap(1, ListBase,       void,     (GLuint))
757 BGL_Wrap(1, LoadIdentity,   void,     (void))
758 BGL_Wrap(1, LoadMatrixd,    void,     (GLdoubleP))
759 BGL_Wrap(1, LoadMatrixf,    void,     (GLfloatP))
760 BGL_Wrap(1, LoadName,       void,     (GLuint))
761 BGL_Wrap(1, LogicOp,        void,     (GLenum))
762 BGL_Wrap(6, Map1d,          void,     (GLenum, GLdouble, GLdouble,
763                                                 GLint, GLint, GLdoubleP))
764 BGL_Wrap(6, Map1f,          void,     (GLenum, GLfloat, GLfloat,
765                                                 GLint, GLint, GLfloatP))
766 BGL_Wrap(10, Map2d,         void,     (GLenum, GLdouble, GLdouble,
767                                                 GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdoubleP))
768 BGL_Wrap(10, Map2f,         void,     (GLenum, GLfloat, GLfloat,
769                                                 GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloatP))
770 BGL_Wrap(3, MapGrid1d,        void,     (GLint, GLdouble, GLdouble))
771 BGL_Wrap(3, MapGrid1f,        void,     (GLint, GLfloat, GLfloat))
772 BGL_Wrap(6, MapGrid2d,        void,     (GLint, GLdouble, GLdouble,
773                                                 GLint, GLdouble, GLdouble))
774 BGL_Wrap(6, MapGrid2f,        void,     (GLint, GLfloat, GLfloat,
775                                                 GLint, GLfloat, GLfloat))
776 BGL_Wrap(3, Materialf,        void,     (GLenum, GLenum, GLfloat))
777 BGL_Wrap(3, Materialfv,       void,     (GLenum, GLenum, GLfloatP))
778 BGL_Wrap(3, Materiali,        void,     (GLenum, GLenum, GLint))
779 BGL_Wrap(3, Materialiv,       void,     (GLenum, GLenum, GLintP))
780 BGL_Wrap(1, MatrixMode,       void,     (GLenum))
781 BGL_Wrap(1, MultMatrixd,      void,     (GLdoubleP))
782 BGL_Wrap(1, MultMatrixf,      void,     (GLfloatP))
783 BGL_Wrap(2, NewList,          void,     (GLuint, GLenum))
784 BGL_Wrap(3, Normal3b,         void,     (GLbyte, GLbyte, GLbyte))
785 BGL_Wrap(1, Normal3bv,        void,     (GLbyteP))
786 BGL_Wrap(3, Normal3d,         void,     (GLdouble, GLdouble, GLdouble))
787 BGL_Wrap(1, Normal3dv,        void,     (GLdoubleP))
788 BGL_Wrap(3, Normal3f,         void,     (GLfloat, GLfloat, GLfloat))
789 BGL_Wrap(1, Normal3fv,        void,     (GLfloatP))
790 BGL_Wrap(3, Normal3i,         void,     (GLint, GLint, GLint))
791 BGL_Wrap(1, Normal3iv,        void,     (GLintP))
792 BGL_Wrap(3, Normal3s,         void,     (GLshort, GLshort, GLshort))
793 BGL_Wrap(1, Normal3sv,        void,     (GLshortP))
794 BGL_Wrap(6, Ortho,            void,     (GLdouble, GLdouble,
795                                                 GLdouble, GLdouble, GLdouble, GLdouble))
796 BGL_Wrap(1, PassThrough,      void,     (GLfloat))
797 BGL_Wrap(3, PixelMapfv,       void,     (GLenum, GLint, GLfloatP))
798 BGL_Wrap(3, PixelMapuiv,      void,     (GLenum, GLint, GLuintP))
799 BGL_Wrap(3, PixelMapusv,      void,     (GLenum, GLint, GLushortP))
800 BGL_Wrap(2, PixelStoref,      void,     (GLenum, GLfloat))
801 BGL_Wrap(2, PixelStorei,      void,     (GLenum, GLint))
802 BGL_Wrap(2, PixelTransferf,   void,     (GLenum, GLfloat))
803 BGL_Wrap(2, PixelTransferi,   void,     (GLenum, GLint))
804 BGL_Wrap(2, PixelZoom,        void,     (GLfloat, GLfloat))
805 BGL_Wrap(1, PointSize,        void,     (GLfloat))
806 BGL_Wrap(2, PolygonMode,      void,     (GLenum, GLenum))
807 BGL_Wrap(2, PolygonOffset,    void,     (GLfloat, GLfloat))
808 BGL_Wrap(1, PolygonStipple,   void,     (GLubyteP))
809 BGL_Wrap(1, PopAttrib,        void,     (void))
810 BGL_Wrap(1, PopClientAttrib,  void,     (void))
811 BGL_Wrap(1, PopMatrix,        void,     (void))
812 BGL_Wrap(1, PopName,          void,     (void))
813 BGL_Wrap(3, PrioritizeTextures,   void,   (GLsizei, GLuintP, GLclampfP))
814 BGL_Wrap(1, PushAttrib,       void,     (GLbitfield))
815 BGL_Wrap(1, PushClientAttrib, void,     (GLbitfield))
816 BGL_Wrap(1, PushMatrix,       void,     (void))
817 BGL_Wrap(1, PushName,         void,     (GLuint))
818 BGL_Wrap(2, RasterPos2d,      void,     (GLdouble, GLdouble))
819 BGL_Wrap(1, RasterPos2dv,     void,     (GLdoubleP))
820 BGL_Wrap(2, RasterPos2f,      void,     (GLfloat, GLfloat))
821 BGL_Wrap(1, RasterPos2fv,     void,     (GLfloatP))
822 BGL_Wrap(2, RasterPos2i,      void,     (GLint, GLint))
823 BGL_Wrap(1, RasterPos2iv,     void,     (GLintP))
824 BGL_Wrap(2, RasterPos2s,      void,     (GLshort, GLshort))
825 BGL_Wrap(1, RasterPos2sv,     void,     (GLshortP))
826 BGL_Wrap(3, RasterPos3d,      void,     (GLdouble, GLdouble, GLdouble))
827 BGL_Wrap(1, RasterPos3dv,     void,     (GLdoubleP))
828 BGL_Wrap(3, RasterPos3f,      void,     (GLfloat, GLfloat, GLfloat))
829 BGL_Wrap(1, RasterPos3fv,     void,     (GLfloatP))
830 BGL_Wrap(3, RasterPos3i,      void,     (GLint, GLint, GLint))
831 BGL_Wrap(1, RasterPos3iv,     void,     (GLintP))
832 BGL_Wrap(3, RasterPos3s,      void,     (GLshort, GLshort, GLshort))
833 BGL_Wrap(1, RasterPos3sv,     void,     (GLshortP))
834 BGL_Wrap(4, RasterPos4d,      void,     (GLdouble, GLdouble, GLdouble, GLdouble))
835 BGL_Wrap(1, RasterPos4dv,     void,     (GLdoubleP))
836 BGL_Wrap(4, RasterPos4f,      void,     (GLfloat, GLfloat, GLfloat, GLfloat))
837 BGL_Wrap(1, RasterPos4fv,     void,     (GLfloatP))
838 BGL_Wrap(4, RasterPos4i,      void,     (GLint, GLint, GLint, GLint))
839 BGL_Wrap(1, RasterPos4iv,     void,     (GLintP))
840 BGL_Wrap(4, RasterPos4s,      void,     (GLshort, GLshort, GLshort, GLshort))
841 BGL_Wrap(1, RasterPos4sv,     void,     (GLshortP))
842 BGL_Wrap(1, ReadBuffer,       void,     (GLenum))
843 BGL_Wrap(7, ReadPixels,       void,     (GLint, GLint, GLsizei,
844                                                 GLsizei, GLenum, GLenum, GLvoidP))
845 BGL_Wrap(4, Rectd,          void,     (GLdouble, GLdouble, GLdouble, GLdouble))
846 BGL_Wrap(2, Rectdv,         void,     (GLdoubleP, GLdoubleP))
847 BGL_Wrap(4, Rectf,          void,     (GLfloat, GLfloat, GLfloat, GLfloat))
848 BGL_Wrap(2, Rectfv,         void,     (GLfloatP, GLfloatP))
849 BGL_Wrap(4, Recti,          void,     (GLint, GLint, GLint, GLint))
850 BGL_Wrap(2, Rectiv,         void,     (GLintP, GLintP))
851 BGL_Wrap(4, Rects,          void,     (GLshort, GLshort, GLshort, GLshort))
852 BGL_Wrap(2, Rectsv,         void,     (GLshortP, GLshortP))
853 BGL_Wrap(1, RenderMode,     GLint,    (GLenum))
854 BGL_Wrap(4, Rotated,        void,     (GLdouble, GLdouble, GLdouble, GLdouble))
855 BGL_Wrap(4, Rotatef,        void,     (GLfloat, GLfloat, GLfloat, GLfloat))
856 BGL_Wrap(3, Scaled,         void,     (GLdouble, GLdouble, GLdouble))
857 BGL_Wrap(3, Scalef,         void,     (GLfloat, GLfloat, GLfloat))
858 BGL_Wrap(4, Scissor,        void,     (GLint, GLint, GLsizei, GLsizei))
859 BGL_Wrap(2, SelectBuffer,   void,     (GLsizei, GLuintP))
860 BGL_Wrap(1, ShadeModel,       void,     (GLenum))
861 BGL_Wrap(3, StencilFunc,      void,     (GLenum, GLint, GLuint))
862 BGL_Wrap(1, StencilMask,      void,     (GLuint))
863 BGL_Wrap(3, StencilOp,        void,     (GLenum, GLenum, GLenum))
864 BGL_Wrap(1, TexCoord1d,       void,     (GLdouble))
865 BGL_Wrap(1, TexCoord1dv,      void,     (GLdoubleP))
866 BGL_Wrap(1, TexCoord1f,       void,     (GLfloat))
867 BGL_Wrap(1, TexCoord1fv,      void,     (GLfloatP))
868 BGL_Wrap(1, TexCoord1i,       void,     (GLint))
869 BGL_Wrap(1, TexCoord1iv,      void,     (GLintP))
870 BGL_Wrap(1, TexCoord1s,       void,     (GLshort))
871 BGL_Wrap(1, TexCoord1sv,      void,     (GLshortP))
872 BGL_Wrap(2, TexCoord2d,       void,     (GLdouble, GLdouble))
873 BGL_Wrap(1, TexCoord2dv,      void,     (GLdoubleP))
874 BGL_Wrap(2, TexCoord2f,       void,     (GLfloat, GLfloat))
875 BGL_Wrap(1, TexCoord2fv,      void,     (GLfloatP))
876 BGL_Wrap(2, TexCoord2i,       void,     (GLint, GLint))
877 BGL_Wrap(1, TexCoord2iv,      void,     (GLintP))
878 BGL_Wrap(2, TexCoord2s,       void,     (GLshort, GLshort))
879 BGL_Wrap(1, TexCoord2sv,      void,     (GLshortP))
880 BGL_Wrap(3, TexCoord3d,       void,     (GLdouble, GLdouble, GLdouble))
881 BGL_Wrap(1, TexCoord3dv,      void,     (GLdoubleP))
882 BGL_Wrap(3, TexCoord3f,       void,     (GLfloat, GLfloat, GLfloat))
883 BGL_Wrap(1, TexCoord3fv,      void,     (GLfloatP))
884 BGL_Wrap(3, TexCoord3i,       void,     (GLint, GLint, GLint))
885 BGL_Wrap(1, TexCoord3iv,      void,     (GLintP))
886 BGL_Wrap(3, TexCoord3s,       void,     (GLshort, GLshort, GLshort))
887 BGL_Wrap(1, TexCoord3sv,      void,     (GLshortP))
888 BGL_Wrap(4, TexCoord4d,       void,     (GLdouble, GLdouble, GLdouble, GLdouble))
889 BGL_Wrap(1, TexCoord4dv,      void,     (GLdoubleP))
890 BGL_Wrap(4, TexCoord4f,       void,     (GLfloat, GLfloat, GLfloat, GLfloat))
891 BGL_Wrap(1, TexCoord4fv,      void,     (GLfloatP))
892 BGL_Wrap(4, TexCoord4i,       void,     (GLint, GLint, GLint, GLint))
893 BGL_Wrap(1, TexCoord4iv,      void,     (GLintP))
894 BGL_Wrap(4, TexCoord4s,       void,     (GLshort, GLshort, GLshort, GLshort))
895 BGL_Wrap(1, TexCoord4sv,      void,     (GLshortP))
896 BGL_Wrap(3, TexEnvf,        void,     (GLenum, GLenum, GLfloat))
897 BGL_Wrap(3, TexEnvfv,       void,     (GLenum, GLenum, GLfloatP))
898 BGL_Wrap(3, TexEnvi,        void,     (GLenum, GLenum, GLint))
899 BGL_Wrap(3, TexEnviv,       void,     (GLenum, GLenum, GLintP))
900 BGL_Wrap(3, TexGend,        void,     (GLenum, GLenum, GLdouble))
901 BGL_Wrap(3, TexGendv,       void,     (GLenum, GLenum, GLdoubleP))
902 BGL_Wrap(3, TexGenf,        void,     (GLenum, GLenum, GLfloat))
903 BGL_Wrap(3, TexGenfv,       void,     (GLenum, GLenum, GLfloatP))
904 BGL_Wrap(3, TexGeni,        void,     (GLenum, GLenum, GLint))
905 BGL_Wrap(3, TexGeniv,       void,     (GLenum, GLenum, GLintP))
906 BGL_Wrap(8, TexImage1D,     void,     (GLenum, GLint, GLint,
907                                                 GLsizei, GLint, GLenum, GLenum, GLvoidP))
908 BGL_Wrap(9, TexImage2D,     void,     (GLenum, GLint, GLint,
909                                                 GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP))
910 BGL_Wrap(3, TexParameterf,      void,     (GLenum, GLenum, GLfloat))
911 BGL_Wrap(3, TexParameterfv,     void,     (GLenum, GLenum, GLfloatP))
912 BGL_Wrap(3, TexParameteri,      void,     (GLenum, GLenum, GLint))
913 BGL_Wrap(3, TexParameteriv,     void,     (GLenum, GLenum, GLintP))
914 BGL_Wrap(3, Translated,         void,     (GLdouble, GLdouble, GLdouble))
915 BGL_Wrap(3, Translatef,         void,     (GLfloat, GLfloat, GLfloat))
916 BGL_Wrap(2, Vertex2d,           void,     (GLdouble, GLdouble))
917 BGL_Wrap(1, Vertex2dv,          void,     (GLdoubleP))
918 BGL_Wrap(2, Vertex2f,           void,     (GLfloat, GLfloat))
919 BGL_Wrap(1, Vertex2fv,          void,     (GLfloatP))
920 BGL_Wrap(2, Vertex2i,           void,     (GLint, GLint))
921 BGL_Wrap(1, Vertex2iv,          void,     (GLintP))
922 BGL_Wrap(2, Vertex2s,           void,     (GLshort, GLshort))
923 BGL_Wrap(1, Vertex2sv,          void,     (GLshortP))
924 BGL_Wrap(3, Vertex3d,           void,     (GLdouble, GLdouble, GLdouble))
925 BGL_Wrap(1, Vertex3dv,          void,     (GLdoubleP))
926 BGL_Wrap(3, Vertex3f,           void,     (GLfloat, GLfloat, GLfloat))
927 BGL_Wrap(1, Vertex3fv,          void,     (GLfloatP))
928 BGL_Wrap(3, Vertex3i,           void,     (GLint, GLint, GLint))
929 BGL_Wrap(1, Vertex3iv,          void,     (GLintP))
930 BGL_Wrap(3, Vertex3s,           void,     (GLshort, GLshort, GLshort))
931 BGL_Wrap(1, Vertex3sv,          void,     (GLshortP))
932 BGL_Wrap(4, Vertex4d,           void,     (GLdouble, GLdouble, GLdouble, GLdouble))
933 BGL_Wrap(1, Vertex4dv,          void,     (GLdoubleP))
934 BGL_Wrap(4, Vertex4f,           void,     (GLfloat, GLfloat, GLfloat, GLfloat))
935 BGL_Wrap(1, Vertex4fv,          void,     (GLfloatP))
936 BGL_Wrap(4, Vertex4i,           void,     (GLint, GLint, GLint, GLint))
937 BGL_Wrap(1, Vertex4iv,          void,     (GLintP))
938 BGL_Wrap(4, Vertex4s,           void,     (GLshort, GLshort, GLshort, GLshort))
939 BGL_Wrap(1, Vertex4sv,          void,     (GLshortP))
940 BGL_Wrap(4, Viewport,           void,     (GLint, GLint, GLsizei, GLsizei))
941 BGLU_Wrap(4, Perspective,       void,           (GLdouble, GLdouble, GLdouble, GLdouble))
942 BGLU_Wrap(9, LookAt,                    void,           (GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble))
943 BGLU_Wrap(4, Ortho2D,           void,           (GLdouble, GLdouble, GLdouble, GLdouble))
944 BGLU_Wrap(5, PickMatrix,        void,           (GLdouble, GLdouble, GLdouble, GLdouble, GLintP))
945 BGLU_Wrap(9, Project,                   GLint,          (GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
946 BGLU_Wrap(9, UnProject,                 GLint,          (GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
947
948 #undef MethodDef
949 #define MethodDef(func) {"gl"#func, Method_##func, METH_VARARGS, "no string"}
950 #define MethodDefu(func) {"glu"#func, Method_##func, METH_VARARGS, "no string"}
951 /* So that MethodDef(Accum) becomes:
952  * {"glAccum", Method_Accumfunc, METH_VARARGS} */
953
954 static struct PyMethodDef BGL_methods[] = {
955
956 /* #ifndef __APPLE__ */
957         MethodDef(Accum),
958         MethodDef(AlphaFunc),
959         MethodDef(AreTexturesResident), 
960         MethodDef(Begin),
961         MethodDef(BindTexture), 
962         MethodDef(Bitmap),
963         MethodDef(BlendFunc),
964         MethodDef(CallList),
965         MethodDef(CallLists),
966         MethodDef(Clear),
967         MethodDef(ClearAccum),
968         MethodDef(ClearColor),
969         MethodDef(ClearDepth),
970         MethodDef(ClearIndex),
971         MethodDef(ClearStencil),
972         MethodDef(ClipPlane),
973         MethodDef(Color3b),
974         MethodDef(Color3bv),
975         MethodDef(Color3d),
976         MethodDef(Color3dv),
977         MethodDef(Color3f),
978         MethodDef(Color3fv),
979         MethodDef(Color3i),
980         MethodDef(Color3iv),
981         MethodDef(Color3s),
982         MethodDef(Color3sv),
983         MethodDef(Color3ub),
984         MethodDef(Color3ubv),
985         MethodDef(Color3ui),
986         MethodDef(Color3uiv),
987         MethodDef(Color3us),
988         MethodDef(Color3usv),
989         MethodDef(Color4b),
990         MethodDef(Color4bv),
991         MethodDef(Color4d),
992         MethodDef(Color4dv),
993         MethodDef(Color4f),
994         MethodDef(Color4fv),
995         MethodDef(Color4i),
996         MethodDef(Color4iv),
997         MethodDef(Color4s),
998         MethodDef(Color4sv),
999         MethodDef(Color4ub),
1000         MethodDef(Color4ubv),
1001         MethodDef(Color4ui),
1002         MethodDef(Color4uiv),
1003         MethodDef(Color4us),
1004         MethodDef(Color4usv),
1005         MethodDef(ColorMask),
1006         MethodDef(ColorMaterial),
1007         MethodDef(CopyPixels),
1008         MethodDef(CopyTexImage2D),
1009         MethodDef(CullFace),
1010         MethodDef(DeleteLists),
1011         MethodDef(DeleteTextures),
1012         MethodDef(DepthFunc),
1013         MethodDef(DepthMask),
1014         MethodDef(DepthRange),
1015         MethodDef(Disable),
1016         MethodDef(DrawBuffer),
1017         MethodDef(DrawPixels),
1018         MethodDef(EdgeFlag),
1019         MethodDef(EdgeFlagv),
1020         MethodDef(Enable),
1021         MethodDef(End),
1022         MethodDef(EndList),
1023         MethodDef(EvalCoord1d),
1024         MethodDef(EvalCoord1dv),
1025         MethodDef(EvalCoord1f),
1026         MethodDef(EvalCoord1fv),
1027         MethodDef(EvalCoord2d),
1028         MethodDef(EvalCoord2dv),
1029         MethodDef(EvalCoord2f),
1030         MethodDef(EvalCoord2fv),
1031         MethodDef(EvalMesh1),
1032         MethodDef(EvalMesh2),
1033         MethodDef(EvalPoint1),
1034         MethodDef(EvalPoint2),
1035         MethodDef(FeedbackBuffer),
1036         MethodDef(Finish),
1037         MethodDef(Flush),
1038         MethodDef(Fogf),
1039         MethodDef(Fogfv),
1040         MethodDef(Fogi),
1041         MethodDef(Fogiv),
1042         MethodDef(FrontFace),
1043         MethodDef(Frustum),
1044         MethodDef(GenLists),
1045         MethodDef(GenTextures), 
1046         MethodDef(GetBooleanv),
1047         MethodDef(GetClipPlane),
1048         MethodDef(GetDoublev),
1049         MethodDef(GetError),
1050         MethodDef(GetFloatv),
1051         MethodDef(GetIntegerv),
1052         MethodDef(GetLightfv),
1053         MethodDef(GetLightiv),
1054         MethodDef(GetMapdv),
1055         MethodDef(GetMapfv),
1056         MethodDef(GetMapiv),
1057         MethodDef(GetMaterialfv),
1058         MethodDef(GetMaterialiv),
1059         MethodDef(GetPixelMapfv),
1060         MethodDef(GetPixelMapuiv),
1061         MethodDef(GetPixelMapusv),
1062         MethodDef(GetPolygonStipple),
1063         MethodDef(GetString),
1064         MethodDef(GetTexEnvfv),
1065         MethodDef(GetTexEnviv),
1066         MethodDef(GetTexGendv),
1067         MethodDef(GetTexGenfv),
1068         MethodDef(GetTexGeniv),
1069         MethodDef(GetTexImage),
1070         MethodDef(GetTexLevelParameterfv),
1071         MethodDef(GetTexLevelParameteriv),
1072         MethodDef(GetTexParameterfv),
1073         MethodDef(GetTexParameteriv),
1074         MethodDef(Hint),
1075         MethodDef(IndexMask),
1076         MethodDef(Indexd),
1077         MethodDef(Indexdv),
1078         MethodDef(Indexf),
1079         MethodDef(Indexfv),
1080         MethodDef(Indexi),
1081         MethodDef(Indexiv),
1082         MethodDef(Indexs),
1083         MethodDef(Indexsv),
1084         MethodDef(InitNames),
1085         MethodDef(IsEnabled),
1086         MethodDef(IsList),
1087         MethodDef(IsTexture), 
1088         MethodDef(LightModelf),
1089         MethodDef(LightModelfv),
1090         MethodDef(LightModeli),
1091         MethodDef(LightModeliv),
1092         MethodDef(Lightf),
1093         MethodDef(Lightfv),
1094         MethodDef(Lighti),
1095         MethodDef(Lightiv),
1096         MethodDef(LineStipple),
1097         MethodDef(LineWidth),
1098         MethodDef(ListBase),
1099         MethodDef(LoadIdentity),
1100         MethodDef(LoadMatrixd),
1101         MethodDef(LoadMatrixf),
1102         MethodDef(LoadName),
1103         MethodDef(LogicOp),
1104         MethodDef(Map1d),
1105         MethodDef(Map1f),
1106         MethodDef(Map2d),
1107         MethodDef(Map2f),
1108         MethodDef(MapGrid1d),
1109         MethodDef(MapGrid1f),
1110         MethodDef(MapGrid2d),
1111         MethodDef(MapGrid2f),
1112         MethodDef(Materialf),
1113         MethodDef(Materialfv),
1114         MethodDef(Materiali),
1115         MethodDef(Materialiv),
1116         MethodDef(MatrixMode),
1117         MethodDef(MultMatrixd),
1118         MethodDef(MultMatrixf),
1119         MethodDef(NewList),
1120         MethodDef(Normal3b),
1121         MethodDef(Normal3bv),
1122         MethodDef(Normal3d),
1123         MethodDef(Normal3dv),
1124         MethodDef(Normal3f),
1125         MethodDef(Normal3fv),
1126         MethodDef(Normal3i),
1127         MethodDef(Normal3iv),
1128         MethodDef(Normal3s),
1129         MethodDef(Normal3sv),
1130         MethodDef(Ortho),
1131         MethodDef(PassThrough),
1132         MethodDef(PixelMapfv),
1133         MethodDef(PixelMapuiv),
1134         MethodDef(PixelMapusv),
1135         MethodDef(PixelStoref),
1136         MethodDef(PixelStorei),
1137         MethodDef(PixelTransferf),
1138         MethodDef(PixelTransferi),
1139         MethodDef(PixelZoom),
1140         MethodDef(PointSize),
1141         MethodDef(PolygonMode),
1142         MethodDef(PolygonOffset),
1143         MethodDef(PolygonStipple),
1144         MethodDef(PopAttrib),
1145         MethodDef(PopClientAttrib),
1146         MethodDef(PopMatrix),
1147         MethodDef(PopName),
1148         MethodDef(PrioritizeTextures), 
1149         MethodDef(PushAttrib),
1150         MethodDef(PushClientAttrib),
1151         MethodDef(PushMatrix),
1152         MethodDef(PushName),
1153         MethodDef(RasterPos2d),
1154         MethodDef(RasterPos2dv),
1155         MethodDef(RasterPos2f),
1156         MethodDef(RasterPos2fv),
1157         MethodDef(RasterPos2i),
1158         MethodDef(RasterPos2iv),
1159         MethodDef(RasterPos2s),
1160         MethodDef(RasterPos2sv),
1161         MethodDef(RasterPos3d),
1162         MethodDef(RasterPos3dv),
1163         MethodDef(RasterPos3f),
1164         MethodDef(RasterPos3fv),
1165         MethodDef(RasterPos3i),
1166         MethodDef(RasterPos3iv),
1167         MethodDef(RasterPos3s),
1168         MethodDef(RasterPos3sv),
1169         MethodDef(RasterPos4d),
1170         MethodDef(RasterPos4dv),
1171         MethodDef(RasterPos4f),
1172         MethodDef(RasterPos4fv),
1173         MethodDef(RasterPos4i),
1174         MethodDef(RasterPos4iv),
1175         MethodDef(RasterPos4s),
1176         MethodDef(RasterPos4sv),
1177         MethodDef(ReadBuffer),
1178         MethodDef(ReadPixels),
1179         MethodDef(Rectd),
1180         MethodDef(Rectdv),
1181         MethodDef(Rectf),
1182         MethodDef(Rectfv),
1183         MethodDef(Recti),
1184         MethodDef(Rectiv),
1185         MethodDef(Rects),
1186         MethodDef(Rectsv),
1187         MethodDef(RenderMode),
1188         MethodDef(Rotated),
1189         MethodDef(Rotatef),
1190         MethodDef(Scaled),
1191         MethodDef(Scalef),
1192         MethodDef(Scissor),
1193         MethodDef(SelectBuffer),
1194         MethodDef(ShadeModel),
1195         MethodDef(StencilFunc),
1196         MethodDef(StencilMask),
1197         MethodDef(StencilOp),
1198         MethodDef(TexCoord1d),
1199         MethodDef(TexCoord1dv),
1200         MethodDef(TexCoord1f),
1201         MethodDef(TexCoord1fv),
1202         MethodDef(TexCoord1i),
1203         MethodDef(TexCoord1iv),
1204         MethodDef(TexCoord1s),
1205         MethodDef(TexCoord1sv),
1206         MethodDef(TexCoord2d),
1207         MethodDef(TexCoord2dv),
1208         MethodDef(TexCoord2f),
1209         MethodDef(TexCoord2fv),
1210         MethodDef(TexCoord2i),
1211         MethodDef(TexCoord2iv),
1212         MethodDef(TexCoord2s),
1213         MethodDef(TexCoord2sv),
1214         MethodDef(TexCoord3d),
1215         MethodDef(TexCoord3dv),
1216         MethodDef(TexCoord3f),
1217         MethodDef(TexCoord3fv),
1218         MethodDef(TexCoord3i),
1219         MethodDef(TexCoord3iv),
1220         MethodDef(TexCoord3s),
1221         MethodDef(TexCoord3sv),
1222         MethodDef(TexCoord4d),
1223         MethodDef(TexCoord4dv),
1224         MethodDef(TexCoord4f),
1225         MethodDef(TexCoord4fv),
1226         MethodDef(TexCoord4i),
1227         MethodDef(TexCoord4iv),
1228         MethodDef(TexCoord4s),
1229         MethodDef(TexCoord4sv),
1230         MethodDef(TexEnvf),
1231         MethodDef(TexEnvfv),
1232         MethodDef(TexEnvi),
1233         MethodDef(TexEnviv),
1234         MethodDef(TexGend),
1235         MethodDef(TexGendv),
1236         MethodDef(TexGenf),
1237         MethodDef(TexGenfv),
1238         MethodDef(TexGeni),
1239         MethodDef(TexGeniv),
1240         MethodDef(TexImage1D),
1241         MethodDef(TexImage2D),
1242         MethodDef(TexParameterf),
1243         MethodDef(TexParameterfv),
1244         MethodDef(TexParameteri),
1245         MethodDef(TexParameteriv),
1246         MethodDef(Translated),
1247         MethodDef(Translatef),
1248         MethodDef(Vertex2d),
1249         MethodDef(Vertex2dv),
1250         MethodDef(Vertex2f),
1251         MethodDef(Vertex2fv),
1252         MethodDef(Vertex2i),
1253         MethodDef(Vertex2iv),
1254         MethodDef(Vertex2s),
1255         MethodDef(Vertex2sv),
1256         MethodDef(Vertex3d),
1257         MethodDef(Vertex3dv),
1258         MethodDef(Vertex3f),
1259         MethodDef(Vertex3fv),
1260         MethodDef(Vertex3i),
1261         MethodDef(Vertex3iv),
1262         MethodDef(Vertex3s),
1263         MethodDef(Vertex3sv),
1264         MethodDef(Vertex4d),
1265         MethodDef(Vertex4dv),
1266         MethodDef(Vertex4f),
1267         MethodDef(Vertex4fv),
1268         MethodDef(Vertex4i),
1269         MethodDef(Vertex4iv),
1270         MethodDef(Vertex4s),
1271         MethodDef(Vertex4sv),
1272         MethodDef(Viewport),
1273         MethodDefu(Perspective),
1274         MethodDefu(LookAt),
1275         MethodDefu(Ortho2D),
1276         MethodDefu(PickMatrix),
1277         MethodDefu(Project),
1278         MethodDefu(UnProject),
1279 /* #endif */
1280         {NULL, NULL, 0, NULL}
1281 };
1282
1283 static struct PyModuleDef BGL_module_def = {
1284         PyModuleDef_HEAD_INIT,
1285         "bgl",  /* m_name */
1286         NULL,  /* m_doc */
1287         0,  /* m_size */
1288         BGL_methods,  /* m_methods */
1289         NULL,  /* m_reload */
1290         NULL,  /* m_traverse */
1291         NULL,  /* m_clear */
1292         NULL,  /* m_free */
1293 };
1294
1295
1296 PyObject *BPyInit_bgl(void)
1297 {
1298         PyObject *submodule, *dict, *item;
1299         submodule= PyModule_Create(&BGL_module_def);
1300         dict= PyModule_GetDict(submodule);
1301         
1302         if (PyType_Ready(&BGL_bufferType) < 0)
1303                 return NULL; /* should never happen */
1304
1305
1306         PyModule_AddObject(submodule, "Buffer", (PyObject *)&BGL_bufferType);
1307         Py_INCREF((PyObject *)&BGL_bufferType);
1308
1309 #define EXPP_ADDCONST(x) PyDict_SetItemString(dict, #x, item=PyLong_FromLong((int)x)); Py_DECREF(item)
1310
1311 /* So, for example:
1312  * EXPP_ADDCONST(GL_CURRENT_BIT) becomes
1313  * PyDict_SetItemString(dict, "GL_CURRENT_BIT", item=PyLong_FromLong(GL_CURRENT_BIT)); Py_DECREF(item) */
1314
1315         EXPP_ADDCONST(GL_CURRENT_BIT);
1316         EXPP_ADDCONST(GL_POINT_BIT);
1317         EXPP_ADDCONST(GL_LINE_BIT);
1318         EXPP_ADDCONST(GL_POLYGON_BIT);
1319         EXPP_ADDCONST(GL_POLYGON_STIPPLE_BIT);
1320         EXPP_ADDCONST(GL_PIXEL_MODE_BIT);
1321         EXPP_ADDCONST(GL_LIGHTING_BIT);
1322         EXPP_ADDCONST(GL_FOG_BIT);
1323         EXPP_ADDCONST(GL_DEPTH_BUFFER_BIT);
1324         EXPP_ADDCONST(GL_ACCUM_BUFFER_BIT);
1325         EXPP_ADDCONST(GL_STENCIL_BUFFER_BIT);
1326         EXPP_ADDCONST(GL_VIEWPORT_BIT);
1327         EXPP_ADDCONST(GL_TRANSFORM_BIT);
1328         EXPP_ADDCONST(GL_ENABLE_BIT);
1329         EXPP_ADDCONST(GL_COLOR_BUFFER_BIT);
1330         EXPP_ADDCONST(GL_HINT_BIT);
1331         EXPP_ADDCONST(GL_EVAL_BIT);
1332         EXPP_ADDCONST(GL_LIST_BIT);
1333         EXPP_ADDCONST(GL_TEXTURE_BIT);
1334         EXPP_ADDCONST(GL_SCISSOR_BIT);
1335         EXPP_ADDCONST(GL_ALL_ATTRIB_BITS);
1336         EXPP_ADDCONST(GL_CLIENT_ALL_ATTRIB_BITS);
1337         
1338         EXPP_ADDCONST(GL_FALSE);
1339         EXPP_ADDCONST(GL_TRUE);
1340
1341         EXPP_ADDCONST(GL_POINTS);
1342         EXPP_ADDCONST(GL_LINES);
1343         EXPP_ADDCONST(GL_LINE_LOOP);
1344         EXPP_ADDCONST(GL_LINE_STRIP);
1345         EXPP_ADDCONST(GL_TRIANGLES);
1346         EXPP_ADDCONST(GL_TRIANGLE_STRIP);
1347         EXPP_ADDCONST(GL_TRIANGLE_FAN);
1348         EXPP_ADDCONST(GL_QUADS);
1349         EXPP_ADDCONST(GL_QUAD_STRIP);
1350         EXPP_ADDCONST(GL_POLYGON);
1351
1352         EXPP_ADDCONST(GL_ACCUM);
1353         EXPP_ADDCONST(GL_LOAD);
1354         EXPP_ADDCONST(GL_RETURN);
1355         EXPP_ADDCONST(GL_MULT);
1356         EXPP_ADDCONST(GL_ADD);
1357
1358         EXPP_ADDCONST(GL_NEVER);
1359         EXPP_ADDCONST(GL_LESS);
1360         EXPP_ADDCONST(GL_EQUAL);
1361         EXPP_ADDCONST(GL_LEQUAL);
1362         EXPP_ADDCONST(GL_GREATER);
1363         EXPP_ADDCONST(GL_NOTEQUAL);
1364         EXPP_ADDCONST(GL_GEQUAL);
1365         EXPP_ADDCONST(GL_ALWAYS);
1366
1367         EXPP_ADDCONST(GL_ZERO);
1368         EXPP_ADDCONST(GL_ONE);
1369         EXPP_ADDCONST(GL_SRC_COLOR);
1370         EXPP_ADDCONST(GL_ONE_MINUS_SRC_COLOR);
1371         EXPP_ADDCONST(GL_SRC_ALPHA);
1372         EXPP_ADDCONST(GL_ONE_MINUS_SRC_ALPHA);
1373         EXPP_ADDCONST(GL_DST_ALPHA);
1374         EXPP_ADDCONST(GL_ONE_MINUS_DST_ALPHA);
1375
1376         EXPP_ADDCONST(GL_DST_COLOR);
1377         EXPP_ADDCONST(GL_ONE_MINUS_DST_COLOR);
1378         EXPP_ADDCONST(GL_SRC_ALPHA_SATURATE);
1379
1380         EXPP_ADDCONST(GL_NONE);
1381         EXPP_ADDCONST(GL_FRONT_LEFT);
1382         EXPP_ADDCONST(GL_FRONT_RIGHT);
1383         EXPP_ADDCONST(GL_BACK_LEFT);
1384         EXPP_ADDCONST(GL_BACK_RIGHT);
1385         EXPP_ADDCONST(GL_FRONT);
1386         EXPP_ADDCONST(GL_BACK);
1387         EXPP_ADDCONST(GL_LEFT);
1388         EXPP_ADDCONST(GL_RIGHT);
1389         EXPP_ADDCONST(GL_FRONT_AND_BACK);
1390         EXPP_ADDCONST(GL_AUX0);
1391         EXPP_ADDCONST(GL_AUX1);
1392         EXPP_ADDCONST(GL_AUX2);
1393         EXPP_ADDCONST(GL_AUX3);
1394
1395         EXPP_ADDCONST(GL_NO_ERROR);
1396         EXPP_ADDCONST(GL_INVALID_ENUM);
1397         EXPP_ADDCONST(GL_INVALID_VALUE);
1398         EXPP_ADDCONST(GL_INVALID_OPERATION);
1399         EXPP_ADDCONST(GL_STACK_OVERFLOW);
1400         EXPP_ADDCONST(GL_STACK_UNDERFLOW);
1401         EXPP_ADDCONST(GL_OUT_OF_MEMORY);
1402
1403         EXPP_ADDCONST(GL_2D);
1404         EXPP_ADDCONST(GL_3D);
1405         EXPP_ADDCONST(GL_3D_COLOR);
1406         EXPP_ADDCONST(GL_3D_COLOR_TEXTURE);
1407         EXPP_ADDCONST(GL_4D_COLOR_TEXTURE);
1408
1409         EXPP_ADDCONST(GL_PASS_THROUGH_TOKEN);
1410         EXPP_ADDCONST(GL_POINT_TOKEN);
1411         EXPP_ADDCONST(GL_LINE_TOKEN);
1412         EXPP_ADDCONST(GL_POLYGON_TOKEN);
1413         EXPP_ADDCONST(GL_BITMAP_TOKEN);
1414         EXPP_ADDCONST(GL_DRAW_PIXEL_TOKEN);
1415         EXPP_ADDCONST(GL_COPY_PIXEL_TOKEN);
1416         EXPP_ADDCONST(GL_LINE_RESET_TOKEN);
1417
1418         EXPP_ADDCONST(GL_EXP);
1419         EXPP_ADDCONST(GL_EXP2);
1420
1421         EXPP_ADDCONST(GL_CW);
1422         EXPP_ADDCONST(GL_CCW);
1423
1424         EXPP_ADDCONST(GL_COEFF);
1425         EXPP_ADDCONST(GL_ORDER);
1426         EXPP_ADDCONST(GL_DOMAIN);
1427
1428         EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_I);
1429         EXPP_ADDCONST(GL_PIXEL_MAP_S_TO_S);
1430         EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_R);
1431         EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_G);
1432         EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_B);
1433         EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_A);
1434         EXPP_ADDCONST(GL_PIXEL_MAP_R_TO_R);
1435         EXPP_ADDCONST(GL_PIXEL_MAP_G_TO_G);
1436         EXPP_ADDCONST(GL_PIXEL_MAP_B_TO_B);
1437         EXPP_ADDCONST(GL_PIXEL_MAP_A_TO_A);
1438
1439         EXPP_ADDCONST(GL_CURRENT_COLOR);
1440         EXPP_ADDCONST(GL_CURRENT_INDEX);
1441         EXPP_ADDCONST(GL_CURRENT_NORMAL);
1442         EXPP_ADDCONST(GL_CURRENT_TEXTURE_COORDS);
1443         EXPP_ADDCONST(GL_CURRENT_RASTER_COLOR);
1444         EXPP_ADDCONST(GL_CURRENT_RASTER_INDEX);
1445         EXPP_ADDCONST(GL_CURRENT_RASTER_TEXTURE_COORDS);
1446         EXPP_ADDCONST(GL_CURRENT_RASTER_POSITION);
1447         EXPP_ADDCONST(GL_CURRENT_RASTER_POSITION_VALID);
1448         EXPP_ADDCONST(GL_CURRENT_RASTER_DISTANCE);
1449         EXPP_ADDCONST(GL_POINT_SMOOTH);
1450         EXPP_ADDCONST(GL_POINT_SIZE);
1451         EXPP_ADDCONST(GL_POINT_SIZE_RANGE);
1452         EXPP_ADDCONST(GL_POINT_SIZE_GRANULARITY);
1453         EXPP_ADDCONST(GL_LINE_SMOOTH);
1454         EXPP_ADDCONST(GL_LINE_WIDTH);
1455         EXPP_ADDCONST(GL_LINE_WIDTH_RANGE);
1456         EXPP_ADDCONST(GL_LINE_WIDTH_GRANULARITY);
1457         EXPP_ADDCONST(GL_LINE_STIPPLE);
1458         EXPP_ADDCONST(GL_LINE_STIPPLE_PATTERN);
1459         EXPP_ADDCONST(GL_LINE_STIPPLE_REPEAT);
1460         EXPP_ADDCONST(GL_LIST_MODE);
1461         EXPP_ADDCONST(GL_MAX_LIST_NESTING);
1462         EXPP_ADDCONST(GL_LIST_BASE);
1463         EXPP_ADDCONST(GL_LIST_INDEX);
1464         EXPP_ADDCONST(GL_POLYGON_MODE);
1465         EXPP_ADDCONST(GL_POLYGON_SMOOTH);
1466         EXPP_ADDCONST(GL_POLYGON_STIPPLE);
1467         EXPP_ADDCONST(GL_EDGE_FLAG);
1468         EXPP_ADDCONST(GL_CULL_FACE);
1469         EXPP_ADDCONST(GL_CULL_FACE_MODE);
1470         EXPP_ADDCONST(GL_FRONT_FACE);
1471         EXPP_ADDCONST(GL_LIGHTING);
1472         EXPP_ADDCONST(GL_LIGHT_MODEL_LOCAL_VIEWER);
1473         EXPP_ADDCONST(GL_LIGHT_MODEL_TWO_SIDE);
1474         EXPP_ADDCONST(GL_LIGHT_MODEL_AMBIENT);
1475         EXPP_ADDCONST(GL_SHADE_MODEL);
1476         EXPP_ADDCONST(GL_COLOR_MATERIAL_FACE);
1477         EXPP_ADDCONST(GL_COLOR_MATERIAL_PARAMETER);
1478         EXPP_ADDCONST(GL_COLOR_MATERIAL);
1479         EXPP_ADDCONST(GL_FOG);
1480         EXPP_ADDCONST(GL_FOG_INDEX);
1481         EXPP_ADDCONST(GL_FOG_DENSITY);
1482         EXPP_ADDCONST(GL_FOG_START);
1483         EXPP_ADDCONST(GL_FOG_END);
1484         EXPP_ADDCONST(GL_FOG_MODE);
1485         EXPP_ADDCONST(GL_FOG_COLOR);
1486         EXPP_ADDCONST(GL_DEPTH_RANGE);
1487         EXPP_ADDCONST(GL_DEPTH_TEST);
1488         EXPP_ADDCONST(GL_DEPTH_WRITEMASK);
1489         EXPP_ADDCONST(GL_DEPTH_CLEAR_VALUE);
1490         EXPP_ADDCONST(GL_DEPTH_FUNC);
1491         EXPP_ADDCONST(GL_ACCUM_CLEAR_VALUE);
1492         EXPP_ADDCONST(GL_STENCIL_TEST);
1493         EXPP_ADDCONST(GL_STENCIL_CLEAR_VALUE);
1494         EXPP_ADDCONST(GL_STENCIL_FUNC);
1495         EXPP_ADDCONST(GL_STENCIL_VALUE_MASK);
1496         EXPP_ADDCONST(GL_STENCIL_FAIL);
1497         EXPP_ADDCONST(GL_STENCIL_PASS_DEPTH_FAIL);
1498         EXPP_ADDCONST(GL_STENCIL_PASS_DEPTH_PASS);
1499         EXPP_ADDCONST(GL_STENCIL_REF);
1500         EXPP_ADDCONST(GL_STENCIL_WRITEMASK);
1501         EXPP_ADDCONST(GL_MATRIX_MODE);
1502         EXPP_ADDCONST(GL_NORMALIZE);
1503         EXPP_ADDCONST(GL_VIEWPORT);
1504         EXPP_ADDCONST(GL_MODELVIEW_STACK_DEPTH);
1505         EXPP_ADDCONST(GL_PROJECTION_STACK_DEPTH);
1506         EXPP_ADDCONST(GL_TEXTURE_STACK_DEPTH);
1507         EXPP_ADDCONST(GL_MODELVIEW_MATRIX);
1508         EXPP_ADDCONST(GL_PROJECTION_MATRIX);
1509         EXPP_ADDCONST(GL_TEXTURE_MATRIX);
1510         EXPP_ADDCONST(GL_ATTRIB_STACK_DEPTH);
1511         EXPP_ADDCONST(GL_ALPHA_TEST);
1512         EXPP_ADDCONST(GL_ALPHA_TEST_FUNC);
1513         EXPP_ADDCONST(GL_ALPHA_TEST_REF);
1514         EXPP_ADDCONST(GL_DITHER);
1515         EXPP_ADDCONST(GL_BLEND_DST);
1516         EXPP_ADDCONST(GL_BLEND_SRC);
1517         EXPP_ADDCONST(GL_BLEND);
1518         EXPP_ADDCONST(GL_LOGIC_OP_MODE);
1519         EXPP_ADDCONST(GL_LOGIC_OP);
1520         EXPP_ADDCONST(GL_AUX_BUFFERS);
1521         EXPP_ADDCONST(GL_DRAW_BUFFER);
1522         EXPP_ADDCONST(GL_READ_BUFFER);
1523         EXPP_ADDCONST(GL_SCISSOR_BOX);
1524         EXPP_ADDCONST(GL_SCISSOR_TEST);
1525         EXPP_ADDCONST(GL_INDEX_CLEAR_VALUE);
1526         EXPP_ADDCONST(GL_INDEX_WRITEMASK);
1527         EXPP_ADDCONST(GL_COLOR_CLEAR_VALUE);
1528         EXPP_ADDCONST(GL_COLOR_WRITEMASK);
1529         EXPP_ADDCONST(GL_INDEX_MODE);
1530         EXPP_ADDCONST(GL_RGBA_MODE);
1531         EXPP_ADDCONST(GL_DOUBLEBUFFER);
1532         EXPP_ADDCONST(GL_STEREO);
1533         EXPP_ADDCONST(GL_RENDER_MODE);
1534         EXPP_ADDCONST(GL_PERSPECTIVE_CORRECTION_HINT);
1535         EXPP_ADDCONST(GL_POINT_SMOOTH_HINT);
1536         EXPP_ADDCONST(GL_LINE_SMOOTH_HINT);
1537         EXPP_ADDCONST(GL_POLYGON_SMOOTH_HINT);
1538         EXPP_ADDCONST(GL_FOG_HINT);
1539         EXPP_ADDCONST(GL_TEXTURE_GEN_S);
1540         EXPP_ADDCONST(GL_TEXTURE_GEN_T);
1541         EXPP_ADDCONST(GL_TEXTURE_GEN_R);
1542         EXPP_ADDCONST(GL_TEXTURE_GEN_Q);
1543         EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_I_SIZE);
1544         EXPP_ADDCONST(GL_PIXEL_MAP_S_TO_S_SIZE);
1545         EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_R_SIZE);
1546         EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_G_SIZE);
1547         EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_B_SIZE);
1548         EXPP_ADDCONST(GL_PIXEL_MAP_I_TO_A_SIZE);
1549         EXPP_ADDCONST(GL_PIXEL_MAP_R_TO_R_SIZE);
1550         EXPP_ADDCONST(GL_PIXEL_MAP_G_TO_G_SIZE);
1551         EXPP_ADDCONST(GL_PIXEL_MAP_B_TO_B_SIZE);
1552         EXPP_ADDCONST(GL_PIXEL_MAP_A_TO_A_SIZE);
1553         EXPP_ADDCONST(GL_UNPACK_SWAP_BYTES);
1554         EXPP_ADDCONST(GL_UNPACK_LSB_FIRST);
1555         EXPP_ADDCONST(GL_UNPACK_ROW_LENGTH);
1556         EXPP_ADDCONST(GL_UNPACK_SKIP_ROWS);
1557         EXPP_ADDCONST(GL_UNPACK_SKIP_PIXELS);
1558         EXPP_ADDCONST(GL_UNPACK_ALIGNMENT);
1559         EXPP_ADDCONST(GL_PACK_SWAP_BYTES);
1560         EXPP_ADDCONST(GL_PACK_LSB_FIRST);
1561         EXPP_ADDCONST(GL_PACK_ROW_LENGTH);
1562         EXPP_ADDCONST(GL_PACK_SKIP_ROWS);
1563         EXPP_ADDCONST(GL_PACK_SKIP_PIXELS);
1564         EXPP_ADDCONST(GL_PACK_ALIGNMENT);
1565         EXPP_ADDCONST(GL_MAP_COLOR);
1566         EXPP_ADDCONST(GL_MAP_STENCIL);
1567         EXPP_ADDCONST(GL_INDEX_SHIFT);
1568         EXPP_ADDCONST(GL_INDEX_OFFSET);
1569         EXPP_ADDCONST(GL_RED_SCALE);
1570         EXPP_ADDCONST(GL_RED_BIAS);
1571         EXPP_ADDCONST(GL_ZOOM_X);
1572         EXPP_ADDCONST(GL_ZOOM_Y);
1573         EXPP_ADDCONST(GL_GREEN_SCALE);
1574         EXPP_ADDCONST(GL_GREEN_BIAS);
1575         EXPP_ADDCONST(GL_BLUE_SCALE);
1576         EXPP_ADDCONST(GL_BLUE_BIAS);
1577         EXPP_ADDCONST(GL_ALPHA_SCALE);
1578         EXPP_ADDCONST(GL_ALPHA_BIAS);
1579         EXPP_ADDCONST(GL_DEPTH_SCALE);
1580         EXPP_ADDCONST(GL_DEPTH_BIAS);
1581         EXPP_ADDCONST(GL_MAX_EVAL_ORDER);
1582         EXPP_ADDCONST(GL_MAX_LIGHTS);
1583         EXPP_ADDCONST(GL_MAX_CLIP_PLANES);
1584         EXPP_ADDCONST(GL_MAX_TEXTURE_SIZE);
1585         EXPP_ADDCONST(GL_MAX_PIXEL_MAP_TABLE);
1586         EXPP_ADDCONST(GL_MAX_ATTRIB_STACK_DEPTH);
1587         EXPP_ADDCONST(GL_MAX_MODELVIEW_STACK_DEPTH);
1588         EXPP_ADDCONST(GL_MAX_NAME_STACK_DEPTH);
1589         EXPP_ADDCONST(GL_MAX_PROJECTION_STACK_DEPTH);
1590         EXPP_ADDCONST(GL_MAX_TEXTURE_STACK_DEPTH);
1591         EXPP_ADDCONST(GL_MAX_VIEWPORT_DIMS);
1592         EXPP_ADDCONST(GL_SUBPIXEL_BITS);
1593         EXPP_ADDCONST(GL_INDEX_BITS);
1594         EXPP_ADDCONST(GL_RED_BITS);
1595         EXPP_ADDCONST(GL_GREEN_BITS);
1596         EXPP_ADDCONST(GL_BLUE_BITS);
1597         EXPP_ADDCONST(GL_ALPHA_BITS);
1598         EXPP_ADDCONST(GL_DEPTH_BITS);
1599         EXPP_ADDCONST(GL_STENCIL_BITS);
1600         EXPP_ADDCONST(GL_ACCUM_RED_BITS);
1601         EXPP_ADDCONST(GL_ACCUM_GREEN_BITS);
1602         EXPP_ADDCONST(GL_ACCUM_BLUE_BITS);
1603         EXPP_ADDCONST(GL_ACCUM_ALPHA_BITS);
1604         EXPP_ADDCONST(GL_NAME_STACK_DEPTH);
1605         EXPP_ADDCONST(GL_AUTO_NORMAL);
1606         EXPP_ADDCONST(GL_MAP1_COLOR_4);
1607         EXPP_ADDCONST(GL_MAP1_INDEX);
1608         EXPP_ADDCONST(GL_MAP1_NORMAL);
1609         EXPP_ADDCONST(GL_MAP1_TEXTURE_COORD_1);
1610         EXPP_ADDCONST(GL_MAP1_TEXTURE_COORD_2);
1611         EXPP_ADDCONST(GL_MAP1_TEXTURE_COORD_3);
1612         EXPP_ADDCONST(GL_MAP1_TEXTURE_COORD_4);
1613         EXPP_ADDCONST(GL_MAP1_VERTEX_3);
1614         EXPP_ADDCONST(GL_MAP1_VERTEX_4);
1615         EXPP_ADDCONST(GL_MAP2_COLOR_4);
1616         EXPP_ADDCONST(GL_MAP2_INDEX);
1617         EXPP_ADDCONST(GL_MAP2_NORMAL);
1618         EXPP_ADDCONST(GL_MAP2_TEXTURE_COORD_1);
1619         EXPP_ADDCONST(GL_MAP2_TEXTURE_COORD_2);
1620         EXPP_ADDCONST(GL_MAP2_TEXTURE_COORD_3);
1621         EXPP_ADDCONST(GL_MAP2_TEXTURE_COORD_4);
1622         EXPP_ADDCONST(GL_MAP2_VERTEX_3);
1623         EXPP_ADDCONST(GL_MAP2_VERTEX_4);
1624         EXPP_ADDCONST(GL_MAP1_GRID_DOMAIN);
1625         EXPP_ADDCONST(GL_MAP1_GRID_SEGMENTS);
1626         EXPP_ADDCONST(GL_MAP2_GRID_DOMAIN);
1627         EXPP_ADDCONST(GL_MAP2_GRID_SEGMENTS);
1628         EXPP_ADDCONST(GL_TEXTURE_1D);
1629         EXPP_ADDCONST(GL_TEXTURE_2D);
1630
1631         EXPP_ADDCONST(GL_TEXTURE_WIDTH);
1632         EXPP_ADDCONST(GL_TEXTURE_HEIGHT);
1633         EXPP_ADDCONST(GL_TEXTURE_COMPONENTS);
1634         EXPP_ADDCONST(GL_TEXTURE_BORDER_COLOR);
1635         EXPP_ADDCONST(GL_TEXTURE_BORDER);
1636
1637         EXPP_ADDCONST(GL_DONT_CARE);
1638         EXPP_ADDCONST(GL_FASTEST);
1639         EXPP_ADDCONST(GL_NICEST);
1640
1641         EXPP_ADDCONST(GL_AMBIENT);
1642         EXPP_ADDCONST(GL_DIFFUSE);
1643         EXPP_ADDCONST(GL_SPECULAR);
1644         EXPP_ADDCONST(GL_POSITION);
1645         EXPP_ADDCONST(GL_SPOT_DIRECTION);
1646         EXPP_ADDCONST(GL_SPOT_EXPONENT);
1647         EXPP_ADDCONST(GL_SPOT_CUTOFF);
1648         EXPP_ADDCONST(GL_CONSTANT_ATTENUATION);
1649         EXPP_ADDCONST(GL_LINEAR_ATTENUATION);
1650         EXPP_ADDCONST(GL_QUADRATIC_ATTENUATION);
1651
1652         EXPP_ADDCONST(GL_COMPILE);
1653         EXPP_ADDCONST(GL_COMPILE_AND_EXECUTE);
1654
1655         EXPP_ADDCONST(GL_BYTE);
1656         EXPP_ADDCONST(GL_UNSIGNED_BYTE);
1657         EXPP_ADDCONST(GL_SHORT);
1658         EXPP_ADDCONST(GL_UNSIGNED_SHORT);
1659         EXPP_ADDCONST(GL_INT);
1660         EXPP_ADDCONST(GL_UNSIGNED_INT);
1661         EXPP_ADDCONST(GL_FLOAT);
1662         EXPP_ADDCONST(GL_DOUBLE);
1663         EXPP_ADDCONST(GL_2_BYTES);
1664         EXPP_ADDCONST(GL_3_BYTES);
1665         EXPP_ADDCONST(GL_4_BYTES);
1666
1667         EXPP_ADDCONST(GL_CLEAR);
1668         EXPP_ADDCONST(GL_AND);
1669         EXPP_ADDCONST(GL_AND_REVERSE);
1670         EXPP_ADDCONST(GL_COPY);
1671         EXPP_ADDCONST(GL_AND_INVERTED);
1672         EXPP_ADDCONST(GL_NOOP);
1673         EXPP_ADDCONST(GL_XOR);
1674         EXPP_ADDCONST(GL_OR);
1675         EXPP_ADDCONST(GL_NOR);
1676         EXPP_ADDCONST(GL_EQUIV);
1677         EXPP_ADDCONST(GL_INVERT);
1678         EXPP_ADDCONST(GL_OR_REVERSE);
1679         EXPP_ADDCONST(GL_COPY_INVERTED);
1680         EXPP_ADDCONST(GL_OR_INVERTED);
1681         EXPP_ADDCONST(GL_NAND);
1682         EXPP_ADDCONST(GL_SET);
1683
1684         EXPP_ADDCONST(GL_EMISSION);
1685         EXPP_ADDCONST(GL_SHININESS);
1686         EXPP_ADDCONST(GL_AMBIENT_AND_DIFFUSE);
1687         EXPP_ADDCONST(GL_COLOR_INDEXES);
1688
1689         EXPP_ADDCONST(GL_MODELVIEW);
1690         EXPP_ADDCONST(GL_PROJECTION);
1691         EXPP_ADDCONST(GL_TEXTURE);
1692
1693         EXPP_ADDCONST(GL_COLOR);
1694         EXPP_ADDCONST(GL_DEPTH);
1695         EXPP_ADDCONST(GL_STENCIL);
1696
1697         EXPP_ADDCONST(GL_COLOR_INDEX);
1698         EXPP_ADDCONST(GL_STENCIL_INDEX);
1699         EXPP_ADDCONST(GL_DEPTH_COMPONENT);
1700         EXPP_ADDCONST(GL_RED);
1701         EXPP_ADDCONST(GL_GREEN);
1702         EXPP_ADDCONST(GL_BLUE);
1703         EXPP_ADDCONST(GL_ALPHA);
1704         EXPP_ADDCONST(GL_RGB);
1705         EXPP_ADDCONST(GL_RGBA);
1706         EXPP_ADDCONST(GL_LUMINANCE);
1707         EXPP_ADDCONST(GL_LUMINANCE_ALPHA);
1708
1709         EXPP_ADDCONST(GL_BITMAP);
1710
1711         EXPP_ADDCONST(GL_POINT);
1712         EXPP_ADDCONST(GL_LINE);
1713         EXPP_ADDCONST(GL_FILL);
1714
1715         EXPP_ADDCONST(GL_RENDER);
1716         EXPP_ADDCONST(GL_FEEDBACK);
1717         EXPP_ADDCONST(GL_SELECT);
1718
1719         EXPP_ADDCONST(GL_FLAT);
1720         EXPP_ADDCONST(GL_SMOOTH);
1721
1722         EXPP_ADDCONST(GL_KEEP);
1723         EXPP_ADDCONST(GL_REPLACE);
1724         EXPP_ADDCONST(GL_INCR);
1725         EXPP_ADDCONST(GL_DECR);
1726
1727         EXPP_ADDCONST(GL_VENDOR);
1728         EXPP_ADDCONST(GL_RENDERER);
1729         EXPP_ADDCONST(GL_VERSION);
1730         EXPP_ADDCONST(GL_EXTENSIONS);
1731
1732         EXPP_ADDCONST(GL_S);
1733         EXPP_ADDCONST(GL_T);
1734         EXPP_ADDCONST(GL_R);
1735         EXPP_ADDCONST(GL_Q);
1736
1737         EXPP_ADDCONST(GL_MODULATE);
1738         EXPP_ADDCONST(GL_DECAL);
1739
1740         EXPP_ADDCONST(GL_TEXTURE_ENV_MODE);
1741         EXPP_ADDCONST(GL_TEXTURE_ENV_COLOR);
1742
1743         EXPP_ADDCONST(GL_TEXTURE_ENV);
1744
1745         EXPP_ADDCONST(GL_EYE_LINEAR);
1746         EXPP_ADDCONST(GL_OBJECT_LINEAR);
1747         EXPP_ADDCONST(GL_SPHERE_MAP);
1748
1749         EXPP_ADDCONST(GL_TEXTURE_GEN_MODE);
1750         EXPP_ADDCONST(GL_OBJECT_PLANE);
1751         EXPP_ADDCONST(GL_EYE_PLANE);
1752
1753         EXPP_ADDCONST(GL_NEAREST);
1754         EXPP_ADDCONST(GL_LINEAR);
1755
1756         EXPP_ADDCONST(GL_NEAREST_MIPMAP_NEAREST);
1757         EXPP_ADDCONST(GL_LINEAR_MIPMAP_NEAREST);
1758         EXPP_ADDCONST(GL_NEAREST_MIPMAP_LINEAR);
1759         EXPP_ADDCONST(GL_LINEAR_MIPMAP_LINEAR);
1760
1761         EXPP_ADDCONST(GL_TEXTURE_MAG_FILTER);
1762         EXPP_ADDCONST(GL_TEXTURE_MIN_FILTER);
1763         EXPP_ADDCONST(GL_TEXTURE_WRAP_S);
1764         EXPP_ADDCONST(GL_TEXTURE_WRAP_T);
1765
1766         EXPP_ADDCONST(GL_CLAMP);
1767         EXPP_ADDCONST(GL_REPEAT);
1768
1769         EXPP_ADDCONST(GL_CLIP_PLANE0);
1770         EXPP_ADDCONST(GL_CLIP_PLANE1);
1771         EXPP_ADDCONST(GL_CLIP_PLANE2);
1772         EXPP_ADDCONST(GL_CLIP_PLANE3);
1773         EXPP_ADDCONST(GL_CLIP_PLANE4);
1774         EXPP_ADDCONST(GL_CLIP_PLANE5);
1775
1776         EXPP_ADDCONST(GL_LIGHT0);
1777         EXPP_ADDCONST(GL_LIGHT1);
1778         EXPP_ADDCONST(GL_LIGHT2);
1779         EXPP_ADDCONST(GL_LIGHT3);
1780         EXPP_ADDCONST(GL_LIGHT4);
1781         EXPP_ADDCONST(GL_LIGHT5);
1782         EXPP_ADDCONST(GL_LIGHT6);
1783         EXPP_ADDCONST(GL_LIGHT7);
1784         
1785         EXPP_ADDCONST(GL_POLYGON_OFFSET_UNITS);
1786         EXPP_ADDCONST(GL_POLYGON_OFFSET_POINT);
1787         EXPP_ADDCONST(GL_POLYGON_OFFSET_LINE);
1788         EXPP_ADDCONST(GL_POLYGON_OFFSET_FILL);
1789         EXPP_ADDCONST(GL_POLYGON_OFFSET_FACTOR);
1790         
1791         EXPP_ADDCONST(GL_TEXTURE_PRIORITY);
1792         EXPP_ADDCONST(GL_TEXTURE_RESIDENT);
1793         EXPP_ADDCONST(GL_TEXTURE_BINDING_1D);
1794         EXPP_ADDCONST(GL_TEXTURE_BINDING_2D);
1795
1796         return submodule;
1797 }
1798