punyverse/punyverse/_glgeom.c

3349 lines
140 KiB
C
Raw Normal View History

/* Generated by Cython 0.18 on Tue Oct 22 20:38:08 2013 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
#error Cython requires Python 2.4+.
#else
#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#ifndef __fastcall
#define __fastcall
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
#define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PY_FORMAT_SIZE_T ""
#define CYTHON_FORMAT_SSIZE_T ""
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
#define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
#define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
(PyErr_Format(PyExc_TypeError, \
"expected index value, got %.200s", Py_TYPE(o)->tp_name), \
(PyObject*)0))
#define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
!PyComplex_Check(o))
#define PyIndex_Check __Pyx_PyIndex_Check
#define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#define __PYX_BUILD_PY_SSIZE_T "i"
#else
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#define __Pyx_PyIndex_Check PyIndex_Check
#endif
#if PY_VERSION_HEX < 0x02060000
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#define PyType_Modified(t)
typedef struct {
void *buf;
PyObject *obj;
Py_ssize_t len;
Py_ssize_t itemsize;
int readonly;
int ndim;
char *format;
Py_ssize_t *shape;
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
} Py_buffer;
#define PyBUF_SIMPLE 0
#define PyBUF_WRITABLE 0x0001
#define PyBUF_FORMAT 0x0004
#define PyBUF_ND 0x0008
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
#define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#define CYTHON_PEP393_ENABLED 1
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
0 : _PyUnicode_Ready((PyObject *)(op)))
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#else
#define CYTHON_PEP393_ENABLED 0
#define __Pyx_PyUnicode_READY(op) (0)
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
#define PyStringObject PyUnicodeObject
#define PyString_Type PyUnicode_Type
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
#define PyBytesObject PyStringObject
#define PyBytes_Type PyString_Type
#define PyBytes_Check PyString_Check
#define PyBytes_CheckExact PyString_CheckExact
#define PyBytes_FromString PyString_FromString
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
#define PyBytes_FromFormat PyString_FromFormat
#define PyBytes_DecodeEscape PyString_DecodeEscape
#define PyBytes_AsString PyString_AsString
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
#define PyBytes_Size PyString_Size
#define PyBytes_AS_STRING PyString_AS_STRING
#define PyBytes_GET_SIZE PyString_GET_SIZE
#define PyBytes_Repr PyString_Repr
#define PyBytes_Concat PyString_Concat
#define PyBytes_ConcatAndDel PyString_ConcatAndDel
#endif
#if PY_VERSION_HEX < 0x02060000
#define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
#define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
#define PyIntObject PyLongObject
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
#define PyInt_FromString PyLong_FromString
#define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromLong PyLong_FromLong
#define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBoolObject PyLongObject
#endif
#if PY_VERSION_HEX < 0x03020000
typedef long Py_hash_t;
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
#else
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
#define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
#define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
#define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
#define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
#define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
#define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
#else
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_NAMESTR(n) ((char *)(n))
#define __Pyx_DOCSTR(n) ((char *)(n))
#else
#define __Pyx_NAMESTR(n) (n)
#define __Pyx_DOCSTR(n) (n)
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
#else
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
#endif
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__punyverse___glgeom
#define __PYX_HAVE_API__punyverse___glgeom
#include "math.h"
#include "string.h"
#include "stdlib.h"
#include "windows.h"
#include "GL/gl.h"
#include "stddef.h"
#include "GL/glu.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */
#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#define CYTHON_INLINE __inline__
#elif defined(_MSC_VER)
#define CYTHON_INLINE __inline
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_INLINE inline
#else
#define CYTHON_INLINE
#endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char *__pyx_f[] = {
"_glgeom.pyx",
};
/*--- Type declarations ---*/
struct __pyx_opt_args_9punyverse_7_glgeom_torus;
struct __pyx_opt_args_9punyverse_7_glgeom_bgr_to_rgb;
/* "D:\dev\punyverse\punyverse\_cyopengl.pxi":458
*
*
* cdef enum: # <<<<<<<<<<<<<<
* GL_FALSE = 0x0
* GL_TRUE = 0x1
*/
enum {
__pyx_e_9punyverse_7_glgeom_GL_FALSE = 0x0,
__pyx_e_9punyverse_7_glgeom_GL_TRUE = 0x1,
__pyx_e_9punyverse_7_glgeom_GL_BYTE = 0x1400,
__pyx_e_9punyverse_7_glgeom_GL_UNSIGNED_BYTE = 0x1401,
__pyx_e_9punyverse_7_glgeom_GL_SHORT = 0x1402,
__pyx_e_9punyverse_7_glgeom_GL_UNSIGNED_SHORT = 0x1403,
__pyx_e_9punyverse_7_glgeom_GL_INT = 0x1404,
__pyx_e_9punyverse_7_glgeom_GL_UNSIGNED_INT = 0x1405,
__pyx_e_9punyverse_7_glgeom_GL_FLOAT = 0x1406,
__pyx_e_9punyverse_7_glgeom_GL_DOUBLE = 0x140A,
__pyx_e_9punyverse_7_glgeom_GL_2_BYTES = 0x1407,
__pyx_e_9punyverse_7_glgeom_GL_3_BYTES = 0x1408,
__pyx_e_9punyverse_7_glgeom_GL_4_BYTES = 0x1409,
__pyx_e_9punyverse_7_glgeom_GL_POINTS = 0x0000,
__pyx_e_9punyverse_7_glgeom_GL_LINES = 0x0001,
__pyx_e_9punyverse_7_glgeom_GL_LINE_LOOP = 0x0002,
__pyx_e_9punyverse_7_glgeom_GL_LINE_STRIP = 0x0003,
__pyx_e_9punyverse_7_glgeom_GL_TRIANGLES = 0x0004,
__pyx_e_9punyverse_7_glgeom_GL_TRIANGLE_STRIP = 0x0005,
__pyx_e_9punyverse_7_glgeom_GL_TRIANGLE_FAN = 0x0006,
__pyx_e_9punyverse_7_glgeom_GL_QUADS = 0x0007,
__pyx_e_9punyverse_7_glgeom_GL_QUAD_STRIP = 0x0008,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON = 0x0009,
__pyx_e_9punyverse_7_glgeom_GL_VERTEX_ARRAY = 0x8074,
__pyx_e_9punyverse_7_glgeom_GL_NORMAL_ARRAY = 0x8075,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_ARRAY = 0x8076,
__pyx_e_9punyverse_7_glgeom_GL_INDEX_ARRAY = 0x8077,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COORD_ARRAY = 0x8078,
__pyx_e_9punyverse_7_glgeom_GL_EDGE_FLAG_ARRAY = 0x8079,
__pyx_e_9punyverse_7_glgeom_GL_VERTEX_ARRAY_SIZE = 0x807A,
__pyx_e_9punyverse_7_glgeom_GL_VERTEX_ARRAY_TYPE = 0x807B,
__pyx_e_9punyverse_7_glgeom_GL_VERTEX_ARRAY_STRIDE = 0x807C,
__pyx_e_9punyverse_7_glgeom_GL_NORMAL_ARRAY_TYPE = 0x807E,
__pyx_e_9punyverse_7_glgeom_GL_NORMAL_ARRAY_STRIDE = 0x807F,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_ARRAY_SIZE = 0x8081,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_ARRAY_TYPE = 0x8082,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_ARRAY_STRIDE = 0x8083,
__pyx_e_9punyverse_7_glgeom_GL_INDEX_ARRAY_TYPE = 0x8085,
__pyx_e_9punyverse_7_glgeom_GL_INDEX_ARRAY_STRIDE = 0x8086,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A,
__pyx_e_9punyverse_7_glgeom_GL_EDGE_FLAG_ARRAY_STRIDE = 0x808C,
__pyx_e_9punyverse_7_glgeom_GL_VERTEX_ARRAY_POINTER = 0x808E,
__pyx_e_9punyverse_7_glgeom_GL_NORMAL_ARRAY_POINTER = 0x808F,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_ARRAY_POINTER = 0x8090,
__pyx_e_9punyverse_7_glgeom_GL_INDEX_ARRAY_POINTER = 0x8091,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092,
__pyx_e_9punyverse_7_glgeom_GL_EDGE_FLAG_ARRAY_POINTER = 0x8093,
__pyx_e_9punyverse_7_glgeom_GL_V2F = 0x2A20,
__pyx_e_9punyverse_7_glgeom_GL_V3F = 0x2A21,
__pyx_e_9punyverse_7_glgeom_GL_C4UB_V2F = 0x2A22,
__pyx_e_9punyverse_7_glgeom_GL_C4UB_V3F = 0x2A23,
__pyx_e_9punyverse_7_glgeom_GL_C3F_V3F = 0x2A24,
__pyx_e_9punyverse_7_glgeom_GL_N3F_V3F = 0x2A25,
__pyx_e_9punyverse_7_glgeom_GL_C4F_N3F_V3F = 0x2A26,
__pyx_e_9punyverse_7_glgeom_GL_T2F_V3F = 0x2A27,
__pyx_e_9punyverse_7_glgeom_GL_T4F_V4F = 0x2A28,
__pyx_e_9punyverse_7_glgeom_GL_T2F_C4UB_V3F = 0x2A29,
__pyx_e_9punyverse_7_glgeom_GL_T2F_C3F_V3F = 0x2A2A,
__pyx_e_9punyverse_7_glgeom_GL_T2F_N3F_V3F = 0x2A2B,
__pyx_e_9punyverse_7_glgeom_GL_T2F_C4F_N3F_V3F = 0x2A2C,
__pyx_e_9punyverse_7_glgeom_GL_T4F_C4F_N3F_V4F = 0x2A2D,
__pyx_e_9punyverse_7_glgeom_GL_MATRIX_MODE = 0x0BA0,
__pyx_e_9punyverse_7_glgeom_GL_MODELVIEW = 0x1700,
__pyx_e_9punyverse_7_glgeom_GL_PROJECTION = 0x1701,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE = 0x1702,
__pyx_e_9punyverse_7_glgeom_GL_POINT_SMOOTH = 0x0B10,
__pyx_e_9punyverse_7_glgeom_GL_POINT_SIZE = 0x0B11,
__pyx_e_9punyverse_7_glgeom_GL_POINT_SIZE_GRANULARITY = 0x0B13,
__pyx_e_9punyverse_7_glgeom_GL_POINT_SIZE_RANGE = 0x0B12,
__pyx_e_9punyverse_7_glgeom_GL_LINE_SMOOTH = 0x0B20,
__pyx_e_9punyverse_7_glgeom_GL_LINE_STIPPLE = 0x0B24,
__pyx_e_9punyverse_7_glgeom_GL_LINE_STIPPLE_PATTERN = 0x0B25,
__pyx_e_9punyverse_7_glgeom_GL_LINE_STIPPLE_REPEAT = 0x0B26,
__pyx_e_9punyverse_7_glgeom_GL_LINE_WIDTH = 0x0B21,
__pyx_e_9punyverse_7_glgeom_GL_LINE_WIDTH_GRANULARITY = 0x0B23,
__pyx_e_9punyverse_7_glgeom_GL_LINE_WIDTH_RANGE = 0x0B22,
__pyx_e_9punyverse_7_glgeom_GL_POINT = 0x1B00,
__pyx_e_9punyverse_7_glgeom_GL_LINE = 0x1B01,
__pyx_e_9punyverse_7_glgeom_GL_FILL = 0x1B02,
__pyx_e_9punyverse_7_glgeom_GL_CW = 0x0900,
__pyx_e_9punyverse_7_glgeom_GL_CCW = 0x0901,
__pyx_e_9punyverse_7_glgeom_GL_FRONT = 0x0404,
__pyx_e_9punyverse_7_glgeom_GL_BACK = 0x0405,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_MODE = 0x0B40,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_SMOOTH = 0x0B41,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_STIPPLE = 0x0B42,
__pyx_e_9punyverse_7_glgeom_GL_EDGE_FLAG = 0x0B43,
__pyx_e_9punyverse_7_glgeom_GL_CULL_FACE = 0x0B44,
__pyx_e_9punyverse_7_glgeom_GL_CULL_FACE_MODE = 0x0B45,
__pyx_e_9punyverse_7_glgeom_GL_FRONT_FACE = 0x0B46,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_OFFSET_FACTOR = 0x8038,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_OFFSET_UNITS = 0x2A00,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_OFFSET_POINT = 0x2A01,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_OFFSET_LINE = 0x2A02,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_OFFSET_FILL = 0x8037,
__pyx_e_9punyverse_7_glgeom_GL_COMPILE = 0x1300,
__pyx_e_9punyverse_7_glgeom_GL_COMPILE_AND_EXECUTE = 0x1301,
__pyx_e_9punyverse_7_glgeom_GL_LIST_BASE = 0x0B32,
__pyx_e_9punyverse_7_glgeom_GL_LIST_INDEX = 0x0B33,
__pyx_e_9punyverse_7_glgeom_GL_LIST_MODE = 0x0B30,
__pyx_e_9punyverse_7_glgeom_GL_NEVER = 0x0200,
__pyx_e_9punyverse_7_glgeom_GL_LESS = 0x0201,
__pyx_e_9punyverse_7_glgeom_GL_EQUAL = 0x0202,
__pyx_e_9punyverse_7_glgeom_GL_LEQUAL = 0x0203,
__pyx_e_9punyverse_7_glgeom_GL_GREATER = 0x0204,
__pyx_e_9punyverse_7_glgeom_GL_NOTEQUAL = 0x0205,
__pyx_e_9punyverse_7_glgeom_GL_GEQUAL = 0x0206,
__pyx_e_9punyverse_7_glgeom_GL_ALWAYS = 0x0207,
__pyx_e_9punyverse_7_glgeom_GL_DEPTH_TEST = 0x0B71,
__pyx_e_9punyverse_7_glgeom_GL_DEPTH_BITS = 0x0D56,
__pyx_e_9punyverse_7_glgeom_GL_DEPTH_CLEAR_VALUE = 0x0B73,
__pyx_e_9punyverse_7_glgeom_GL_DEPTH_FUNC = 0x0B74,
__pyx_e_9punyverse_7_glgeom_GL_DEPTH_RANGE = 0x0B70,
__pyx_e_9punyverse_7_glgeom_GL_DEPTH_WRITEMASK = 0x0B72,
__pyx_e_9punyverse_7_glgeom_GL_DEPTH_COMPONENT = 0x1902,
__pyx_e_9punyverse_7_glgeom_GL_LIGHTING = 0x0B50,
__pyx_e_9punyverse_7_glgeom_GL_LIGHT0 = 0x4000,
__pyx_e_9punyverse_7_glgeom_GL_LIGHT1 = 0x4001,
__pyx_e_9punyverse_7_glgeom_GL_LIGHT2 = 0x4002,
__pyx_e_9punyverse_7_glgeom_GL_LIGHT3 = 0x4003,
__pyx_e_9punyverse_7_glgeom_GL_LIGHT4 = 0x4004,
__pyx_e_9punyverse_7_glgeom_GL_LIGHT5 = 0x4005,
__pyx_e_9punyverse_7_glgeom_GL_LIGHT6 = 0x4006,
__pyx_e_9punyverse_7_glgeom_GL_LIGHT7 = 0x4007,
__pyx_e_9punyverse_7_glgeom_GL_SPOT_EXPONENT = 0x1205,
__pyx_e_9punyverse_7_glgeom_GL_SPOT_CUTOFF = 0x1206,
__pyx_e_9punyverse_7_glgeom_GL_CONSTANT_ATTENUATION = 0x1207,
__pyx_e_9punyverse_7_glgeom_GL_LINEAR_ATTENUATION = 0x1208,
__pyx_e_9punyverse_7_glgeom_GL_QUADRATIC_ATTENUATION = 0x1209,
__pyx_e_9punyverse_7_glgeom_GL_AMBIENT = 0x1200,
__pyx_e_9punyverse_7_glgeom_GL_DIFFUSE = 0x1201,
__pyx_e_9punyverse_7_glgeom_GL_SPECULAR = 0x1202,
__pyx_e_9punyverse_7_glgeom_GL_SHININESS = 0x1601,
__pyx_e_9punyverse_7_glgeom_GL_EMISSION = 0x1600,
__pyx_e_9punyverse_7_glgeom_GL_POSITION = 0x1203,
__pyx_e_9punyverse_7_glgeom_GL_SPOT_DIRECTION = 0x1204,
__pyx_e_9punyverse_7_glgeom_GL_AMBIENT_AND_DIFFUSE = 0x1602,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_INDEXES = 0x1603,
__pyx_e_9punyverse_7_glgeom_GL_LIGHT_MODEL_TWO_SIDE = 0x0B52,
__pyx_e_9punyverse_7_glgeom_GL_LIGHT_MODEL_LOCAL_VIEWER = 0x0B51,
__pyx_e_9punyverse_7_glgeom_GL_LIGHT_MODEL_AMBIENT = 0x0B53,
__pyx_e_9punyverse_7_glgeom_GL_FRONT_AND_BACK = 0x0408,
__pyx_e_9punyverse_7_glgeom_GL_SHADE_MODEL = 0x0B54,
__pyx_e_9punyverse_7_glgeom_GL_FLAT = 0x1D00,
__pyx_e_9punyverse_7_glgeom_GL_SMOOTH = 0x1D01,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_MATERIAL = 0x0B57,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_MATERIAL_FACE = 0x0B55,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_MATERIAL_PARAMETER = 0x0B56,
__pyx_e_9punyverse_7_glgeom_GL_NORMALIZE = 0x0BA1,
__pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE0 = 0x3000,
__pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE1 = 0x3001,
__pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE2 = 0x3002,
__pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE3 = 0x3003,
__pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE4 = 0x3004,
__pyx_e_9punyverse_7_glgeom_GL_CLIP_PLANE5 = 0x3005,
__pyx_e_9punyverse_7_glgeom_GL_ACCUM_RED_BITS = 0x0D58,
__pyx_e_9punyverse_7_glgeom_GL_ACCUM_GREEN_BITS = 0x0D59,
__pyx_e_9punyverse_7_glgeom_GL_ACCUM_BLUE_BITS = 0x0D5A,
__pyx_e_9punyverse_7_glgeom_GL_ACCUM_ALPHA_BITS = 0x0D5B,
__pyx_e_9punyverse_7_glgeom_GL_ACCUM_CLEAR_VALUE = 0x0B80,
__pyx_e_9punyverse_7_glgeom_GL_ACCUM = 0x0100,
__pyx_e_9punyverse_7_glgeom_GL_ADD = 0x0104,
__pyx_e_9punyverse_7_glgeom_GL_LOAD = 0x0101,
__pyx_e_9punyverse_7_glgeom_GL_MULT = 0x0103,
__pyx_e_9punyverse_7_glgeom_GL_RETURN = 0x0102,
__pyx_e_9punyverse_7_glgeom_GL_ALPHA_TEST = 0x0BC0,
__pyx_e_9punyverse_7_glgeom_GL_ALPHA_TEST_REF = 0x0BC2,
__pyx_e_9punyverse_7_glgeom_GL_ALPHA_TEST_FUNC = 0x0BC1,
__pyx_e_9punyverse_7_glgeom_GL_BLEND = 0x0BE2,
__pyx_e_9punyverse_7_glgeom_GL_BLEND_SRC = 0x0BE1,
__pyx_e_9punyverse_7_glgeom_GL_BLEND_DST = 0x0BE0,
__pyx_e_9punyverse_7_glgeom_GL_ZERO = 0x0,
__pyx_e_9punyverse_7_glgeom_GL_ONE = 0x1,
__pyx_e_9punyverse_7_glgeom_GL_SRC_COLOR = 0x0300,
__pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_SRC_COLOR = 0x0301,
__pyx_e_9punyverse_7_glgeom_GL_SRC_ALPHA = 0x0302,
__pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_SRC_ALPHA = 0x0303,
__pyx_e_9punyverse_7_glgeom_GL_DST_ALPHA = 0x0304,
__pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_DST_ALPHA = 0x0305,
__pyx_e_9punyverse_7_glgeom_GL_DST_COLOR = 0x0306,
__pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_DST_COLOR = 0x0307,
__pyx_e_9punyverse_7_glgeom_GL_SRC_ALPHA_SATURATE = 0x0308,
__pyx_e_9punyverse_7_glgeom_GL_CONSTANT_COLOR = 0x8001,
__pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_CONSTANT_COLOR = 0x8002,
__pyx_e_9punyverse_7_glgeom_GL_CONSTANT_ALPHA = 0x8003,
__pyx_e_9punyverse_7_glgeom_GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004,
__pyx_e_9punyverse_7_glgeom_GL_FEEDBACK = 0x1C01,
__pyx_e_9punyverse_7_glgeom_GL_RENDER = 0x1C00,
__pyx_e_9punyverse_7_glgeom_GL_SELECT = 0x1C02,
__pyx_e_9punyverse_7_glgeom_GL_2D = 0x0600,
__pyx_e_9punyverse_7_glgeom_GL_3D = 0x0601,
__pyx_e_9punyverse_7_glgeom_GL_3D_COLOR = 0x0602,
__pyx_e_9punyverse_7_glgeom_GL_3D_COLOR_TEXTURE = 0x0603,
__pyx_e_9punyverse_7_glgeom_GL_4D_COLOR_TEXTURE = 0x0604,
__pyx_e_9punyverse_7_glgeom_GL_POINT_TOKEN = 0x0701,
__pyx_e_9punyverse_7_glgeom_GL_LINE_TOKEN = 0x0702,
__pyx_e_9punyverse_7_glgeom_GL_LINE_RESET_TOKEN = 0x0707,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_TOKEN = 0x0703,
__pyx_e_9punyverse_7_glgeom_GL_BITMAP_TOKEN = 0x0704,
__pyx_e_9punyverse_7_glgeom_GL_DRAW_PIXEL_TOKEN = 0x0705,
__pyx_e_9punyverse_7_glgeom_GL_COPY_PIXEL_TOKEN = 0x0706,
__pyx_e_9punyverse_7_glgeom_GL_PASS_THROUGH_TOKEN = 0x0700,
__pyx_e_9punyverse_7_glgeom_GL_FEEDBACK_BUFFER_POINTER = 0x0DF0,
__pyx_e_9punyverse_7_glgeom_GL_FEEDBACK_BUFFER_SIZE = 0x0DF1,
__pyx_e_9punyverse_7_glgeom_GL_FEEDBACK_BUFFER_TYPE = 0x0DF2,
__pyx_e_9punyverse_7_glgeom_GL_SELECTION_BUFFER_POINTER = 0x0DF3,
__pyx_e_9punyverse_7_glgeom_GL_SELECTION_BUFFER_SIZE = 0x0DF4,
__pyx_e_9punyverse_7_glgeom_GL_FOG = 0x0B60,
__pyx_e_9punyverse_7_glgeom_GL_FOG_MODE = 0x0B65,
__pyx_e_9punyverse_7_glgeom_GL_FOG_DENSITY = 0x0B62,
__pyx_e_9punyverse_7_glgeom_GL_FOG_COLOR = 0x0B66,
__pyx_e_9punyverse_7_glgeom_GL_FOG_INDEX = 0x0B61,
__pyx_e_9punyverse_7_glgeom_GL_FOG_START = 0x0B63,
__pyx_e_9punyverse_7_glgeom_GL_FOG_END = 0x0B64,
__pyx_e_9punyverse_7_glgeom_GL_LINEAR = 0x2601,
__pyx_e_9punyverse_7_glgeom_GL_EXP = 0x0800,
__pyx_e_9punyverse_7_glgeom_GL_EXP2 = 0x0801,
__pyx_e_9punyverse_7_glgeom_GL_LOGIC_OP = 0x0BF1,
__pyx_e_9punyverse_7_glgeom_GL_INDEX_LOGIC_OP = 0x0BF1,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_LOGIC_OP = 0x0BF2,
__pyx_e_9punyverse_7_glgeom_GL_LOGIC_OP_MODE = 0x0BF0,
__pyx_e_9punyverse_7_glgeom_GL_CLEAR = 0x1500,
__pyx_e_9punyverse_7_glgeom_GL_SET = 0x150F,
__pyx_e_9punyverse_7_glgeom_GL_COPY = 0x1503,
__pyx_e_9punyverse_7_glgeom_GL_COPY_INVERTED = 0x150C,
__pyx_e_9punyverse_7_glgeom_GL_NOOP = 0x1505,
__pyx_e_9punyverse_7_glgeom_GL_INVERT = 0x150A,
__pyx_e_9punyverse_7_glgeom_GL_AND = 0x1501,
__pyx_e_9punyverse_7_glgeom_GL_NAND = 0x150E,
__pyx_e_9punyverse_7_glgeom_GL_OR = 0x1507,
__pyx_e_9punyverse_7_glgeom_GL_NOR = 0x1508,
__pyx_e_9punyverse_7_glgeom_GL_XOR = 0x1506,
__pyx_e_9punyverse_7_glgeom_GL_EQUIV = 0x1509,
__pyx_e_9punyverse_7_glgeom_GL_AND_REVERSE = 0x1502,
__pyx_e_9punyverse_7_glgeom_GL_AND_INVERTED = 0x1504,
__pyx_e_9punyverse_7_glgeom_GL_OR_REVERSE = 0x150B,
__pyx_e_9punyverse_7_glgeom_GL_OR_INVERTED = 0x150D,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_TEST = 0x0B90,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_WRITEMASK = 0x0B98,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_BITS = 0x0D57,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_FUNC = 0x0B92,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_VALUE_MASK = 0x0B93,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_REF = 0x0B97,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_FAIL = 0x0B94,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_PASS_DEPTH_PASS = 0x0B96,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_CLEAR_VALUE = 0x0B91,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_INDEX = 0x1901,
__pyx_e_9punyverse_7_glgeom_GL_KEEP = 0x1E00,
__pyx_e_9punyverse_7_glgeom_GL_REPLACE = 0x1E01,
__pyx_e_9punyverse_7_glgeom_GL_INCR = 0x1E02,
__pyx_e_9punyverse_7_glgeom_GL_DECR = 0x1E03,
__pyx_e_9punyverse_7_glgeom_GL_NONE = 0x0,
__pyx_e_9punyverse_7_glgeom_GL_LEFT = 0x0406,
__pyx_e_9punyverse_7_glgeom_GL_RIGHT = 0x0407,
__pyx_e_9punyverse_7_glgeom_GL_FRONT_LEFT = 0x0400,
__pyx_e_9punyverse_7_glgeom_GL_FRONT_RIGHT = 0x0401,
__pyx_e_9punyverse_7_glgeom_GL_BACK_LEFT = 0x0402,
__pyx_e_9punyverse_7_glgeom_GL_BACK_RIGHT = 0x0403,
__pyx_e_9punyverse_7_glgeom_GL_AUX0 = 0x0409,
__pyx_e_9punyverse_7_glgeom_GL_AUX1 = 0x040A,
__pyx_e_9punyverse_7_glgeom_GL_AUX2 = 0x040B,
__pyx_e_9punyverse_7_glgeom_GL_AUX3 = 0x040C,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_INDEX = 0x1900,
__pyx_e_9punyverse_7_glgeom_GL_RED = 0x1903,
__pyx_e_9punyverse_7_glgeom_GL_GREEN = 0x1904,
__pyx_e_9punyverse_7_glgeom_GL_BLUE = 0x1905,
__pyx_e_9punyverse_7_glgeom_GL_ALPHA = 0x1906,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE = 0x1909,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE_ALPHA = 0x190A,
__pyx_e_9punyverse_7_glgeom_GL_ALPHA_BITS = 0x0D55,
__pyx_e_9punyverse_7_glgeom_GL_RED_BITS = 0x0D52,
__pyx_e_9punyverse_7_glgeom_GL_GREEN_BITS = 0x0D53,
__pyx_e_9punyverse_7_glgeom_GL_BLUE_BITS = 0x0D54,
__pyx_e_9punyverse_7_glgeom_GL_INDEX_BITS = 0x0D51,
__pyx_e_9punyverse_7_glgeom_GL_SUBPIXEL_BITS = 0x0D50,
__pyx_e_9punyverse_7_glgeom_GL_AUX_BUFFERS = 0x0C00,
__pyx_e_9punyverse_7_glgeom_GL_READ_BUFFER = 0x0C02,
__pyx_e_9punyverse_7_glgeom_GL_DRAW_BUFFER = 0x0C01,
__pyx_e_9punyverse_7_glgeom_GL_DOUBLEBUFFER = 0x0C32,
__pyx_e_9punyverse_7_glgeom_GL_STEREO = 0x0C33,
__pyx_e_9punyverse_7_glgeom_GL_BITMAP = 0x1A00,
__pyx_e_9punyverse_7_glgeom_GL_COLOR = 0x1800,
__pyx_e_9punyverse_7_glgeom_GL_DEPTH = 0x1801,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL = 0x1802,
__pyx_e_9punyverse_7_glgeom_GL_DITHER = 0x0BD0,
__pyx_e_9punyverse_7_glgeom_GL_RGB = 0x1907,
__pyx_e_9punyverse_7_glgeom_GL_RGBA = 0x1908,
__pyx_e_9punyverse_7_glgeom_GL_MAX_LIST_NESTING = 0x0B31,
__pyx_e_9punyverse_7_glgeom_GL_MAX_ATTRIB_STACK_DEPTH = 0x0D35,
__pyx_e_9punyverse_7_glgeom_GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36,
__pyx_e_9punyverse_7_glgeom_GL_MAX_NAME_STACK_DEPTH = 0x0D37,
__pyx_e_9punyverse_7_glgeom_GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38,
__pyx_e_9punyverse_7_glgeom_GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39,
__pyx_e_9punyverse_7_glgeom_GL_MAX_EVAL_ORDER = 0x0D30,
__pyx_e_9punyverse_7_glgeom_GL_MAX_LIGHTS = 0x0D31,
__pyx_e_9punyverse_7_glgeom_GL_MAX_CLIP_PLANES = 0x0D32,
__pyx_e_9punyverse_7_glgeom_GL_MAX_TEXTURE_SIZE = 0x0D33,
__pyx_e_9punyverse_7_glgeom_GL_MAX_PIXEL_MAP_TABLE = 0x0D34,
__pyx_e_9punyverse_7_glgeom_GL_MAX_VIEWPORT_DIMS = 0x0D3A,
__pyx_e_9punyverse_7_glgeom_GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = 0x0D3B,
__pyx_e_9punyverse_7_glgeom_GL_ATTRIB_STACK_DEPTH = 0x0BB0,
__pyx_e_9punyverse_7_glgeom_GL_CLIENT_ATTRIB_STACK_DEPTH = 0x0BB1,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_CLEAR_VALUE = 0x0C22,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_WRITEMASK = 0x0C23,
__pyx_e_9punyverse_7_glgeom_GL_CURRENT_INDEX = 0x0B01,
__pyx_e_9punyverse_7_glgeom_GL_CURRENT_COLOR = 0x0B00,
__pyx_e_9punyverse_7_glgeom_GL_CURRENT_NORMAL = 0x0B02,
__pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_COLOR = 0x0B04,
__pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_DISTANCE = 0x0B09,
__pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_INDEX = 0x0B05,
__pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_POSITION = 0x0B07,
__pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06,
__pyx_e_9punyverse_7_glgeom_GL_CURRENT_RASTER_POSITION_VALID = 0x0B08,
__pyx_e_9punyverse_7_glgeom_GL_CURRENT_TEXTURE_COORDS = 0x0B03,
__pyx_e_9punyverse_7_glgeom_GL_INDEX_CLEAR_VALUE = 0x0C20,
__pyx_e_9punyverse_7_glgeom_GL_INDEX_MODE = 0x0C30,
__pyx_e_9punyverse_7_glgeom_GL_INDEX_WRITEMASK = 0x0C21,
__pyx_e_9punyverse_7_glgeom_GL_MODELVIEW_MATRIX = 0x0BA6,
__pyx_e_9punyverse_7_glgeom_GL_MODELVIEW_STACK_DEPTH = 0x0BA3,
__pyx_e_9punyverse_7_glgeom_GL_NAME_STACK_DEPTH = 0x0D70,
__pyx_e_9punyverse_7_glgeom_GL_PROJECTION_MATRIX = 0x0BA7,
__pyx_e_9punyverse_7_glgeom_GL_PROJECTION_STACK_DEPTH = 0x0BA4,
__pyx_e_9punyverse_7_glgeom_GL_RENDER_MODE = 0x0C40,
__pyx_e_9punyverse_7_glgeom_GL_RGBA_MODE = 0x0C31,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_MATRIX = 0x0BA8,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_STACK_DEPTH = 0x0BA5,
__pyx_e_9punyverse_7_glgeom_GL_VIEWPORT = 0x0BA2,
__pyx_e_9punyverse_7_glgeom_GL_AUTO_NORMAL = 0x0D80,
__pyx_e_9punyverse_7_glgeom_GL_MAP1_COLOR_4 = 0x0D90,
__pyx_e_9punyverse_7_glgeom_GL_MAP1_GRID_DOMAIN = 0x0DD0,
__pyx_e_9punyverse_7_glgeom_GL_MAP1_GRID_SEGMENTS = 0x0DD1,
__pyx_e_9punyverse_7_glgeom_GL_MAP1_INDEX = 0x0D91,
__pyx_e_9punyverse_7_glgeom_GL_MAP1_NORMAL = 0x0D92,
__pyx_e_9punyverse_7_glgeom_GL_MAP1_TEXTURE_COORD_1 = 0x0D93,
__pyx_e_9punyverse_7_glgeom_GL_MAP1_TEXTURE_COORD_2 = 0x0D94,
__pyx_e_9punyverse_7_glgeom_GL_MAP1_TEXTURE_COORD_3 = 0x0D95,
__pyx_e_9punyverse_7_glgeom_GL_MAP1_TEXTURE_COORD_4 = 0x0D96,
__pyx_e_9punyverse_7_glgeom_GL_MAP1_VERTEX_3 = 0x0D97,
__pyx_e_9punyverse_7_glgeom_GL_MAP1_VERTEX_4 = 0x0D98,
__pyx_e_9punyverse_7_glgeom_GL_MAP2_COLOR_4 = 0x0DB0,
__pyx_e_9punyverse_7_glgeom_GL_MAP2_GRID_DOMAIN = 0x0DD2,
__pyx_e_9punyverse_7_glgeom_GL_MAP2_GRID_SEGMENTS = 0x0DD3,
__pyx_e_9punyverse_7_glgeom_GL_MAP2_INDEX = 0x0DB1,
__pyx_e_9punyverse_7_glgeom_GL_MAP2_NORMAL = 0x0DB2,
__pyx_e_9punyverse_7_glgeom_GL_MAP2_TEXTURE_COORD_1 = 0x0DB3,
__pyx_e_9punyverse_7_glgeom_GL_MAP2_TEXTURE_COORD_2 = 0x0DB4,
__pyx_e_9punyverse_7_glgeom_GL_MAP2_TEXTURE_COORD_3 = 0x0DB5,
__pyx_e_9punyverse_7_glgeom_GL_MAP2_TEXTURE_COORD_4 = 0x0DB6,
__pyx_e_9punyverse_7_glgeom_GL_MAP2_VERTEX_3 = 0x0DB7,
__pyx_e_9punyverse_7_glgeom_GL_MAP2_VERTEX_4 = 0x0DB8,
__pyx_e_9punyverse_7_glgeom_GL_COEFF = 0x0A00,
__pyx_e_9punyverse_7_glgeom_GL_DOMAIN = 0x0A02,
__pyx_e_9punyverse_7_glgeom_GL_ORDER = 0x0A01,
__pyx_e_9punyverse_7_glgeom_GL_FOG_HINT = 0x0C54,
__pyx_e_9punyverse_7_glgeom_GL_LINE_SMOOTH_HINT = 0x0C52,
__pyx_e_9punyverse_7_glgeom_GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50,
__pyx_e_9punyverse_7_glgeom_GL_POINT_SMOOTH_HINT = 0x0C51,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_SMOOTH_HINT = 0x0C53,
__pyx_e_9punyverse_7_glgeom_GL_DONT_CARE = 0x1100,
__pyx_e_9punyverse_7_glgeom_GL_FASTEST = 0x1101,
__pyx_e_9punyverse_7_glgeom_GL_NICEST = 0x1102,
__pyx_e_9punyverse_7_glgeom_GL_SCISSOR_TEST = 0x0C11,
__pyx_e_9punyverse_7_glgeom_GL_SCISSOR_BOX = 0x0C10,
__pyx_e_9punyverse_7_glgeom_GL_MAP_COLOR = 0x0D10,
__pyx_e_9punyverse_7_glgeom_GL_MAP_STENCIL = 0x0D11,
__pyx_e_9punyverse_7_glgeom_GL_INDEX_SHIFT = 0x0D12,
__pyx_e_9punyverse_7_glgeom_GL_INDEX_OFFSET = 0x0D13,
__pyx_e_9punyverse_7_glgeom_GL_RED_SCALE = 0x0D14,
__pyx_e_9punyverse_7_glgeom_GL_RED_BIAS = 0x0D15,
__pyx_e_9punyverse_7_glgeom_GL_GREEN_SCALE = 0x0D18,
__pyx_e_9punyverse_7_glgeom_GL_GREEN_BIAS = 0x0D19,
__pyx_e_9punyverse_7_glgeom_GL_BLUE_SCALE = 0x0D1A,
__pyx_e_9punyverse_7_glgeom_GL_BLUE_BIAS = 0x0D1B,
__pyx_e_9punyverse_7_glgeom_GL_ALPHA_SCALE = 0x0D1C,
__pyx_e_9punyverse_7_glgeom_GL_ALPHA_BIAS = 0x0D1D,
__pyx_e_9punyverse_7_glgeom_GL_DEPTH_SCALE = 0x0D1E,
__pyx_e_9punyverse_7_glgeom_GL_DEPTH_BIAS = 0x0D1F,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_S_TO_S_SIZE = 0x0CB1,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_I_SIZE = 0x0CB0,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_R_SIZE = 0x0CB2,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_G_SIZE = 0x0CB3,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_B_SIZE = 0x0CB4,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_A_SIZE = 0x0CB5,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_R_TO_R_SIZE = 0x0CB6,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_G_TO_G_SIZE = 0x0CB7,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_B_TO_B_SIZE = 0x0CB8,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_A_TO_A_SIZE = 0x0CB9,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_S_TO_S = 0x0C71,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_I = 0x0C70,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_R = 0x0C72,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_G = 0x0C73,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_B = 0x0C74,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_I_TO_A = 0x0C75,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_R_TO_R = 0x0C76,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_G_TO_G = 0x0C77,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_B_TO_B = 0x0C78,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MAP_A_TO_A = 0x0C79,
__pyx_e_9punyverse_7_glgeom_GL_PACK_ALIGNMENT = 0x0D05,
__pyx_e_9punyverse_7_glgeom_GL_PACK_LSB_FIRST = 0x0D01,
__pyx_e_9punyverse_7_glgeom_GL_PACK_ROW_LENGTH = 0x0D02,
__pyx_e_9punyverse_7_glgeom_GL_PACK_SKIP_PIXELS = 0x0D04,
__pyx_e_9punyverse_7_glgeom_GL_PACK_SKIP_ROWS = 0x0D03,
__pyx_e_9punyverse_7_glgeom_GL_PACK_SWAP_BYTES = 0x0D00,
__pyx_e_9punyverse_7_glgeom_GL_UNPACK_ALIGNMENT = 0x0CF5,
__pyx_e_9punyverse_7_glgeom_GL_UNPACK_LSB_FIRST = 0x0CF1,
__pyx_e_9punyverse_7_glgeom_GL_UNPACK_ROW_LENGTH = 0x0CF2,
__pyx_e_9punyverse_7_glgeom_GL_UNPACK_SKIP_PIXELS = 0x0CF4,
__pyx_e_9punyverse_7_glgeom_GL_UNPACK_SKIP_ROWS = 0x0CF3,
__pyx_e_9punyverse_7_glgeom_GL_UNPACK_SWAP_BYTES = 0x0CF0,
__pyx_e_9punyverse_7_glgeom_GL_ZOOM_X = 0x0D16,
__pyx_e_9punyverse_7_glgeom_GL_ZOOM_Y = 0x0D17,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_ENV = 0x2300,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_ENV_MODE = 0x2200,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_1D = 0x0DE0,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_2D = 0x0DE1,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_WRAP_S = 0x2802,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_WRAP_T = 0x2803,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_MAG_FILTER = 0x2800,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_MIN_FILTER = 0x2801,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_ENV_COLOR = 0x2201,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GEN_S = 0x0C60,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GEN_T = 0x0C61,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GEN_MODE = 0x2500,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BORDER_COLOR = 0x1004,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_WIDTH = 0x1000,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_HEIGHT = 0x1001,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BORDER = 0x1005,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_COMPONENTS = 0x1003,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_RED_SIZE = 0x805C,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GREEN_SIZE = 0x805D,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BLUE_SIZE = 0x805E,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_ALPHA_SIZE = 0x805F,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_LUMINANCE_SIZE = 0x8060,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_INTENSITY_SIZE = 0x8061,
__pyx_e_9punyverse_7_glgeom_GL_NEAREST_MIPMAP_NEAREST = 0x2700,
__pyx_e_9punyverse_7_glgeom_GL_NEAREST_MIPMAP_LINEAR = 0x2702,
__pyx_e_9punyverse_7_glgeom_GL_LINEAR_MIPMAP_NEAREST = 0x2701,
__pyx_e_9punyverse_7_glgeom_GL_LINEAR_MIPMAP_LINEAR = 0x2703,
__pyx_e_9punyverse_7_glgeom_GL_OBJECT_LINEAR = 0x2401,
__pyx_e_9punyverse_7_glgeom_GL_OBJECT_PLANE = 0x2501,
__pyx_e_9punyverse_7_glgeom_GL_EYE_LINEAR = 0x2400,
__pyx_e_9punyverse_7_glgeom_GL_EYE_PLANE = 0x2502,
__pyx_e_9punyverse_7_glgeom_GL_SPHERE_MAP = 0x2402,
__pyx_e_9punyverse_7_glgeom_GL_DECAL = 0x2101,
__pyx_e_9punyverse_7_glgeom_GL_MODULATE = 0x2100,
__pyx_e_9punyverse_7_glgeom_GL_NEAREST = 0x2600,
__pyx_e_9punyverse_7_glgeom_GL_REPEAT = 0x2901,
__pyx_e_9punyverse_7_glgeom_GL_CLAMP = 0x2900,
__pyx_e_9punyverse_7_glgeom_GL_S = 0x2000,
__pyx_e_9punyverse_7_glgeom_GL_T = 0x2001,
__pyx_e_9punyverse_7_glgeom_GL_R = 0x2002,
__pyx_e_9punyverse_7_glgeom_GL_Q = 0x2003,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GEN_R = 0x0C62,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_GEN_Q = 0x0C63,
__pyx_e_9punyverse_7_glgeom_GL_VENDOR = 0x1F00,
__pyx_e_9punyverse_7_glgeom_GL_RENDERER = 0x1F01,
__pyx_e_9punyverse_7_glgeom_GL_VERSION = 0x1F02,
__pyx_e_9punyverse_7_glgeom_GL_EXTENSIONS = 0x1F03,
__pyx_e_9punyverse_7_glgeom_GL_NO_ERROR = 0x0,
__pyx_e_9punyverse_7_glgeom_GL_INVALID_VALUE = 0x0501,
__pyx_e_9punyverse_7_glgeom_GL_INVALID_ENUM = 0x0500,
__pyx_e_9punyverse_7_glgeom_GL_INVALID_OPERATION = 0x0502,
__pyx_e_9punyverse_7_glgeom_GL_STACK_OVERFLOW = 0x0503,
__pyx_e_9punyverse_7_glgeom_GL_STACK_UNDERFLOW = 0x0504,
__pyx_e_9punyverse_7_glgeom_GL_OUT_OF_MEMORY = 0x0505,
__pyx_e_9punyverse_7_glgeom_GL_CURRENT_BIT = 0x00000001,
__pyx_e_9punyverse_7_glgeom_GL_POINT_BIT = 0x00000002,
__pyx_e_9punyverse_7_glgeom_GL_LINE_BIT = 0x00000004,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_BIT = 0x00000008,
__pyx_e_9punyverse_7_glgeom_GL_POLYGON_STIPPLE_BIT = 0x00000010,
__pyx_e_9punyverse_7_glgeom_GL_PIXEL_MODE_BIT = 0x00000020,
__pyx_e_9punyverse_7_glgeom_GL_LIGHTING_BIT = 0x00000040,
__pyx_e_9punyverse_7_glgeom_GL_FOG_BIT = 0x00000080,
__pyx_e_9punyverse_7_glgeom_GL_DEPTH_BUFFER_BIT = 0x00000100,
__pyx_e_9punyverse_7_glgeom_GL_ACCUM_BUFFER_BIT = 0x00000200,
__pyx_e_9punyverse_7_glgeom_GL_STENCIL_BUFFER_BIT = 0x00000400,
__pyx_e_9punyverse_7_glgeom_GL_VIEWPORT_BIT = 0x00000800,
__pyx_e_9punyverse_7_glgeom_GL_TRANSFORM_BIT = 0x00001000,
__pyx_e_9punyverse_7_glgeom_GL_ENABLE_BIT = 0x00002000,
__pyx_e_9punyverse_7_glgeom_GL_COLOR_BUFFER_BIT = 0x00004000,
__pyx_e_9punyverse_7_glgeom_GL_HINT_BIT = 0x00008000,
__pyx_e_9punyverse_7_glgeom_GL_EVAL_BIT = 0x00010000,
__pyx_e_9punyverse_7_glgeom_GL_LIST_BIT = 0x00020000,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BIT = 0x00040000,
__pyx_e_9punyverse_7_glgeom_GL_SCISSOR_BIT = 0x00080000,
__pyx_e_9punyverse_7_glgeom_GL_ALL_ATTRIB_BITS = 0x000FFFFF,
__pyx_e_9punyverse_7_glgeom_GL_PROXY_TEXTURE_1D = 0x8063,
__pyx_e_9punyverse_7_glgeom_GL_PROXY_TEXTURE_2D = 0x8064,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_PRIORITY = 0x8066,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_RESIDENT = 0x8067,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BINDING_1D = 0x8068,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_BINDING_2D = 0x8069,
__pyx_e_9punyverse_7_glgeom_GL_TEXTURE_INTERNAL_FORMAT = 0x1003,
__pyx_e_9punyverse_7_glgeom_GL_ALPHA4 = 0x803B,
__pyx_e_9punyverse_7_glgeom_GL_ALPHA8 = 0x803C,
__pyx_e_9punyverse_7_glgeom_GL_ALPHA12 = 0x803D,
__pyx_e_9punyverse_7_glgeom_GL_ALPHA16 = 0x803E,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE4 = 0x803F,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE8 = 0x8040,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE12 = 0x8041,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE16 = 0x8042,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE4_ALPHA4 = 0x8043,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE6_ALPHA2 = 0x8044,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE8_ALPHA8 = 0x8045,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE12_ALPHA4 = 0x8046,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE12_ALPHA12 = 0x8047,
__pyx_e_9punyverse_7_glgeom_GL_LUMINANCE16_ALPHA16 = 0x8048,
__pyx_e_9punyverse_7_glgeom_GL_INTENSITY = 0x8049,
__pyx_e_9punyverse_7_glgeom_GL_INTENSITY4 = 0x804A,
__pyx_e_9punyverse_7_glgeom_GL_INTENSITY8 = 0x804B,
__pyx_e_9punyverse_7_glgeom_GL_INTENSITY12 = 0x804C,
__pyx_e_9punyverse_7_glgeom_GL_INTENSITY16 = 0x804D,
__pyx_e_9punyverse_7_glgeom_GL_R3_G3_B2 = 0x2A10,
__pyx_e_9punyverse_7_glgeom_GL_RGB4 = 0x804F,
__pyx_e_9punyverse_7_glgeom_GL_RGB5 = 0x8050,
__pyx_e_9punyverse_7_glgeom_GL_RGB8 = 0x8051,
__pyx_e_9punyverse_7_glgeom_GL_RGB10 = 0x8052,
__pyx_e_9punyverse_7_glgeom_GL_RGB12 = 0x8053,
__pyx_e_9punyverse_7_glgeom_GL_RGB16 = 0x8054,
__pyx_e_9punyverse_7_glgeom_GL_RGBA2 = 0x8055,
__pyx_e_9punyverse_7_glgeom_GL_RGBA4 = 0x8056,
__pyx_e_9punyverse_7_glgeom_GL_RGB5_A1 = 0x8057,
__pyx_e_9punyverse_7_glgeom_GL_RGBA8 = 0x8058,
__pyx_e_9punyverse_7_glgeom_GL_RGB10_A2 = 0x8059,
__pyx_e_9punyverse_7_glgeom_GL_RGBA12 = 0x805A,
__pyx_e_9punyverse_7_glgeom_GL_RGBA16 = 0x805B,
__pyx_e_9punyverse_7_glgeom_GL_CLIENT_PIXEL_STORE_BIT = 0x00000001,
__pyx_e_9punyverse_7_glgeom_GL_CLIENT_VERTEX_ARRAY_BIT = 0x00000002,
__pyx_e_9punyverse_7_glgeom_GL_ALL_CLIENT_ATTRIB_BITS = 0xFFFFFFFF,
__pyx_e_9punyverse_7_glgeom_GL_CLIENT_ALL_ATTRIB_BITS = 0xFFFFFFFF,
__pyx_e_9punyverse_7_glgeom_GLU_FALSE = 0,
__pyx_e_9punyverse_7_glgeom_GLU_TRUE = 1,
__pyx_e_9punyverse_7_glgeom_GLU_VERSION = 100800,
__pyx_e_9punyverse_7_glgeom_GLU_EXTENSIONS = 100801,
__pyx_e_9punyverse_7_glgeom_GLU_INVALID_ENUM = 100900,
__pyx_e_9punyverse_7_glgeom_GLU_INVALID_VALUE = 100901,
__pyx_e_9punyverse_7_glgeom_GLU_OUT_OF_MEMORY = 100902,
__pyx_e_9punyverse_7_glgeom_GLU_INVALID_OPERATION = 100904,
__pyx_e_9punyverse_7_glgeom_GLU_OUTLINE_POLYGON = 100240,
__pyx_e_9punyverse_7_glgeom_GLU_OUTLINE_PATCH = 100241,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR1 = 100251,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR2 = 100252,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR3 = 100253,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR4 = 100254,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR5 = 100255,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR6 = 100256,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR7 = 100257,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR8 = 100258,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR9 = 100259,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR10 = 100260,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR11 = 100261,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR12 = 100262,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR13 = 100263,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR14 = 100264,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR15 = 100265,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR16 = 100266,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR17 = 100267,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR18 = 100268,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR19 = 100269,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR20 = 100270,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR21 = 100271,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR22 = 100272,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR23 = 100273,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR24 = 100274,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR25 = 100275,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR26 = 100276,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR27 = 100277,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR28 = 100278,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR29 = 100279,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR30 = 100280,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR31 = 100281,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR32 = 100282,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR33 = 100283,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR34 = 100284,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR35 = 100285,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR36 = 100286,
__pyx_e_9punyverse_7_glgeom_GLU_NURBS_ERROR37 = 100287,
__pyx_e_9punyverse_7_glgeom_GLU_AUTO_LOAD_MATRIX = 100200,
__pyx_e_9punyverse_7_glgeom_GLU_CULLING = 100201,
__pyx_e_9punyverse_7_glgeom_GLU_SAMPLING_TOLERANCE = 100203,
__pyx_e_9punyverse_7_glgeom_GLU_DISPLAY_MODE = 100204,
__pyx_e_9punyverse_7_glgeom_GLU_PARAMETRIC_TOLERANCE = 100202,
__pyx_e_9punyverse_7_glgeom_GLU_SAMPLING_METHOD = 100205,
__pyx_e_9punyverse_7_glgeom_GLU_U_STEP = 100206,
__pyx_e_9punyverse_7_glgeom_GLU_V_STEP = 100207,
__pyx_e_9punyverse_7_glgeom_GLU_PATH_LENGTH = 100215,
__pyx_e_9punyverse_7_glgeom_GLU_PARAMETRIC_ERROR = 100216,
__pyx_e_9punyverse_7_glgeom_GLU_DOMAIN_DISTANCE = 100217,
__pyx_e_9punyverse_7_glgeom_GLU_MAP1_TRIM_2 = 100210,
__pyx_e_9punyverse_7_glgeom_GLU_MAP1_TRIM_3 = 100211,
__pyx_e_9punyverse_7_glgeom_GLU_POINT = 100010,
__pyx_e_9punyverse_7_glgeom_GLU_LINE = 100011,
__pyx_e_9punyverse_7_glgeom_GLU_FILL = 100012,
__pyx_e_9punyverse_7_glgeom_GLU_SILHOUETTE = 100013,
__pyx_e_9punyverse_7_glgeom_GLU_ERROR = 100103,
__pyx_e_9punyverse_7_glgeom_GLU_SMOOTH = 100000,
__pyx_e_9punyverse_7_glgeom_GLU_FLAT = 100001,
__pyx_e_9punyverse_7_glgeom_GLU_NONE = 100002,
__pyx_e_9punyverse_7_glgeom_GLU_OUTSIDE = 100020,
__pyx_e_9punyverse_7_glgeom_GLU_INSIDE = 100021,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_BEGIN = 100100,
__pyx_e_9punyverse_7_glgeom_GLU_BEGIN = 100100,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_VERTEX = 100101,
__pyx_e_9punyverse_7_glgeom_GLU_VERTEX = 100101,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_END = 100102,
__pyx_e_9punyverse_7_glgeom_GLU_END = 100102,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR = 100103,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_EDGE_FLAG = 100104,
__pyx_e_9punyverse_7_glgeom_GLU_EDGE_FLAG = 100104,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_COMBINE = 100105,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_BEGIN_DATA = 100106,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_VERTEX_DATA = 100107,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_END_DATA = 100108,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR_DATA = 100109,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_EDGE_FLAG_DATA = 100110,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_COMBINE_DATA = 100111,
__pyx_e_9punyverse_7_glgeom_GLU_CW = 100120,
__pyx_e_9punyverse_7_glgeom_GLU_CCW = 100121,
__pyx_e_9punyverse_7_glgeom_GLU_INTERIOR = 100122,
__pyx_e_9punyverse_7_glgeom_GLU_EXTERIOR = 100123,
__pyx_e_9punyverse_7_glgeom_GLU_UNKNOWN = 100124,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_RULE = 100140,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_BOUNDARY_ONLY = 100141,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_TOLERANCE = 100142,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR1 = 100151,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR2 = 100152,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR3 = 100153,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR4 = 100154,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR5 = 100155,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR6 = 100156,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR7 = 100157,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_ERROR8 = 100158,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_MISSING_BEGIN_POLYGON = 100151,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_MISSING_BEGIN_CONTOUR = 100152,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_MISSING_END_POLYGON = 100153,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_MISSING_END_CONTOUR = 100154,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_COORD_TOO_LARGE = 100155,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_NEED_COMBINE_CALLBACK = 100156,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_ODD = 100130,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_NONZERO = 100131,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_POSITIVE = 100132,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_NEGATIVE = 100133,
__pyx_e_9punyverse_7_glgeom_GLU_TESS_WINDING_ABS_GEQ_TWO = 100134
};
/* "punyverse\_glgeom.pyx":15
*
* @cython.cdivision(True)
* cpdef torus(float major_radius, float minor_radius, int n_major, int n_minor, tuple material, int shininess=125): # <<<<<<<<<<<<<<
* '''
* Torus function from the OpenGL red book.
*/
struct __pyx_opt_args_9punyverse_7_glgeom_torus {
int __pyx_n;
int shininess;
};
/* "punyverse\_glgeom.pyx":66
* glPopAttrib()
*
* cpdef bytes bgr_to_rgb(bytes buffer, int width, int height, bint alpha=0, bint bottom_up=1): # <<<<<<<<<<<<<<
* cdef int length = len(buffer)
* cdef int depth = length / (width * height)
*/
struct __pyx_opt_args_9punyverse_7_glgeom_bgr_to_rgb {
int __pyx_n;
int alpha;
int bottom_up;
};
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
typedef struct {
void (*INCREF)(void*, PyObject*, int);
void (*DECREF)(void*, PyObject*, int);
void (*GOTREF)(void*, PyObject*, int);
void (*GIVEREF)(void*, PyObject*, int);
void* (*SetupContext)(const char*, int, const char*);
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
if (acquire_gil) { \
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
PyGILState_Release(__pyx_gilstate_save); \
} else { \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
}
#else
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
#define __Pyx_RefNannyFinishContext() \
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
#define __Pyx_RefNannyDeclarations
#define __Pyx_RefNannySetupContext(name, acquire_gil)
#define __Pyx_RefNannyFinishContext()
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XINCREF(r) Py_XINCREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_XGOTREF(r)
#define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
PyObject *r;
if (!j) return NULL;
r = PyObject_GetItem(o, j);
Py_DECREF(j);
return r;
}
#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_List_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
PyObject *r = PyList_GET_ITEM(o, i);
Py_INCREF(r);
return r;
}
else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_Tuple_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, i);
Py_INCREF(r);
return r;
}
else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (PyList_CheckExact(o)) {
Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
PyObject *r = PyList_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
}
else if (PyTuple_CheckExact(o)) {
Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
} else { /* inlined PySequence_GetItem() */
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
if (likely(m && m->sq_item)) {
if (unlikely(i < 0) && likely(m->sq_length)) {
Py_ssize_t l = m->sq_length(o);
if (unlikely(l < 0)) return NULL;
i += l;
}
return m->sq_item(o, i);
}
}
#else
if (PySequence_Check(o)) {
return PySequence_GetItem(o, i);
}
#endif
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
const char* function_name); /*proto*/
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact); /*proto*/
static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */
#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
static int __Pyx_check_binary_version(void);
typedef struct {
int code_line;
PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
int count;
int max_count;
__Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from 'libc.math' */
/* Module declarations from 'libc.string' */
/* Module declarations from 'libc.stdlib' */
/* Module declarations from 'cython' */
/* Module declarations from 'punyverse._glgeom' */
static float __pyx_v_9punyverse_7_glgeom_GLU_TESS_MAX_COORD;
static float __pyx_v_9punyverse_7_glgeom_PI;
static float __pyx_v_9punyverse_7_glgeom_TWOPI;
static PyObject *__pyx_f_9punyverse_7_glgeom_torus(float, float, int, int, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_9punyverse_7_glgeom_torus *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_9punyverse_7_glgeom_bgr_to_rgb(PyObject *, int, int, int __pyx_skip_dispatch, struct __pyx_opt_args_9punyverse_7_glgeom_bgr_to_rgb *__pyx_optional_args); /*proto*/
#define __Pyx_MODULE_NAME "punyverse._glgeom"
int __pyx_module_is_main_punyverse___glgeom = 0;
/* Implementation of 'punyverse._glgeom' */
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_pf_9punyverse_7_glgeom_torus(CYTHON_UNUSED PyObject *__pyx_self, float __pyx_v_major_radius, float __pyx_v_minor_radius, int __pyx_v_n_major, int __pyx_v_n_minor, PyObject *__pyx_v_material, int __pyx_v_shininess); /* proto */
static PyObject *__pyx_pf_9punyverse_7_glgeom_2bgr_to_rgb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, int __pyx_v_width, int __pyx_v_height, int __pyx_v_alpha, int __pyx_v_bottom_up); /* proto */
static char __pyx_k__alpha[] = "alpha";
static char __pyx_k__range[] = "range";
static char __pyx_k__width[] = "width";
static char __pyx_k__buffer[] = "buffer";
static char __pyx_k__height[] = "height";
static char __pyx_k__xrange[] = "xrange";
static char __pyx_k__n_major[] = "n_major";
static char __pyx_k__n_minor[] = "n_minor";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__material[] = "material";
static char __pyx_k__bottom_up[] = "bottom_up";
static char __pyx_k__shininess[] = "shininess";
static char __pyx_k__major_radius[] = "major_radius";
static char __pyx_k__minor_radius[] = "minor_radius";
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__alpha;
static PyObject *__pyx_n_s__bottom_up;
static PyObject *__pyx_n_s__buffer;
static PyObject *__pyx_n_s__height;
static PyObject *__pyx_n_s__major_radius;
static PyObject *__pyx_n_s__material;
static PyObject *__pyx_n_s__minor_radius;
static PyObject *__pyx_n_s__n_major;
static PyObject *__pyx_n_s__n_minor;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__shininess;
static PyObject *__pyx_n_s__width;
static PyObject *__pyx_n_s__xrange;
/* "punyverse\_glgeom.pyx":15
*
* @cython.cdivision(True)
* cpdef torus(float major_radius, float minor_radius, int n_major, int n_minor, tuple material, int shininess=125): # <<<<<<<<<<<<<<
* '''
* Torus function from the OpenGL red book.
*/
static PyObject *__pyx_pw_9punyverse_7_glgeom_1torus(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_9punyverse_7_glgeom_torus(float __pyx_v_major_radius, float __pyx_v_minor_radius, int __pyx_v_n_major, int __pyx_v_n_minor, PyObject *__pyx_v_material, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9punyverse_7_glgeom_torus *__pyx_optional_args) {
int __pyx_v_shininess = ((int)125);
float __pyx_v_major_s;
float __pyx_v_minor_s;
float __pyx_v_a0;
float __pyx_v_a1;
float __pyx_v_x0;
float __pyx_v_y0;
float __pyx_v_x1;
float __pyx_v_y1;
float __pyx_v_b;
float __pyx_v_c;
float __pyx_v_r;
float __pyx_v_z;
float __pyx_v_m;
float __pyx_v_x;
float __pyx_v_y;
float __pyx_v_z2;
int __pyx_v_i;
int __pyx_v_j;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
GLfloat __pyx_t_2;
GLfloat __pyx_t_3;
GLfloat __pyx_t_4;
GLfloat __pyx_t_5;
GLfloat __pyx_t_6[4];
GLfloat __pyx_t_7[4];
int __pyx_t_8;
int __pyx_t_9;
int __pyx_t_10;
int __pyx_t_11;
int __pyx_t_12;
long __pyx_t_13;
int __pyx_t_14;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("torus", 0);
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_shininess = __pyx_optional_args->shininess;
}
}
/* "punyverse\_glgeom.pyx":19
* Torus function from the OpenGL red book.
* '''
* glPushAttrib(GL_CURRENT_BIT) # <<<<<<<<<<<<<<
* glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, [material[0], material[1], material[2], material[3]])
* glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [1, 1, 1, 1])
*/
glPushAttrib(__pyx_e_9punyverse_7_glgeom_GL_CURRENT_BIT);
/* "punyverse\_glgeom.pyx":20
* '''
* glPushAttrib(GL_CURRENT_BIT)
* glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, [material[0], material[1], material[2], material[3]]) # <<<<<<<<<<<<<<
* glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [1, 1, 1, 1])
* glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess)
*/
if (unlikely(((PyObject *)__pyx_v_material) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_material), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_2 == (GLfloat)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(((PyObject *)__pyx_v_material) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_material), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_3 == (GLfloat)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(((PyObject *)__pyx_v_material) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_material), 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_4 == (GLfloat)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (unlikely(((PyObject *)__pyx_v_material) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_material), 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (GLfloat)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_6[0] = __pyx_t_2;
__pyx_t_6[1] = __pyx_t_3;
__pyx_t_6[2] = __pyx_t_4;
__pyx_t_6[3] = __pyx_t_5;
glMaterialfv(__pyx_e_9punyverse_7_glgeom_GL_FRONT_AND_BACK, __pyx_e_9punyverse_7_glgeom_GL_AMBIENT_AND_DIFFUSE, __pyx_t_6);
/* "punyverse\_glgeom.pyx":21
* glPushAttrib(GL_CURRENT_BIT)
* glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, [material[0], material[1], material[2], material[3]])
* glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [1, 1, 1, 1]) # <<<<<<<<<<<<<<
* glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess)
*
*/
__pyx_t_7[0] = 1.0;
__pyx_t_7[1] = 1.0;
__pyx_t_7[2] = 1.0;
__pyx_t_7[3] = 1.0;
glMaterialfv(__pyx_e_9punyverse_7_glgeom_GL_FRONT_AND_BACK, __pyx_e_9punyverse_7_glgeom_GL_SPECULAR, __pyx_t_7);
/* "punyverse\_glgeom.pyx":22
* glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, [material[0], material[1], material[2], material[3]])
* glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, [1, 1, 1, 1])
* glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess) # <<<<<<<<<<<<<<
*
* assert n_major > 0 and n_minor > 0
*/
glMaterialf(__pyx_e_9punyverse_7_glgeom_GL_FRONT_AND_BACK, __pyx_e_9punyverse_7_glgeom_GL_SHININESS, __pyx_v_shininess);
/* "punyverse\_glgeom.pyx":24
* glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shininess)
*
* assert n_major > 0 and n_minor > 0 # <<<<<<<<<<<<<<
* assert minor_radius > 0 and major_radius > 0
*
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_8 = (__pyx_v_n_major > 0);
if (__pyx_t_8) {
__pyx_t_9 = (__pyx_v_n_minor > 0);
__pyx_t_10 = __pyx_t_9;
} else {
__pyx_t_10 = __pyx_t_8;
}
if (unlikely(!__pyx_t_10)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "punyverse\_glgeom.pyx":25
*
* assert n_major > 0 and n_minor > 0
* assert minor_radius > 0 and major_radius > 0 # <<<<<<<<<<<<<<
*
* cdef float major_s, minor_s
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_10 = (__pyx_v_minor_radius > 0.0);
if (__pyx_t_10) {
__pyx_t_8 = (__pyx_v_major_radius > 0.0);
__pyx_t_9 = __pyx_t_8;
} else {
__pyx_t_9 = __pyx_t_10;
}
if (unlikely(!__pyx_t_9)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "punyverse\_glgeom.pyx":28
*
* cdef float major_s, minor_s
* major_s = TWOPI / n_major # <<<<<<<<<<<<<<
* minor_s = TWOPI / n_minor
*
*/
__pyx_v_major_s = (__pyx_v_9punyverse_7_glgeom_TWOPI / __pyx_v_n_major);
/* "punyverse\_glgeom.pyx":29
* cdef float major_s, minor_s
* major_s = TWOPI / n_major
* minor_s = TWOPI / n_minor # <<<<<<<<<<<<<<
*
* cdef float a0, a1, x0, y0, x1, y1, b, c, r, z, m, x, y, z2
*/
__pyx_v_minor_s = (__pyx_v_9punyverse_7_glgeom_TWOPI / __pyx_v_n_minor);
/* "punyverse\_glgeom.pyx":34
* cdef int i, j
*
* for i in xrange(n_major): # <<<<<<<<<<<<<<
* a0 = i * major_s
* a1 = a0 + major_s
*/
__pyx_t_11 = __pyx_v_n_major;
for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
__pyx_v_i = __pyx_t_12;
/* "punyverse\_glgeom.pyx":35
*
* for i in xrange(n_major):
* a0 = i * major_s # <<<<<<<<<<<<<<
* a1 = a0 + major_s
* x0 = cos(a0)
*/
__pyx_v_a0 = (__pyx_v_i * __pyx_v_major_s);
/* "punyverse\_glgeom.pyx":36
* for i in xrange(n_major):
* a0 = i * major_s
* a1 = a0 + major_s # <<<<<<<<<<<<<<
* x0 = cos(a0)
* y0 = sin(a0)
*/
__pyx_v_a1 = (__pyx_v_a0 + __pyx_v_major_s);
/* "punyverse\_glgeom.pyx":37
* a0 = i * major_s
* a1 = a0 + major_s
* x0 = cos(a0) # <<<<<<<<<<<<<<
* y0 = sin(a0)
* x1 = cos(a1)
*/
__pyx_v_x0 = cos(__pyx_v_a0);
/* "punyverse\_glgeom.pyx":38
* a1 = a0 + major_s
* x0 = cos(a0)
* y0 = sin(a0) # <<<<<<<<<<<<<<
* x1 = cos(a1)
* y1 = sin(a1)
*/
__pyx_v_y0 = sin(__pyx_v_a0);
/* "punyverse\_glgeom.pyx":39
* x0 = cos(a0)
* y0 = sin(a0)
* x1 = cos(a1) # <<<<<<<<<<<<<<
* y1 = sin(a1)
*
*/
__pyx_v_x1 = cos(__pyx_v_a1);
/* "punyverse\_glgeom.pyx":40
* y0 = sin(a0)
* x1 = cos(a1)
* y1 = sin(a1) # <<<<<<<<<<<<<<
*
* glBegin(GL_TRIANGLE_STRIP)
*/
__pyx_v_y1 = sin(__pyx_v_a1);
/* "punyverse\_glgeom.pyx":42
* y1 = sin(a1)
*
* glBegin(GL_TRIANGLE_STRIP) # <<<<<<<<<<<<<<
*
* for j in xrange(n_minor + 1):
*/
glBegin(__pyx_e_9punyverse_7_glgeom_GL_TRIANGLE_STRIP);
/* "punyverse\_glgeom.pyx":44
* glBegin(GL_TRIANGLE_STRIP)
*
* for j in xrange(n_minor + 1): # <<<<<<<<<<<<<<
* b = j * minor_s
* c = cos(b)
*/
__pyx_t_13 = (__pyx_v_n_minor + 1);
for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
__pyx_v_j = __pyx_t_14;
/* "punyverse\_glgeom.pyx":45
*
* for j in xrange(n_minor + 1):
* b = j * minor_s # <<<<<<<<<<<<<<
* c = cos(b)
* r = minor_radius * c + major_radius
*/
__pyx_v_b = (__pyx_v_j * __pyx_v_minor_s);
/* "punyverse\_glgeom.pyx":46
* for j in xrange(n_minor + 1):
* b = j * minor_s
* c = cos(b) # <<<<<<<<<<<<<<
* r = minor_radius * c + major_radius
* z = minor_radius * sin(b)
*/
__pyx_v_c = cos(__pyx_v_b);
/* "punyverse\_glgeom.pyx":47
* b = j * minor_s
* c = cos(b)
* r = minor_radius * c + major_radius # <<<<<<<<<<<<<<
* z = minor_radius * sin(b)
*
*/
__pyx_v_r = ((__pyx_v_minor_radius * __pyx_v_c) + __pyx_v_major_radius);
/* "punyverse\_glgeom.pyx":48
* c = cos(b)
* r = minor_radius * c + major_radius
* z = minor_radius * sin(b) # <<<<<<<<<<<<<<
*
* x = x0 * c
*/
__pyx_v_z = (__pyx_v_minor_radius * sin(__pyx_v_b));
/* "punyverse\_glgeom.pyx":50
* z = minor_radius * sin(b)
*
* x = x0 * c # <<<<<<<<<<<<<<
* y = y0 * c
* z2 = z / minor_radius
*/
__pyx_v_x = (__pyx_v_x0 * __pyx_v_c);
/* "punyverse\_glgeom.pyx":51
*
* x = x0 * c
* y = y0 * c # <<<<<<<<<<<<<<
* z2 = z / minor_radius
* m = 1.0 / sqrt(x * x + y * y + z2 * z2)
*/
__pyx_v_y = (__pyx_v_y0 * __pyx_v_c);
/* "punyverse\_glgeom.pyx":52
* x = x0 * c
* y = y0 * c
* z2 = z / minor_radius # <<<<<<<<<<<<<<
* m = 1.0 / sqrt(x * x + y * y + z2 * z2)
* glNormal3f(x * m, y * z, z2 * m)
*/
__pyx_v_z2 = (__pyx_v_z / __pyx_v_minor_radius);
/* "punyverse\_glgeom.pyx":53
* y = y0 * c
* z2 = z / minor_radius
* m = 1.0 / sqrt(x * x + y * y + z2 * z2) # <<<<<<<<<<<<<<
* glNormal3f(x * m, y * z, z2 * m)
* glVertex3f(x0 * r, y0 * r, z)
*/
__pyx_v_m = (1.0 / sqrt((((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)) + (__pyx_v_z2 * __pyx_v_z2))));
/* "punyverse\_glgeom.pyx":54
* z2 = z / minor_radius
* m = 1.0 / sqrt(x * x + y * y + z2 * z2)
* glNormal3f(x * m, y * z, z2 * m) # <<<<<<<<<<<<<<
* glVertex3f(x0 * r, y0 * r, z)
*
*/
glNormal3f((__pyx_v_x * __pyx_v_m), (__pyx_v_y * __pyx_v_z), (__pyx_v_z2 * __pyx_v_m));
/* "punyverse\_glgeom.pyx":55
* m = 1.0 / sqrt(x * x + y * y + z2 * z2)
* glNormal3f(x * m, y * z, z2 * m)
* glVertex3f(x0 * r, y0 * r, z) # <<<<<<<<<<<<<<
*
* x = x1 * c
*/
glVertex3f((__pyx_v_x0 * __pyx_v_r), (__pyx_v_y0 * __pyx_v_r), __pyx_v_z);
/* "punyverse\_glgeom.pyx":57
* glVertex3f(x0 * r, y0 * r, z)
*
* x = x1 * c # <<<<<<<<<<<<<<
* y = y1 * c
* m = 1.0 / sqrt(x * x + y * y + z2 * z2)
*/
__pyx_v_x = (__pyx_v_x1 * __pyx_v_c);
/* "punyverse\_glgeom.pyx":58
*
* x = x1 * c
* y = y1 * c # <<<<<<<<<<<<<<
* m = 1.0 / sqrt(x * x + y * y + z2 * z2)
* glNormal3f(x * m, y * z, z2 * m)
*/
__pyx_v_y = (__pyx_v_y1 * __pyx_v_c);
/* "punyverse\_glgeom.pyx":59
* x = x1 * c
* y = y1 * c
* m = 1.0 / sqrt(x * x + y * y + z2 * z2) # <<<<<<<<<<<<<<
* glNormal3f(x * m, y * z, z2 * m)
* glVertex3f(x1 * r, y1 * r, z)
*/
__pyx_v_m = (1.0 / sqrt((((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)) + (__pyx_v_z2 * __pyx_v_z2))));
/* "punyverse\_glgeom.pyx":60
* y = y1 * c
* m = 1.0 / sqrt(x * x + y * y + z2 * z2)
* glNormal3f(x * m, y * z, z2 * m) # <<<<<<<<<<<<<<
* glVertex3f(x1 * r, y1 * r, z)
*
*/
glNormal3f((__pyx_v_x * __pyx_v_m), (__pyx_v_y * __pyx_v_z), (__pyx_v_z2 * __pyx_v_m));
/* "punyverse\_glgeom.pyx":61
* m = 1.0 / sqrt(x * x + y * y + z2 * z2)
* glNormal3f(x * m, y * z, z2 * m)
* glVertex3f(x1 * r, y1 * r, z) # <<<<<<<<<<<<<<
*
* glEnd()
*/
glVertex3f((__pyx_v_x1 * __pyx_v_r), (__pyx_v_y1 * __pyx_v_r), __pyx_v_z);
}
/* "punyverse\_glgeom.pyx":63
* glVertex3f(x1 * r, y1 * r, z)
*
* glEnd() # <<<<<<<<<<<<<<
* glPopAttrib()
*
*/
glEnd();
}
/* "punyverse\_glgeom.pyx":64
*
* glEnd()
* glPopAttrib() # <<<<<<<<<<<<<<
*
* cpdef bytes bgr_to_rgb(bytes buffer, int width, int height, bint alpha=0, bint bottom_up=1):
*/
glPopAttrib();
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("punyverse._glgeom.torus", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_9punyverse_7_glgeom_1torus(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_9punyverse_7_glgeom_torus[] = "\n Torus function from the OpenGL red book.\n ";
static PyObject *__pyx_pw_9punyverse_7_glgeom_1torus(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
float __pyx_v_major_radius;
float __pyx_v_minor_radius;
int __pyx_v_n_major;
int __pyx_v_n_minor;
PyObject *__pyx_v_material = 0;
int __pyx_v_shininess;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("torus (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__major_radius,&__pyx_n_s__minor_radius,&__pyx_n_s__n_major,&__pyx_n_s__n_minor,&__pyx_n_s__material,&__pyx_n_s__shininess,0};
PyObject* values[6] = {0,0,0,0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__major_radius)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minor_radius)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("torus", 0, 5, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_major)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("torus", 0, 5, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_minor)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("torus", 0, 5, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__material)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("torus", 0, 5, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 5:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shininess);
if (value) { values[5] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "torus") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_major_radius = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_major_radius == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_minor_radius = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_minor_radius == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_n_major = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_n_major == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_n_minor = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_n_minor == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_material = ((PyObject*)values[4]);
if (values[5]) {
__pyx_v_shininess = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_shininess == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
__pyx_v_shininess = ((int)125);
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("torus", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("punyverse._glgeom.torus", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material), (&PyTuple_Type), 1, "material", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_9punyverse_7_glgeom_torus(__pyx_self, __pyx_v_major_radius, __pyx_v_minor_radius, __pyx_v_n_major, __pyx_v_n_minor, __pyx_v_material, __pyx_v_shininess);
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "punyverse\_glgeom.pyx":15
*
* @cython.cdivision(True)
* cpdef torus(float major_radius, float minor_radius, int n_major, int n_minor, tuple material, int shininess=125): # <<<<<<<<<<<<<<
* '''
* Torus function from the OpenGL red book.
*/
static PyObject *__pyx_pf_9punyverse_7_glgeom_torus(CYTHON_UNUSED PyObject *__pyx_self, float __pyx_v_major_radius, float __pyx_v_minor_radius, int __pyx_v_n_major, int __pyx_v_n_minor, PyObject *__pyx_v_material, int __pyx_v_shininess) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
struct __pyx_opt_args_9punyverse_7_glgeom_torus __pyx_t_2;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("torus", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 1;
__pyx_t_2.shininess = __pyx_v_shininess;
__pyx_t_1 = __pyx_f_9punyverse_7_glgeom_torus(__pyx_v_major_radius, __pyx_v_minor_radius, __pyx_v_n_major, __pyx_v_n_minor, __pyx_v_material, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("punyverse._glgeom.torus", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "punyverse\_glgeom.pyx":66
* glPopAttrib()
*
* cpdef bytes bgr_to_rgb(bytes buffer, int width, int height, bint alpha=0, bint bottom_up=1): # <<<<<<<<<<<<<<
* cdef int length = len(buffer)
* cdef int depth = length / (width * height)
*/
static PyObject *__pyx_pw_9punyverse_7_glgeom_3bgr_to_rgb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_9punyverse_7_glgeom_bgr_to_rgb(PyObject *__pyx_v_buffer, int __pyx_v_width, int __pyx_v_height, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9punyverse_7_glgeom_bgr_to_rgb *__pyx_optional_args) {
int __pyx_v_alpha = ((int)0);
int __pyx_v_bottom_up = ((int)1);
int __pyx_v_length;
int __pyx_v_depth;
int __pyx_v_depth2;
char *__pyx_v_result;
char const *__pyx_v_source;
int __pyx_v_x;
int __pyx_v_y;
int __pyx_v_ioffset;
int __pyx_v_ooffset;
int __pyx_v_i;
int __pyx_v_row;
PyObject *__pyx_v_final = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
Py_ssize_t __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
int __pyx_t_5;
long __pyx_t_6;
int __pyx_t_7;
int __pyx_t_8;
PyObject *__pyx_t_9 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("bgr_to_rgb", 0);
if (__pyx_optional_args) {
if (__pyx_optional_args->__pyx_n > 0) {
__pyx_v_alpha = __pyx_optional_args->alpha;
if (__pyx_optional_args->__pyx_n > 1) {
__pyx_v_bottom_up = __pyx_optional_args->bottom_up;
}
}
}
/* "punyverse\_glgeom.pyx":67
*
* cpdef bytes bgr_to_rgb(bytes buffer, int width, int height, bint alpha=0, bint bottom_up=1):
* cdef int length = len(buffer) # <<<<<<<<<<<<<<
* cdef int depth = length / (width * height)
* cdef int depth2 = depth - alpha
*/
if (unlikely(((PyObject *)__pyx_v_buffer) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = PyBytes_GET_SIZE(((PyObject *)__pyx_v_buffer)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_length = __pyx_t_1;
/* "punyverse\_glgeom.pyx":68
* cpdef bytes bgr_to_rgb(bytes buffer, int width, int height, bint alpha=0, bint bottom_up=1):
* cdef int length = len(buffer)
* cdef int depth = length / (width * height) # <<<<<<<<<<<<<<
* cdef int depth2 = depth - alpha
* cdef char *result = <char*>malloc(length)
*/
__pyx_t_2 = (__pyx_v_width * __pyx_v_height);
if (unlikely(__pyx_t_2 == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
else if (sizeof(int) == sizeof(long) && unlikely(__pyx_t_2 == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_length))) {
PyErr_Format(PyExc_OverflowError, "value too large to perform division");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_depth = __Pyx_div_int(__pyx_v_length, __pyx_t_2);
/* "punyverse\_glgeom.pyx":69
* cdef int length = len(buffer)
* cdef int depth = length / (width * height)
* cdef int depth2 = depth - alpha # <<<<<<<<<<<<<<
* cdef char *result = <char*>malloc(length)
* cdef const char *source = PyBytes_AsString(buffer)
*/
__pyx_v_depth2 = (__pyx_v_depth - __pyx_v_alpha);
/* "punyverse\_glgeom.pyx":70
* cdef int depth = length / (width * height)
* cdef int depth2 = depth - alpha
* cdef char *result = <char*>malloc(length) # <<<<<<<<<<<<<<
* cdef const char *source = PyBytes_AsString(buffer)
* cdef int x, y, ioffset, ooffset, i, row = width * depth
*/
__pyx_v_result = ((char *)malloc(__pyx_v_length));
/* "punyverse\_glgeom.pyx":71
* cdef int depth2 = depth - alpha
* cdef char *result = <char*>malloc(length)
* cdef const char *source = PyBytes_AsString(buffer) # <<<<<<<<<<<<<<
* cdef int x, y, ioffset, ooffset, i, row = width * depth
* for y in xrange(height):
*/
__pyx_v_source = PyBytes_AsString(__pyx_v_buffer);
/* "punyverse\_glgeom.pyx":72
* cdef char *result = <char*>malloc(length)
* cdef const char *source = PyBytes_AsString(buffer)
* cdef int x, y, ioffset, ooffset, i, row = width * depth # <<<<<<<<<<<<<<
* for y in xrange(height):
* for x in xrange(width):
*/
__pyx_v_row = (__pyx_v_width * __pyx_v_depth);
/* "punyverse\_glgeom.pyx":73
* cdef const char *source = PyBytes_AsString(buffer)
* cdef int x, y, ioffset, ooffset, i, row = width * depth
* for y in xrange(height): # <<<<<<<<<<<<<<
* for x in xrange(width):
* ioffset = y * width * depth + x * depth
*/
__pyx_t_2 = __pyx_v_height;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_y = __pyx_t_3;
/* "punyverse\_glgeom.pyx":74
* cdef int x, y, ioffset, ooffset, i, row = width * depth
* for y in xrange(height):
* for x in xrange(width): # <<<<<<<<<<<<<<
* ioffset = y * width * depth + x * depth
* ooffset = (height - y - 1 if bottom_up else y) * row + x * depth
*/
__pyx_t_4 = __pyx_v_width;
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
__pyx_v_x = __pyx_t_5;
/* "punyverse\_glgeom.pyx":75
* for y in xrange(height):
* for x in xrange(width):
* ioffset = y * width * depth + x * depth # <<<<<<<<<<<<<<
* ooffset = (height - y - 1 if bottom_up else y) * row + x * depth
* for i in xrange(depth2):
*/
__pyx_v_ioffset = (((__pyx_v_y * __pyx_v_width) * __pyx_v_depth) + (__pyx_v_x * __pyx_v_depth));
/* "punyverse\_glgeom.pyx":76
* for x in xrange(width):
* ioffset = y * width * depth + x * depth
* ooffset = (height - y - 1 if bottom_up else y) * row + x * depth # <<<<<<<<<<<<<<
* for i in xrange(depth2):
* result[ooffset+i] = source[ioffset+depth2-i-1]
*/
if (__pyx_v_bottom_up) {
__pyx_t_6 = ((__pyx_v_height - __pyx_v_y) - 1);
} else {
__pyx_t_6 = __pyx_v_y;
}
__pyx_v_ooffset = ((__pyx_t_6 * __pyx_v_row) + (__pyx_v_x * __pyx_v_depth));
/* "punyverse\_glgeom.pyx":77
* ioffset = y * width * depth + x * depth
* ooffset = (height - y - 1 if bottom_up else y) * row + x * depth
* for i in xrange(depth2): # <<<<<<<<<<<<<<
* result[ooffset+i] = source[ioffset+depth2-i-1]
* if alpha:
*/
__pyx_t_7 = __pyx_v_depth2;
for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
__pyx_v_i = __pyx_t_8;
/* "punyverse\_glgeom.pyx":78
* ooffset = (height - y - 1 if bottom_up else y) * row + x * depth
* for i in xrange(depth2):
* result[ooffset+i] = source[ioffset+depth2-i-1] # <<<<<<<<<<<<<<
* if alpha:
* result[ooffset+depth2] = source[ioffset+depth2]
*/
(__pyx_v_result[(__pyx_v_ooffset + __pyx_v_i)]) = (__pyx_v_source[(((__pyx_v_ioffset + __pyx_v_depth2) - __pyx_v_i) - 1)]);
}
/* "punyverse\_glgeom.pyx":79
* for i in xrange(depth2):
* result[ooffset+i] = source[ioffset+depth2-i-1]
* if alpha: # <<<<<<<<<<<<<<
* result[ooffset+depth2] = source[ioffset+depth2]
* cdef object final = PyBytes_FromStringAndSize(result, length)
*/
if (__pyx_v_alpha) {
/* "punyverse\_glgeom.pyx":80
* result[ooffset+i] = source[ioffset+depth2-i-1]
* if alpha:
* result[ooffset+depth2] = source[ioffset+depth2] # <<<<<<<<<<<<<<
* cdef object final = PyBytes_FromStringAndSize(result, length)
* free(result)
*/
(__pyx_v_result[(__pyx_v_ooffset + __pyx_v_depth2)]) = (__pyx_v_source[(__pyx_v_ioffset + __pyx_v_depth2)]);
goto __pyx_L9;
}
__pyx_L9:;
}
}
/* "punyverse\_glgeom.pyx":81
* if alpha:
* result[ooffset+depth2] = source[ioffset+depth2]
* cdef object final = PyBytes_FromStringAndSize(result, length) # <<<<<<<<<<<<<<
* free(result)
* return final
*/
__pyx_t_9 = PyBytes_FromStringAndSize(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_v_final = __pyx_t_9;
__pyx_t_9 = 0;
/* "punyverse\_glgeom.pyx":82
* result[ooffset+depth2] = source[ioffset+depth2]
* cdef object final = PyBytes_FromStringAndSize(result, length)
* free(result) # <<<<<<<<<<<<<<
* return final
*/
free(__pyx_v_result);
/* "punyverse\_glgeom.pyx":83
* cdef object final = PyBytes_FromStringAndSize(result, length)
* free(result)
* return final # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
if (!(likely(PyBytes_CheckExact(__pyx_v_final))||((__pyx_v_final) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_final)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_INCREF(__pyx_v_final);
__pyx_r = ((PyObject*)__pyx_v_final);
goto __pyx_L0;
__pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("punyverse._glgeom.bgr_to_rgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_final);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_9punyverse_7_glgeom_3bgr_to_rgb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_9punyverse_7_glgeom_3bgr_to_rgb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_buffer = 0;
int __pyx_v_width;
int __pyx_v_height;
int __pyx_v_alpha;
int __pyx_v_bottom_up;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("bgr_to_rgb (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__buffer,&__pyx_n_s__width,&__pyx_n_s__height,&__pyx_n_s__alpha,&__pyx_n_s__bottom_up,0};
PyObject* values[5] = {0,0,0,0,0};
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__buffer)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("bgr_to_rgb", 0, 3, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__height)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("bgr_to_rgb", 0, 3, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha);
if (value) { values[3] = value; kw_args--; }
}
case 4:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bottom_up);
if (value) { values[4] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bgr_to_rgb") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_buffer = ((PyObject*)values[0]);
__pyx_v_width = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_height = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
if (values[3]) {
__pyx_v_alpha = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_alpha == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
__pyx_v_alpha = ((int)0);
}
if (values[4]) {
__pyx_v_bottom_up = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_bottom_up == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
__pyx_v_bottom_up = ((int)1);
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("bgr_to_rgb", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("punyverse._glgeom.bgr_to_rgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), (&PyBytes_Type), 1, "buffer", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = __pyx_pf_9punyverse_7_glgeom_2bgr_to_rgb(__pyx_self, __pyx_v_buffer, __pyx_v_width, __pyx_v_height, __pyx_v_alpha, __pyx_v_bottom_up);
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "punyverse\_glgeom.pyx":66
* glPopAttrib()
*
* cpdef bytes bgr_to_rgb(bytes buffer, int width, int height, bint alpha=0, bint bottom_up=1): # <<<<<<<<<<<<<<
* cdef int length = len(buffer)
* cdef int depth = length / (width * height)
*/
static PyObject *__pyx_pf_9punyverse_7_glgeom_2bgr_to_rgb(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, int __pyx_v_width, int __pyx_v_height, int __pyx_v_alpha, int __pyx_v_bottom_up) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
struct __pyx_opt_args_9punyverse_7_glgeom_bgr_to_rgb __pyx_t_2;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("bgr_to_rgb", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_2.__pyx_n = 2;
__pyx_t_2.alpha = __pyx_v_alpha;
__pyx_t_2.bottom_up = __pyx_v_bottom_up;
__pyx_t_1 = ((PyObject *)__pyx_f_9punyverse_7_glgeom_bgr_to_rgb(__pyx_v_buffer, __pyx_v_width, __pyx_v_height, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("punyverse._glgeom.bgr_to_rgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyMethodDef __pyx_methods[] = {
{__Pyx_NAMESTR("torus"), (PyCFunction)__pyx_pw_9punyverse_7_glgeom_1torus, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9punyverse_7_glgeom_torus)},
{__Pyx_NAMESTR("bgr_to_rgb"), (PyCFunction)__pyx_pw_9punyverse_7_glgeom_3bgr_to_rgb, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
{0, 0, 0, 0}
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
#if PY_VERSION_HEX < 0x03020000
{ PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
#else
PyModuleDef_HEAD_INIT,
#endif
__Pyx_NAMESTR("_glgeom"),
0, /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL /* m_free */
};
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
{&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
{&__pyx_n_s__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1},
{&__pyx_n_s__bottom_up, __pyx_k__bottom_up, sizeof(__pyx_k__bottom_up), 0, 0, 1, 1},
{&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1},
{&__pyx_n_s__height, __pyx_k__height, sizeof(__pyx_k__height), 0, 0, 1, 1},
{&__pyx_n_s__major_radius, __pyx_k__major_radius, sizeof(__pyx_k__major_radius), 0, 0, 1, 1},
{&__pyx_n_s__material, __pyx_k__material, sizeof(__pyx_k__material), 0, 0, 1, 1},
{&__pyx_n_s__minor_radius, __pyx_k__minor_radius, sizeof(__pyx_k__minor_radius), 0, 0, 1, 1},
{&__pyx_n_s__n_major, __pyx_k__n_major, sizeof(__pyx_k__n_major), 0, 0, 1, 1},
{&__pyx_n_s__n_minor, __pyx_k__n_minor, sizeof(__pyx_k__n_minor), 0, 0, 1, 1},
{&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
{&__pyx_n_s__shininess, __pyx_k__shininess, sizeof(__pyx_k__shininess), 0, 0, 1, 1},
{&__pyx_n_s__width, __pyx_k__width, sizeof(__pyx_k__width), 0, 0, 1, 1},
{&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
#if PY_MAJOR_VERSION >= 3
__pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
return 0;
__pyx_L1_error:;
return -1;
}
static int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
__Pyx_RefNannyFinishContext();
return 0;
}
static int __Pyx_InitGlobals(void) {
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
return 0;
__pyx_L1_error:;
return -1;
}
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_glgeom(void); /*proto*/
PyMODINIT_FUNC init_glgeom(void)
#else
PyMODINIT_FUNC PyInit__glgeom(void); /*proto*/
PyMODINIT_FUNC PyInit__glgeom(void)
#endif
{
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannyDeclarations
#if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
PyErr_Clear();
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
if (!__Pyx_RefNanny)
Py_FatalError("failed to import 'refnanny' module");
}
#endif
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__glgeom(void)", 0);
if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#ifdef __Pyx_CyFunction_USED
if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_FusedFunction_USED
if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_Generator_USED
if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
/*--- Library function declarations ---*/
/*--- Threads initialization code ---*/
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
#ifdef WITH_THREAD /* Python build with threading support? */
PyEval_InitThreads();
#endif
#endif
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
__pyx_m = Py_InitModule4(__Pyx_NAMESTR("_glgeom"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if PY_MAJOR_VERSION >= 3
{
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!PyDict_GetItemString(modules, "punyverse._glgeom")) {
if (unlikely(PyDict_SetItemString(modules, "punyverse._glgeom", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
}
#endif
__pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_PYPY
Py_INCREF(__pyx_b);
#endif
if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
/*--- Initialize various global constants etc. ---*/
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_module_is_main_punyverse___glgeom) {
if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
/*--- Builtin init code ---*/
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Constants init code ---*/
if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Global init code ---*/
/*--- Variable export code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
/*--- Type import code ---*/
/*--- Variable import code ---*/
/*--- Function import code ---*/
/*--- Execution code ---*/
/* "D:\dev\punyverse\punyverse\_cyopengl.pxi":1209
* GLU_TESS_WINDING_ABS_GEQ_TWO = 100134
*
* cdef float GLU_TESS_MAX_COORD = 1.0e150 # <<<<<<<<<<<<<<
*/
__pyx_v_9punyverse_7_glgeom_GLU_TESS_MAX_COORD = 1.0e150;
/* "punyverse\_glgeom.pyx":7
*
* include "_cyopengl.pxi"
* cdef float PI = 3.1415926535897932324626 # <<<<<<<<<<<<<<
* cdef float TWOPI = PI * 2
*
*/
__pyx_v_9punyverse_7_glgeom_PI = 3.1415926535897932324626;
/* "punyverse\_glgeom.pyx":8
* include "_cyopengl.pxi"
* cdef float PI = 3.1415926535897932324626
* cdef float TWOPI = PI * 2 # <<<<<<<<<<<<<<
*
* cdef extern from "Python.h":
*/
__pyx_v_9punyverse_7_glgeom_TWOPI = (__pyx_v_9punyverse_7_glgeom_PI * 2.0);
/* "punyverse\_glgeom.pyx":1
* from libc.math cimport sin, cos, sqrt # <<<<<<<<<<<<<<
* from libc.stdlib cimport malloc, free
* from libc.string cimport memcpy
*/
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
if (__pyx_m) {
__Pyx_AddTraceback("init punyverse._glgeom", __pyx_clineno, __pyx_lineno, __pyx_filename);
Py_DECREF(__pyx_m); __pyx_m = 0;
} else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ImportError, "init punyverse._glgeom");
}
__pyx_L0:;
__Pyx_RefNannyFinishContext();
#if PY_MAJOR_VERSION < 3
return;
#else
return __pyx_m;
#endif
}
/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
PyObject *m = NULL, *p = NULL;
void *r = NULL;
m = PyImport_ImportModule((char *)modname);
if (!m) goto end;
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
if (!p) goto end;
r = PyLong_AsVoidPtr(p);
end:
Py_XDECREF(p);
Py_XDECREF(m);
return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
PyObject *result;
result = PyObject_GetAttr(dict, name);
if (!result) {
if (dict != __pyx_b) {
PyErr_Clear();
result = PyObject_GetAttr(__pyx_b, name);
}
if (!result) {
PyErr_SetObject(PyExc_NameError, name);
}
}
return result;
}
static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
Py_ssize_t num_min,
Py_ssize_t num_max,
Py_ssize_t num_found)
{
Py_ssize_t num_expected;
const char *more_or_less;
if (num_found < num_min) {
num_expected = num_min;
more_or_less = "at least";
} else {
num_expected = num_max;
more_or_less = "at most";
}
if (exact) {
more_or_less = "exactly";
}
PyErr_Format(PyExc_TypeError,
"%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
func_name, more_or_less, num_expected,
(num_expected == 1) ? "" : "s", num_found);
}
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name,
PyObject* kw_name)
{
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION >= 3
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
#else
"%s() got multiple values for keyword argument '%s'", func_name,
PyString_AsString(kw_name));
#endif
}
static int __Pyx_ParseOptionalKeywords(
PyObject *kwds,
PyObject **argnames[],
PyObject *kwds2,
PyObject *values[],
Py_ssize_t num_pos_args,
const char* function_name)
{
PyObject *key = 0, *value = 0;
Py_ssize_t pos = 0;
PyObject*** name;
PyObject*** first_kw_arg = argnames + num_pos_args;
while (PyDict_Next(kwds, &pos, &key, &value)) {
name = first_kw_arg;
while (*name && (**name != key)) name++;
if (*name) {
values[name-argnames] = value;
continue;
}
name = first_kw_arg;
#if PY_MAJOR_VERSION < 3
if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
while (*name) {
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
&& _PyString_Eq(**name, key)) {
values[name-argnames] = value;
break;
}
name++;
}
if (*name) continue;
else {
PyObject*** argname = argnames;
while (argname != first_kw_arg) {
if ((**argname == key) || (
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
&& _PyString_Eq(**argname, key))) {
goto arg_passed_twice;
}
argname++;
}
}
} else
#endif
if (likely(PyUnicode_Check(key))) {
while (*name) {
int cmp = (**name == key) ? 0 :
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
#endif
PyUnicode_Compare(**name, key);
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
if (cmp == 0) {
values[name-argnames] = value;
break;
}
name++;
}
if (*name) continue;
else {
PyObject*** argname = argnames;
while (argname != first_kw_arg) {
int cmp = (**argname == key) ? 0 :
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
#endif
PyUnicode_Compare(**argname, key);
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
if (cmp == 0) goto arg_passed_twice;
argname++;
}
}
} else
goto invalid_keyword_type;
if (kwds2) {
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
} else {
goto invalid_keyword;
}
}
return 0;
arg_passed_twice:
__Pyx_RaiseDoubleKeywordsError(function_name, key);
goto bad;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
"%s() keywords must be strings", function_name);
goto bad;
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
"%s() got an unexpected keyword argument '%s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
function_name, key);
#endif
bad:
return -1;
}
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact)
{
if (!type) {
PyErr_Format(PyExc_SystemError, "Missing type object");
return 0;
}
if (none_allowed && obj == Py_None) return 1;
else if (exact) {
if (Py_TYPE(obj) == type) return 1;
}
else {
if (PyObject_TypeCheck(obj, type)) return 1;
}
PyErr_Format(PyExc_TypeError,
"Argument '%s' has incorrect type (expected %s, got %s)",
name, type->tp_name, Py_TYPE(obj)->tp_name);
return 0;
}
static CYTHON_INLINE int __Pyx_div_int(int a, int b) {
int q = a / b;
int r = a - q*b;
q -= ((r != 0) & ((r ^ b) < 0));
return q;
}
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned char" :
"value too large to convert to unsigned char");
}
return (unsigned char)-1;
}
return (unsigned char)val;
}
return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned short" :
"value too large to convert to unsigned short");
}
return (unsigned short)-1;
}
return (unsigned short)val;
}
return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned int" :
"value too large to convert to unsigned int");
}
return (unsigned int)-1;
}
return (unsigned int)val;
}
return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
const char neg_one = (char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to char" :
"value too large to convert to char");
}
return (char)-1;
}
return (char)val;
}
return (char)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
const short neg_one = (short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to short" :
"value too large to convert to short");
}
return (short)-1;
}
return (short)val;
}
return (short)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
const int neg_one = (int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to int" :
"value too large to convert to int");
}
return (int)-1;
}
return (int)val;
}
return (int)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
const signed char neg_one = (signed char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed char" :
"value too large to convert to signed char");
}
return (signed char)-1;
}
return (signed char)val;
}
return (signed char)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
const signed short neg_one = (signed short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed short" :
"value too large to convert to signed short");
}
return (signed short)-1;
}
return (signed short)val;
}
return (signed short)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
const signed int neg_one = (signed int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed int" :
"value too large to convert to signed int");
}
return (signed int)-1;
}
return (signed int)val;
}
return (signed int)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
const int neg_one = (int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to int" :
"value too large to convert to int");
}
return (int)-1;
}
return (int)val;
}
return (int)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned long");
return (unsigned long)-1;
}
return (unsigned long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned long");
return (unsigned long)-1;
}
return (unsigned long)PyLong_AsUnsignedLong(x);
} else {
return (unsigned long)PyLong_AsLong(x);
}
} else {
unsigned long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (unsigned long)-1;
val = __Pyx_PyInt_AsUnsignedLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned PY_LONG_LONG");
return (unsigned PY_LONG_LONG)-1;
}
return (unsigned PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned PY_LONG_LONG");
return (unsigned PY_LONG_LONG)-1;
}
return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
unsigned PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (unsigned PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
const long neg_one = (long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long)-1;
}
return (long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long)-1;
}
return (long)PyLong_AsUnsignedLong(x);
} else {
return (long)PyLong_AsLong(x);
}
} else {
long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (long)-1;
val = __Pyx_PyInt_AsLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to PY_LONG_LONG");
return (PY_LONG_LONG)-1;
}
return (PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to PY_LONG_LONG");
return (PY_LONG_LONG)-1;
}
return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
const signed long neg_one = (signed long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed long");
return (signed long)-1;
}
return (signed long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed long");
return (signed long)-1;
}
return (signed long)PyLong_AsUnsignedLong(x);
} else {
return (signed long)PyLong_AsLong(x);
}
} else {
signed long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (signed long)-1;
val = __Pyx_PyInt_AsSignedLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed PY_LONG_LONG");
return (signed PY_LONG_LONG)-1;
}
return (signed PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed PY_LONG_LONG");
return (signed PY_LONG_LONG)-1;
}
return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
signed PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (signed PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsSignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static int __Pyx_check_binary_version(void) {
char ctversion[4], rtversion[4];
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
char message[200];
PyOS_snprintf(message, sizeof(message),
"compiletime version %s of module '%.100s' "
"does not match runtime version %s",
ctversion, __Pyx_MODULE_NAME, rtversion);
#if PY_VERSION_HEX < 0x02050000
return PyErr_Warn(NULL, message);
#else
return PyErr_WarnEx(NULL, message, 1);
#endif
}
return 0;
}
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
int start = 0, mid = 0, end = count - 1;
if (end >= 0 && code_line > entries[end].code_line) {
return count;
}
while (start < end) {
mid = (start + end) / 2;
if (code_line < entries[mid].code_line) {
end = mid;
} else if (code_line > entries[mid].code_line) {
start = mid + 1;
} else {
return mid;
}
}
if (code_line <= entries[mid].code_line) {
return mid;
} else {
return mid + 1;
}
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
PyCodeObject* code_object;
int pos;
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
return NULL;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
return NULL;
}
code_object = __pyx_code_cache.entries[pos].code_object;
Py_INCREF(code_object);
return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
int pos, i;
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
if (unlikely(!code_line)) {
return;
}
if (unlikely(!entries)) {
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
if (likely(entries)) {
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = 64;
__pyx_code_cache.count = 1;
entries[0].code_line = code_line;
entries[0].code_object = code_object;
Py_INCREF(code_object);
}
return;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
PyCodeObject* tmp = entries[pos].code_object;
entries[pos].code_object = code_object;
Py_DECREF(tmp);
return;
}
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
int new_max = __pyx_code_cache.max_count + 64;
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
__pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
if (unlikely(!entries)) {
return;
}
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = new_max;
}
for (i=__pyx_code_cache.count; i>pos; i--) {
entries[i] = entries[i-1];
}
entries[pos].code_line = code_line;
entries[pos].code_object = code_object;
__pyx_code_cache.count++;
Py_INCREF(code_object);
}
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
#if PY_MAJOR_VERSION < 3
py_srcfile = PyString_FromString(filename);
#else
py_srcfile = PyUnicode_FromString(filename);
#endif
if (!py_srcfile) goto bad;
if (c_line) {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#else
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#endif
}
else {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromString(funcname);
#else
py_funcname = PyUnicode_FromString(funcname);
#endif
}
if (!py_funcname) goto bad;
py_code = __Pyx_PyCode_New(
0, /*int argcount,*/
0, /*int kwonlyargcount,*/
0, /*int nlocals,*/
0, /*int stacksize,*/
0, /*int flags,*/
__pyx_empty_bytes, /*PyObject *code,*/
__pyx_empty_tuple, /*PyObject *consts,*/
__pyx_empty_tuple, /*PyObject *names,*/
__pyx_empty_tuple, /*PyObject *varnames,*/
__pyx_empty_tuple, /*PyObject *freevars,*/
__pyx_empty_tuple, /*PyObject *cellvars,*/
py_srcfile, /*PyObject *filename,*/
py_funcname, /*PyObject *name,*/
py_line, /*int firstlineno,*/
__pyx_empty_bytes /*PyObject *lnotab*/
);
Py_DECREF(py_srcfile);
Py_DECREF(py_funcname);
return py_code;
bad:
Py_XDECREF(py_srcfile);
Py_XDECREF(py_funcname);
return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_globals = 0;
PyFrameObject *py_frame = 0;
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
if (!py_code) {
py_code = __Pyx_CreateCodeObjectForTraceback(
funcname, c_line, py_line, filename);
if (!py_code) goto bad;
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
}
py_globals = PyModule_GetDict(__pyx_m);
if (!py_globals) goto bad;
py_frame = PyFrame_New(
PyThreadState_GET(), /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
py_globals, /*PyObject *globals,*/
0 /*PyObject *locals*/
);
if (!py_frame) goto bad;
py_frame->f_lineno = py_line;
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
#if PY_MAJOR_VERSION < 3
if (t->is_unicode) {
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
} else if (t->intern) {
*t->p = PyString_InternFromString(t->s);
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
#else /* Python 3+ has unicode identifiers */
if (t->is_unicode | t->is_str) {
if (t->intern) {
*t->p = PyUnicode_InternFromString(t->s);
} else if (t->encoding) {
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
} else {
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
}
} else {
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
}
#endif
if (!*t->p)
return -1;
++t;
}
return 0;
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
int is_true = x == Py_True;
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
PyNumberMethods *m;
const char *name = NULL;
PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check(x) || PyLong_Check(x))
#else
if (PyLong_Check(x))
#endif
return Py_INCREF(x), x;
m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
if (m && m->nb_int) {
name = "int";
res = PyNumber_Int(x);
}
else if (m && m->nb_long) {
name = "long";
res = PyNumber_Long(x);
}
#else
if (m && m->nb_int) {
name = "int";
res = PyNumber_Long(x);
}
#endif
if (res) {
#if PY_VERSION_HEX < 0x03000000
if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
if (!PyLong_Check(res)) {
#endif
PyErr_Format(PyExc_TypeError,
"__%s__ returned non-%s (type %.200s)",
name, name, Py_TYPE(res)->tp_name);
Py_DECREF(res);
return NULL;
}
}
else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError,
"an integer is required");
}
return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
PyObject* x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
if (ival <= LONG_MAX)
return PyInt_FromLong((long)ival);
else {
unsigned char *bytes = (unsigned char *) &ival;
int one = 1; int little = (int)*(unsigned char*)&one;
return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
}
#else
return PyInt_FromSize_t(ival);
#endif
}
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
return (size_t)-1;
} else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to size_t");
return (size_t)-1;
}
return (size_t)val;
}
#endif /* Py_PYTHON_H */