/* Generated by Cython 0.17.4 on Sun Jun 16 22:00:40 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_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(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___glarea
#define __PYX_HAVE_API___glarea
#include "math.h"
#include "stddef.h"
#include "stdint.h"
#include "GL/gl.h"
#include "GL/glext.h"
#include "glm/glm.hpp"
#include "glm/gtx/transform.hpp"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#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

/* unused attribute */
#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*/


/* Type Conversion Predeclarations */

#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[] = {
  "_glarea.pyx",
};

/* "gl.pxd":5147
 * # from /usr/include/GL/gl.h:
 * 
 * ctypedef unsigned int	GLenum             # <<<<<<<<<<<<<<
 * ctypedef unsigned char	GLboolean
 * ctypedef unsigned int	GLbitfield
 */
typedef unsigned int __pyx_t_2gl_GLenum;

/* "gl.pxd":5148
 * 
 * ctypedef unsigned int	GLenum
 * ctypedef unsigned char	GLboolean             # <<<<<<<<<<<<<<
 * ctypedef unsigned int	GLbitfield
 * ctypedef void		GLvoid
 */
typedef unsigned char __pyx_t_2gl_GLboolean;

/* "gl.pxd":5149
 * ctypedef unsigned int	GLenum
 * ctypedef unsigned char	GLboolean
 * ctypedef unsigned int	GLbitfield             # <<<<<<<<<<<<<<
 * ctypedef void		GLvoid
 * ctypedef signed char	GLbyte
 */
typedef unsigned int __pyx_t_2gl_GLbitfield;

/* "gl.pxd":5151
 * ctypedef unsigned int	GLbitfield
 * ctypedef void		GLvoid
 * ctypedef signed char	GLbyte             # <<<<<<<<<<<<<<
 * ctypedef short		GLshort
 * ctypedef int		GLint
 */
typedef signed char __pyx_t_2gl_GLbyte;

/* "gl.pxd":5152
 * ctypedef void		GLvoid
 * ctypedef signed char	GLbyte
 * ctypedef short		GLshort             # <<<<<<<<<<<<<<
 * ctypedef int		GLint
 * ctypedef unsigned char	GLubyte
 */
typedef short __pyx_t_2gl_GLshort;

/* "gl.pxd":5153
 * ctypedef signed char	GLbyte
 * ctypedef short		GLshort
 * ctypedef int		GLint             # <<<<<<<<<<<<<<
 * ctypedef unsigned char	GLubyte
 * ctypedef unsigned short	GLushort
 */
typedef int __pyx_t_2gl_GLint;

/* "gl.pxd":5154
 * ctypedef short		GLshort
 * ctypedef int		GLint
 * ctypedef unsigned char	GLubyte             # <<<<<<<<<<<<<<
 * ctypedef unsigned short	GLushort
 * ctypedef unsigned int	GLuint
 */
typedef unsigned char __pyx_t_2gl_GLubyte;

/* "gl.pxd":5155
 * ctypedef int		GLint
 * ctypedef unsigned char	GLubyte
 * ctypedef unsigned short	GLushort             # <<<<<<<<<<<<<<
 * ctypedef unsigned int	GLuint
 * ctypedef int		GLsizei
 */
typedef unsigned short __pyx_t_2gl_GLushort;

/* "gl.pxd":5156
 * ctypedef unsigned char	GLubyte
 * ctypedef unsigned short	GLushort
 * ctypedef unsigned int	GLuint             # <<<<<<<<<<<<<<
 * ctypedef int		GLsizei
 * ctypedef float		GLfloat
 */
typedef unsigned int __pyx_t_2gl_GLuint;

/* "gl.pxd":5157
 * ctypedef unsigned short	GLushort
 * ctypedef unsigned int	GLuint
 * ctypedef int		GLsizei             # <<<<<<<<<<<<<<
 * ctypedef float		GLfloat
 * ctypedef float		GLclampf
 */
typedef int __pyx_t_2gl_GLsizei;

/* "gl.pxd":5158
 * ctypedef unsigned int	GLuint
 * ctypedef int		GLsizei
 * ctypedef float		GLfloat             # <<<<<<<<<<<<<<
 * ctypedef float		GLclampf
 * ctypedef double		GLdouble
 */
typedef float __pyx_t_2gl_GLfloat;

/* "gl.pxd":5159
 * ctypedef int		GLsizei
 * ctypedef float		GLfloat
 * ctypedef float		GLclampf             # <<<<<<<<<<<<<<
 * ctypedef double		GLdouble
 * ctypedef double		GLclampd
 */
typedef float __pyx_t_2gl_GLclampf;

/* "gl.pxd":5160
 * ctypedef float		GLfloat
 * ctypedef float		GLclampf
 * ctypedef double		GLdouble             # <<<<<<<<<<<<<<
 * ctypedef double		GLclampd
 * 
 */
typedef double __pyx_t_2gl_GLdouble;

/* "gl.pxd":5161
 * ctypedef float		GLclampf
 * ctypedef double		GLdouble
 * ctypedef double		GLclampd             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef double __pyx_t_2gl_GLclampd;

/* "gl.pxd":5166
 * # from /usr/include/GL/glext.h:
 * 
 * ctypedef char GLchar             # <<<<<<<<<<<<<<
 * ctypedef ptrdiff_t GLintptr
 * ctypedef ptrdiff_t GLsizeiptr
 */
typedef char __pyx_t_2gl_GLchar;

/* "gl.pxd":5167
 * 
 * ctypedef char GLchar
 * ctypedef ptrdiff_t GLintptr             # <<<<<<<<<<<<<<
 * ctypedef ptrdiff_t GLsizeiptr
 * 
 */
typedef ptrdiff_t __pyx_t_2gl_GLintptr;

/* "gl.pxd":5168
 * ctypedef char GLchar
 * ctypedef ptrdiff_t GLintptr
 * ctypedef ptrdiff_t GLsizeiptr             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef ptrdiff_t __pyx_t_2gl_GLsizeiptr;

/*--- Type declarations ---*/

/* "gl.pxd":5150
 * ctypedef unsigned char	GLboolean
 * ctypedef unsigned int	GLbitfield
 * ctypedef void		GLvoid             # <<<<<<<<<<<<<<
 * ctypedef signed char	GLbyte
 * ctypedef short		GLshort
 */
typedef void __pyx_t_2gl_GLvoid;

/* "_gldraw.pxd":4
 * 
 * from gl cimport *    #line 37
 * cdef enum: #    #line 48             # <<<<<<<<<<<<<<
 *     VERTEX_ATTRIB_LOCATION = 0    #line 54
 *     NORMAL_ATTRIB_LOCATION = 1    #line 55
 */
enum  {
  __pyx_e_7_gldraw_VERTEX_ATTRIB_LOCATION = 0,
  __pyx_e_7_gldraw_NORMAL_ATTRIB_LOCATION = 1,
  __pyx_e_7_gldraw_COLOR_ATTRIB_LOCATION = 2,
  __pyx_e_7_gldraw_TEXCOORD_ATTRIB_LOCATION = 3
};
struct __pyx_t_7_glarea_Terrain;
struct __pyx_t_7_glarea_Frustrum;
struct __pyx_t_7_glarea_Program;
struct __pyx_t_7_glarea_SelectionDebugPoints;

/* "_glarea.pyx":59
 * 
 * 
 * cdef struct Terrain: #px/             # <<<<<<<<<<<<<<
 * #px class terrain: pass     # pylint: disable=W0232, C0321, R0903
 *     float red #px+
 */
struct __pyx_t_7_glarea_Terrain {
  float red;
  float green;
  float blue;
  int width;
  int height;
};

/* "_glarea.pyx":68
 * cdef Terrain terrain #px+
 * 
 * cdef struct Frustrum: #px/             # <<<<<<<<<<<<<<
 * #px class frustrum: pass    # pylint: disable=W0232, R0903
 *     float fovy_angle  # field of view angle #px+
 */
struct __pyx_t_7_glarea_Frustrum {
  float fovy_angle;
  float fovy_radius;
  float fovy_radius_zoom;
  double bounding_sphere_radius;
  int multisample;
  glm::mat4 modelview_matrix;
  glm::mat4 projection_matrix;
  glm::mat4 picking_matrix;
};

/* "_glarea.pyx":80
 * cdef Frustrum frustrum #px+
 * 
 * cdef struct Program: #px/             # <<<<<<<<<<<<<<
 * #px class program: pass
 *     GLuint prog_render #px+
 */
struct __pyx_t_7_glarea_Program {
  __pyx_t_2gl_GLuint prog_render;
  __pyx_t_2gl_GLuint projection_location;
  __pyx_t_2gl_GLuint modelview_location;
  __pyx_t_2gl_GLuint prog_hud;
  __pyx_t_2gl_GLuint prog_pick;
  __pyx_t_2gl_GLuint picking_location;
  __pyx_t_2gl_GLuint projection_pick_location;
  __pyx_t_2gl_GLuint modelview_pick_location;
};

/* "_glarea.pyx":92
 * cdef Program program #px+
 * 
 * cdef struct SelectionDebugPoints: #px/             # <<<<<<<<<<<<<<
 * #px class selection_debug_points: pass
 *     float modelview1[3], modelview2[3] #px+
 */
struct __pyx_t_7_glarea_SelectionDebugPoints {
  float modelview1[3];
  float modelview2[3];
  int viewport1[2];
  int viewport2[2];
};
#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 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 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 CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

#include <string.h>

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name);

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 CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename); /*proto*/

static int __Pyx_check_binary_version(void);

#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/

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.stddef' */

/* Module declarations from 'libc.stdint' */

/* Module declarations from 'gl' */

/* Module declarations from 'glm' */

/* Module declarations from '_gldraw' */
static void (*__pyx_f_7_gldraw_gl_draw_cube)(void); /*proto*/
static void (*__pyx_f_7_gldraw_gl_pick_cube)(void); /*proto*/
static void (*__pyx_f_7_gldraw_gl_init_buffers)(void); /*proto*/
static void (*__pyx_f_7_gldraw_gl_delete_buffers)(void); /*proto*/
static void (*__pyx_f_7_gldraw_gl_draw_cube_debug)(void); /*proto*/
static void (*__pyx_f_7_gldraw_gl_draw_select_debug)(__pyx_t_2gl_GLfloat *, __pyx_t_2gl_GLsizeiptr, __pyx_t_2gl_GLuint); /*proto*/
static void (*__pyx_f_7_gldraw_gl_init_object_location)(__pyx_t_2gl_GLuint); /*proto*/

/* Module declarations from '_glarea' */
static struct __pyx_t_7_glarea_Terrain __pyx_v_7_glarea_terrain;
static struct __pyx_t_7_glarea_Frustrum __pyx_v_7_glarea_frustrum;
static struct __pyx_t_7_glarea_Program __pyx_v_7_glarea_program;
static struct __pyx_t_7_glarea_SelectionDebugPoints __pyx_v_7_glarea_selection_debug_points;
static void __pyx_f_7_glarea__update_modelview_matrix_translation(void); /*proto*/
static void __pyx_f_7_glarea__set_modelview_matrix_rotation(float, float); /*proto*/
static void __pyx_f_7_glarea__update_projection_matrix(void); /*proto*/
static void __pyx_f_7_glarea__set_picking_matrix(int, int); /*proto*/
static void __pyx_f_7_glarea__set_picking_matrix_identity(void); /*proto*/
static void __pyx_f_7_glarea__gl_print_string(PyObject *, __pyx_t_2gl_GLenum); /*proto*/
static void __pyx_f_7_glarea__gl_print_float(PyObject *, __pyx_t_2gl_GLenum); /*proto*/
static void __pyx_f_7_glarea__gl_print_integer(PyObject *, __pyx_t_2gl_GLenum); /*proto*/
static void __pyx_f_7_glarea__gl_print_bool(PyObject *, __pyx_t_2gl_GLenum); /*proto*/
static void __pyx_f_7_glarea__gl_set_matrix(__pyx_t_2gl_GLint, glm::mat4 &); /*proto*/
static void __pyx_f_7_glarea__gl_render_pick(void); /*proto*/
static PyObject *__pyx_f_7_glarea_gl_pick_polygons(int, int, int __pyx_skip_dispatch); /*proto*/
static void __pyx_f_7_glarea__modelview_to_viewport(PyObject *, int *); /*proto*/
static void __pyx_f_7_glarea__gl_print_shader_log(__pyx_t_2gl_GLuint); /*proto*/
static void __pyx_f_7_glarea__gl_print_program_log(__pyx_t_2gl_GLuint); /*proto*/
static __pyx_t_2gl_GLuint __pyx_f_7_glarea__gl_create_compiled_shader(__pyx_t_2gl_GLenum, PyObject *); /*proto*/
static void __pyx_f_7_glarea__gl_print_program_info(__pyx_t_2gl_GLuint); /*proto*/
static __pyx_t_2gl_GLuint __pyx_f_7_glarea__gl_create_program(PyObject *, PyObject *, PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "_glarea"
int __pyx_module_is_main__glarea = 0;

/* Implementation of '_glarea' */
static PyObject *__pyx_builtin_print;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_pf_7_glarea_init_module(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7_glarea_2set_frustrum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bounding_sphere_radius, PyObject *__pyx_v_zoom); /* proto */
static PyObject *__pyx_pf_7_glarea_4set_background_color(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_red, PyObject *__pyx_v_green, PyObject *__pyx_v_blue); /* proto */
static PyObject *__pyx_pf_7_glarea_6set_antialiasing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_multisample); /* proto */
static PyObject *__pyx_pf_7_glarea_8set_rotation_xy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_7_glarea_10gl_init(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7_glarea_12gl_exit(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7_glarea_14gl_resize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_width, PyObject *__pyx_v_height); /* proto */
static PyObject *__pyx_pf_7_glarea_16gl_render(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7_glarea_18gl_render_select_debug(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7_glarea_20gl_pick_polygons(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_x, int __pyx_v_y); /* proto */
static PyObject *__pyx_pf_7_glarea_22get_cursor_angle(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_point1, PyObject *__pyx_v_point2); /* proto */
static PyObject *__pyx_pf_7_glarea_24gl_create_render_program(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vertex_source, PyObject *__pyx_v_fragment_source); /* proto */
static PyObject *__pyx_pf_7_glarea_26gl_create_hud_program(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vertex_source, PyObject *__pyx_v_fragment_source); /* proto */
static PyObject *__pyx_pf_7_glarea_28gl_create_pick_program(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vertex_source, PyObject *__pyx_v_fragment_source); /* proto */
static char __pyx_k_1[] = "bounding_sphere_radius";
static char __pyx_k_2[] = "GL Strings:";
static char __pyx_k_4[] = "  GL Vendor:";
static char __pyx_k_5[] = "  GL Renderer:";
static char __pyx_k_6[] = "  GL Version:";
static char __pyx_k_7[] = "  GL Shading Language Version:";
static char __pyx_k_8[] = "  GL_SAMPLE_BUFFERS:";
static char __pyx_k_9[] = "  GL_SAMPLE_COVERAGE_VALUE:";
static char __pyx_k_10[] = "  GL_SAMPLE_COVERAGE_INVERT:";
static char __pyx_k_11[] = "  GL_SAMPLES:";
static char __pyx_k_12[] = "  GL_MULTISAMPLE:";
static char __pyx_k_13[] = "  GL_SAMPLE_ALPHA_TO_COVERAGE:";
static char __pyx_k_14[] = "  GL_SAMPLE_COVERAGE:";
static char __pyx_k_15[] = "==== Error compiling shader:";
static char __pyx_k_17[] = "====";
static char __pyx_k_19[] = "==== Error compiling shader (no log)";
static char __pyx_k_21[] = "==== Error linking shader program:";
static char __pyx_k_24[] = "==== Error linking shader program (no log)";
static char __pyx_k_26[] = "Failed to create shader";
static char __pyx_k_28[] = "shader program info";
static char __pyx_k_29[] = "delete status";
static char __pyx_k_30[] = "link status";
static char __pyx_k_31[] = "validate status";
static char __pyx_k_32[] = "info log length";
static char __pyx_k_33[] = "attached shaders";
static char __pyx_k_34[] = "active attributes";
static char __pyx_k_35[] = "active attribute max length";
static char __pyx_k_36[] = "active uniforms";
static char __pyx_k_37[] = "active uniform max length";
static char __pyx_k_38[] = " ";
static char __pyx_k_39[] = "active attributes:";
static char __pyx_k_41[] = "  {}, {}: length={} size={} type={} location={}";
static char __pyx_k_42[] = "active uniforms:";
static char __pyx_k_44[] = "  creating vertex shader";
static char __pyx_k_46[] = "  creating fragment shader";
static char __pyx_k_48[] = "Importing module:";
static char __pyx_k_49[] = "  from package:";
static char __pyx_k_50[] = "  compiled:";
static char __pyx_k_51[] = "  GL/GLES:";
static char __pyx_k_54[] = "/home/barcc/Projekte/pybik/trunk/build/temp.linux-x86_64-3.3/pybiklib/_glarea.pyx";
static char __pyx_k_59[] = "set_background_color";
static char __pyx_k_72[] = "gl_render_select_debug";
static char __pyx_k_77[] = "gl_create_render_program";
static char __pyx_k_80[] = "gl_create_hud_program";
static char __pyx_k_83[] = "gl_create_pick_program";
static char __pyx_k__i[] = "i";
static char __pyx_k__x[] = "x";
static char __pyx_k__y[] = "y";
static char __pyx_k__GL[] = "GL";
static char __pyx_k__red[] = "red";
static char __pyx_k__tex[] = "tex";
static char __pyx_k__blue[] = "blue";
static char __pyx_k__prog[] = "prog";
static char __pyx_k__zoom[] = "zoom";
static char __pyx_k__angle[] = "angle";
static char __pyx_k__debug[] = "debug";
static char __pyx_k__green[] = "green";
static char __pyx_k__print[] = "print";
static char __pyx_k__range[] = "range";
static char __pyx_k__width[] = "width";
static char __pyx_k__format[] = "format";
static char __pyx_k__height[] = "height";
static char __pyx_k__object[] = "object";
static char __pyx_k__point1[] = "point1";
static char __pyx_k__point2[] = "point2";
static char __pyx_k__rstrip[] = "rstrip";
static char __pyx_k___glarea[] = "_glarea";
static char __pyx_k__gl_exit[] = "gl_exit";
static char __pyx_k__gl_init[] = "gl_init";
static char __pyx_k__picking[] = "picking";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____name__[] = "__name__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__location[] = "location";
static char __pyx_k__DEBUG_MSG[] = "DEBUG_MSG";
static char __pyx_k__gl_render[] = "gl_render";
static char __pyx_k__gl_resize[] = "gl_resize";
static char __pyx_k__modelview[] = "modelview";
static char __pyx_k__DEBUG_DRAW[] = "DEBUG_DRAW";
static char __pyx_k__DEBUG_PICK[] = "DEBUG_PICK";
static char __pyx_k____compiled[] = "__compiled";
static char __pyx_k__attributes[] = "attributes";
static char __pyx_k__color_attr[] = "color_attr";
static char __pyx_k__projection[] = "projection";
static char __pyx_k__selectdata[] = "selectdata";
static char __pyx_k____package__[] = "__package__";
static char __pyx_k__init_module[] = "init_module";
static char __pyx_k__multisample[] = "multisample";
static char __pyx_k__normal_attr[] = "normal_attr";
static char __pyx_k__vertex_attr[] = "vertex_attr";
static char __pyx_k__set_frustrum[] = "set_frustrum";
static char __pyx_k__texcoord_attr[] = "texcoord_attr";
static char __pyx_k__vertex_source[] = "vertex_source";
static char __pyx_k__DEBUG_NOSHADER[] = "DEBUG_NOSHADER";
static char __pyx_k__DEBUG_NOFSHADER[] = "DEBUG_NOFSHADER";
static char __pyx_k__DEBUG_NOVSHADER[] = "DEBUG_NOVSHADER";
static char __pyx_k__fragment_source[] = "fragment_source";
static char __pyx_k__set_rotation_xy[] = "set_rotation_xy";
static char __pyx_k__get_cursor_angle[] = "get_cursor_angle";
static char __pyx_k__set_antialiasing[] = "set_antialiasing";
static PyObject *__pyx_n_s_1;
static PyObject *__pyx_kp_u_10;
static PyObject *__pyx_kp_u_11;
static PyObject *__pyx_kp_u_12;
static PyObject *__pyx_kp_u_13;
static PyObject *__pyx_kp_u_14;
static PyObject *__pyx_kp_u_15;
static PyObject *__pyx_kp_u_17;
static PyObject *__pyx_kp_u_19;
static PyObject *__pyx_kp_u_2;
static PyObject *__pyx_kp_u_21;
static PyObject *__pyx_kp_u_24;
static PyObject *__pyx_kp_u_26;
static PyObject *__pyx_kp_u_28;
static PyObject *__pyx_kp_u_29;
static PyObject *__pyx_kp_u_30;
static PyObject *__pyx_kp_u_31;
static PyObject *__pyx_kp_u_32;
static PyObject *__pyx_kp_u_33;
static PyObject *__pyx_kp_u_34;
static PyObject *__pyx_kp_u_35;
static PyObject *__pyx_kp_u_36;
static PyObject *__pyx_kp_u_37;
static PyObject *__pyx_kp_u_38;
static PyObject *__pyx_kp_u_39;
static PyObject *__pyx_kp_u_4;
static PyObject *__pyx_kp_u_41;
static PyObject *__pyx_kp_u_42;
static PyObject *__pyx_kp_u_44;
static PyObject *__pyx_kp_u_46;
static PyObject *__pyx_kp_u_48;
static PyObject *__pyx_kp_u_49;
static PyObject *__pyx_kp_u_5;
static PyObject *__pyx_kp_u_50;
static PyObject *__pyx_kp_u_51;
static PyObject *__pyx_kp_s_54;
static PyObject *__pyx_n_s_59;
static PyObject *__pyx_kp_u_6;
static PyObject *__pyx_kp_u_7;
static PyObject *__pyx_n_s_72;
static PyObject *__pyx_n_s_77;
static PyObject *__pyx_kp_u_8;
static PyObject *__pyx_n_s_80;
static PyObject *__pyx_n_s_83;
static PyObject *__pyx_kp_u_9;
static PyObject *__pyx_n_s__DEBUG_DRAW;
static PyObject *__pyx_n_s__DEBUG_MSG;
static PyObject *__pyx_n_s__DEBUG_NOFSHADER;
static PyObject *__pyx_n_s__DEBUG_NOSHADER;
static PyObject *__pyx_n_s__DEBUG_NOVSHADER;
static PyObject *__pyx_n_s__DEBUG_PICK;
static PyObject *__pyx_n_u__GL;
static PyObject *__pyx_n_s____compiled;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____name__;
static PyObject *__pyx_n_s____package__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s___glarea;
static PyObject *__pyx_n_s__angle;
static PyObject *__pyx_n_s__attributes;
static PyObject *__pyx_n_s__blue;
static PyObject *__pyx_n_b__color_attr;
static PyObject *__pyx_n_s__debug;
static PyObject *__pyx_n_s__format;
static PyObject *__pyx_n_s__fragment_source;
static PyObject *__pyx_n_s__get_cursor_angle;
static PyObject *__pyx_n_s__gl_exit;
static PyObject *__pyx_n_s__gl_init;
static PyObject *__pyx_n_s__gl_render;
static PyObject *__pyx_n_s__gl_resize;
static PyObject *__pyx_n_s__green;
static PyObject *__pyx_n_s__height;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__init_module;
static PyObject *__pyx_n_s__location;
static PyObject *__pyx_n_s__multisample;
static PyObject *__pyx_n_b__normal_attr;
static PyObject *__pyx_n_s__point1;
static PyObject *__pyx_n_s__point2;
static PyObject *__pyx_n_s__print;
static PyObject *__pyx_n_s__prog;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__red;
static PyObject *__pyx_n_s__rstrip;
static PyObject *__pyx_n_s__selectdata;
static PyObject *__pyx_n_s__set_antialiasing;
static PyObject *__pyx_n_s__set_frustrum;
static PyObject *__pyx_n_s__set_rotation_xy;
static PyObject *__pyx_n_b__texcoord_attr;
static PyObject *__pyx_n_b__vertex_attr;
static PyObject *__pyx_n_s__vertex_source;
static PyObject *__pyx_n_s__width;
static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__y;
static PyObject *__pyx_n_s__zoom;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_90;
static PyObject *__pyx_int_neg_90;
static PyObject *__pyx_int_360;
static PyObject *__pyx_k_tuple_3;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_18;
static PyObject *__pyx_k_tuple_20;
static PyObject *__pyx_k_tuple_22;
static PyObject *__pyx_k_tuple_23;
static PyObject *__pyx_k_tuple_25;
static PyObject *__pyx_k_tuple_27;
static PyObject *__pyx_k_tuple_40;
static PyObject *__pyx_k_tuple_43;
static PyObject *__pyx_k_tuple_45;
static PyObject *__pyx_k_tuple_47;
static PyObject *__pyx_k_tuple_52;
static PyObject *__pyx_k_tuple_55;
static PyObject *__pyx_k_tuple_57;
static PyObject *__pyx_k_tuple_60;
static PyObject *__pyx_k_tuple_62;
static PyObject *__pyx_k_tuple_65;
static PyObject *__pyx_k_tuple_67;
static PyObject *__pyx_k_tuple_70;
static PyObject *__pyx_k_tuple_73;
static PyObject *__pyx_k_tuple_75;
static PyObject *__pyx_k_tuple_78;
static PyObject *__pyx_k_tuple_81;
static PyObject *__pyx_k_codeobj_53;
static PyObject *__pyx_k_codeobj_56;
static PyObject *__pyx_k_codeobj_58;
static PyObject *__pyx_k_codeobj_61;
static PyObject *__pyx_k_codeobj_63;
static PyObject *__pyx_k_codeobj_64;
static PyObject *__pyx_k_codeobj_66;
static PyObject *__pyx_k_codeobj_68;
static PyObject *__pyx_k_codeobj_69;
static PyObject *__pyx_k_codeobj_71;
static PyObject *__pyx_k_codeobj_74;
static PyObject *__pyx_k_codeobj_76;
static PyObject *__pyx_k_codeobj_79;
static PyObject *__pyx_k_codeobj_82;

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_1init_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_1init_module = {__Pyx_NAMESTR("init_module"), (PyCFunction)__pyx_pw_7_glarea_1init_module, METH_NOARGS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_1init_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_module (wrapper)", 0);
  __pyx_r = __pyx_pf_7_glarea_init_module(__pyx_self);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":100
 * ### module state
 * 
 * def init_module():             # <<<<<<<<<<<<<<
 *     terrain.red = 0.0
 *     terrain.green = 0.0
 */

static PyObject *__pyx_pf_7_glarea_init_module(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  float __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init_module", 0);

  /* "_glarea.pyx":101
 * 
 * def init_module():
 *     terrain.red = 0.0             # <<<<<<<<<<<<<<
 *     terrain.green = 0.0
 *     terrain.blue = 0.0
 */
  __pyx_v_7_glarea_terrain.red = 0.0;

  /* "_glarea.pyx":102
 * def init_module():
 *     terrain.red = 0.0
 *     terrain.green = 0.0             # <<<<<<<<<<<<<<
 *     terrain.blue = 0.0
 *     terrain.width = 1
 */
  __pyx_v_7_glarea_terrain.green = 0.0;

  /* "_glarea.pyx":103
 *     terrain.red = 0.0
 *     terrain.green = 0.0
 *     terrain.blue = 0.0             # <<<<<<<<<<<<<<
 *     terrain.width = 1
 *     terrain.height = 1
 */
  __pyx_v_7_glarea_terrain.blue = 0.0;

  /* "_glarea.pyx":104
 *     terrain.green = 0.0
 *     terrain.blue = 0.0
 *     terrain.width = 1             # <<<<<<<<<<<<<<
 *     terrain.height = 1
 * 
 */
  __pyx_v_7_glarea_terrain.width = 1;

  /* "_glarea.pyx":105
 *     terrain.blue = 0.0
 *     terrain.width = 1
 *     terrain.height = 1             # <<<<<<<<<<<<<<
 * 
 *     frustrum.fovy_angle = 33.0  # field of view angle
 */
  __pyx_v_7_glarea_terrain.height = 1;

  /* "_glarea.pyx":107
 *     terrain.height = 1
 * 
 *     frustrum.fovy_angle = 33.0  # field of view angle             # <<<<<<<<<<<<<<
 *     frustrum.fovy_radius = 1 / tan(frustrum.fovy_angle * M_PI / 360.0)
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius  # zoom == 1.
 */
  __pyx_v_7_glarea_frustrum.fovy_angle = 33.0;

  /* "_glarea.pyx":108
 * 
 *     frustrum.fovy_angle = 33.0  # field of view angle
 *     frustrum.fovy_radius = 1 / tan(frustrum.fovy_angle * M_PI / 360.0)             # <<<<<<<<<<<<<<
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius  # zoom == 1.
 *     frustrum.bounding_sphere_radius = 1.
 */
  __pyx_t_1 = tan(((__pyx_v_7_glarea_frustrum.fovy_angle * M_PI) / 360.0));
  if (unlikely(__pyx_t_1 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_7_glarea_frustrum.fovy_radius = (1.0 / __pyx_t_1);

  /* "_glarea.pyx":109
 *     frustrum.fovy_angle = 33.0  # field of view angle
 *     frustrum.fovy_radius = 1 / tan(frustrum.fovy_angle * M_PI / 360.0)
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius  # zoom == 1.             # <<<<<<<<<<<<<<
 *     frustrum.bounding_sphere_radius = 1.
 *     frustrum.multisample = 0
 */
  __pyx_t_2 = __pyx_v_7_glarea_frustrum.fovy_radius;
  __pyx_v_7_glarea_frustrum.fovy_radius_zoom = __pyx_t_2;

  /* "_glarea.pyx":110
 *     frustrum.fovy_radius = 1 / tan(frustrum.fovy_angle * M_PI / 360.0)
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius  # zoom == 1.
 *     frustrum.bounding_sphere_radius = 1.             # <<<<<<<<<<<<<<
 *     frustrum.multisample = 0
 *     # fill modelview_matrix
 */
  __pyx_v_7_glarea_frustrum.bounding_sphere_radius = 1.;

  /* "_glarea.pyx":111
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius  # zoom == 1.
 *     frustrum.bounding_sphere_radius = 1.
 *     frustrum.multisample = 0             # <<<<<<<<<<<<<<
 *     # fill modelview_matrix
 *     frustrum.modelview_matrix = mat4(1.)
 */
  __pyx_v_7_glarea_frustrum.multisample = 0;

  /* "_glarea.pyx":113
 *     frustrum.multisample = 0
 *     # fill modelview_matrix
 *     frustrum.modelview_matrix = mat4(1.)             # <<<<<<<<<<<<<<
 *     _update_modelview_matrix_translation()
 *     # fill projection_matrix, see doc of glFrustum
 */
  __pyx_v_7_glarea_frustrum.modelview_matrix = glm::mat4(1.);

  /* "_glarea.pyx":114
 *     # fill modelview_matrix
 *     frustrum.modelview_matrix = mat4(1.)
 *     _update_modelview_matrix_translation()             # <<<<<<<<<<<<<<
 *     # fill projection_matrix, see doc of glFrustum
 *     frustrum.projection_matrix = mat4(1.)
 */
  __pyx_f_7_glarea__update_modelview_matrix_translation();

  /* "_glarea.pyx":116
 *     _update_modelview_matrix_translation()
 *     # fill projection_matrix, see doc of glFrustum
 *     frustrum.projection_matrix = mat4(1.)             # <<<<<<<<<<<<<<
 *     frustrum.projection_matrix[2][3] = -1.
 *     frustrum.projection_matrix[3][3] = 0.
 */
  __pyx_v_7_glarea_frustrum.projection_matrix = glm::mat4(1.);

  /* "_glarea.pyx":117
 *     # fill projection_matrix, see doc of glFrustum
 *     frustrum.projection_matrix = mat4(1.)
 *     frustrum.projection_matrix[2][3] = -1.             # <<<<<<<<<<<<<<
 *     frustrum.projection_matrix[3][3] = 0.
 *     _update_projection_matrix()
 */
  ((__pyx_v_7_glarea_frustrum.projection_matrix[2])[3]) = -1.;

  /* "_glarea.pyx":118
 *     frustrum.projection_matrix = mat4(1.)
 *     frustrum.projection_matrix[2][3] = -1.
 *     frustrum.projection_matrix[3][3] = 0.             # <<<<<<<<<<<<<<
 *     _update_projection_matrix()
 *     # fill picking_matrix
 */
  ((__pyx_v_7_glarea_frustrum.projection_matrix[3])[3]) = 0.;

  /* "_glarea.pyx":119
 *     frustrum.projection_matrix[2][3] = -1.
 *     frustrum.projection_matrix[3][3] = 0.
 *     _update_projection_matrix()             # <<<<<<<<<<<<<<
 *     # fill picking_matrix
 *     frustrum.picking_matrix = mat4(1.)
 */
  __pyx_f_7_glarea__update_projection_matrix();

  /* "_glarea.pyx":121
 *     _update_projection_matrix()
 *     # fill picking_matrix
 *     frustrum.picking_matrix = mat4(1.)             # <<<<<<<<<<<<<<
 * 
 *     program.prog_render = 0
 */
  __pyx_v_7_glarea_frustrum.picking_matrix = glm::mat4(1.);

  /* "_glarea.pyx":123
 *     frustrum.picking_matrix = mat4(1.)
 * 
 *     program.prog_render = 0             # <<<<<<<<<<<<<<
 *     program.prog_hud = 0
 *     program.prog_pick = 0
 */
  __pyx_v_7_glarea_program.prog_render = 0;

  /* "_glarea.pyx":124
 * 
 *     program.prog_render = 0
 *     program.prog_hud = 0             # <<<<<<<<<<<<<<
 *     program.prog_pick = 0
 * 
 */
  __pyx_v_7_glarea_program.prog_hud = 0;

  /* "_glarea.pyx":125
 *     program.prog_render = 0
 *     program.prog_hud = 0
 *     program.prog_pick = 0             # <<<<<<<<<<<<<<
 * 
 * cdef void _update_modelview_matrix_translation(): #px/
 */
  __pyx_v_7_glarea_program.prog_pick = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("_glarea.init_module", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":127
 *     program.prog_pick = 0
 * 
 * cdef void _update_modelview_matrix_translation(): #px/             # <<<<<<<<<<<<<<
 * #px def _update_modelview_matrix_translation():
 *     frustrum.modelview_matrix[3][2] = -frustrum.bounding_sphere_radius * (frustrum.fovy_radius_zoom + 1.)
 */

static void __pyx_f_7_glarea__update_modelview_matrix_translation(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_update_modelview_matrix_translation", 0);

  /* "_glarea.pyx":129
 * cdef void _update_modelview_matrix_translation(): #px/
 * #px def _update_modelview_matrix_translation():
 *     frustrum.modelview_matrix[3][2] = -frustrum.bounding_sphere_radius * (frustrum.fovy_radius_zoom + 1.)             # <<<<<<<<<<<<<<
 * 
 * cdef void _set_modelview_matrix_rotation(float radiansx, float radiansy): #px/
 */
  ((__pyx_v_7_glarea_frustrum.modelview_matrix[3])[2]) = ((-__pyx_v_7_glarea_frustrum.bounding_sphere_radius) * (__pyx_v_7_glarea_frustrum.fovy_radius_zoom + 1.));

  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":131
 *     frustrum.modelview_matrix[3][2] = -frustrum.bounding_sphere_radius * (frustrum.fovy_radius_zoom + 1.)
 * 
 * cdef void _set_modelview_matrix_rotation(float radiansx, float radiansy): #px/             # <<<<<<<<<<<<<<
 * #px def _set_modelview_matrix_rotation(radiansx, radiansy):
 *     cdef vec4 *M #px+
 */

static void __pyx_f_7_glarea__set_modelview_matrix_rotation(float __pyx_v_radiansx, float __pyx_v_radiansy) {
  glm::vec4 *__pyx_v_M;
  float __pyx_v_sx;
  float __pyx_v_sy;
  float __pyx_v_cx;
  float __pyx_v_cy;
  float __pyx_v_m00;
  float __pyx_v_m11;
  float __pyx_v_m12;
  float __pyx_v_m20;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_modelview_matrix_rotation", 0);

  /* "_glarea.pyx":137
 *     cdef float m00, m11, m12, m20 #px+
 * 
 *     M = &frustrum.modelview_matrix[0] #px/             # <<<<<<<<<<<<<<
 *     #px M = frustrum.modelview_matrix
 * 
 */
  __pyx_v_M = (&(__pyx_v_7_glarea_frustrum.modelview_matrix[0]));

  /* "_glarea.pyx":140
 *     #px M = frustrum.modelview_matrix
 * 
 *     sx = sin(radiansx/2)             # <<<<<<<<<<<<<<
 *     sy = sin(radiansy/2)
 *     cx = cos(radiansx/2)
 */
  __pyx_v_sx = sin((__pyx_v_radiansx / 2.0));

  /* "_glarea.pyx":141
 * 
 *     sx = sin(radiansx/2)
 *     sy = sin(radiansy/2)             # <<<<<<<<<<<<<<
 *     cx = cos(radiansx/2)
 *     cy = cos(radiansy/2)
 */
  __pyx_v_sy = sin((__pyx_v_radiansy / 2.0));

  /* "_glarea.pyx":142
 *     sx = sin(radiansx/2)
 *     sy = sin(radiansy/2)
 *     cx = cos(radiansx/2)             # <<<<<<<<<<<<<<
 *     cy = cos(radiansy/2)
 * 
 */
  __pyx_v_cx = cos((__pyx_v_radiansx / 2.0));

  /* "_glarea.pyx":143
 *     sy = sin(radiansy/2)
 *     cx = cos(radiansx/2)
 *     cy = cos(radiansy/2)             # <<<<<<<<<<<<<<
 * 
 *     m00 = 2*cx*cx - 1.
 */
  __pyx_v_cy = cos((__pyx_v_radiansy / 2.0));

  /* "_glarea.pyx":145
 *     cy = cos(radiansy/2)
 * 
 *     m00 = 2*cx*cx - 1.             # <<<<<<<<<<<<<<
 *     m11 = 2*cy*cy - 1.
 *     m12 = 2*sy*cy
 */
  __pyx_v_m00 = (((2.0 * __pyx_v_cx) * __pyx_v_cx) - 1.);

  /* "_glarea.pyx":146
 * 
 *     m00 = 2*cx*cx - 1.
 *     m11 = 2*cy*cy - 1.             # <<<<<<<<<<<<<<
 *     m12 = 2*sy*cy
 *     m20 = 2*sx*cx
 */
  __pyx_v_m11 = (((2.0 * __pyx_v_cy) * __pyx_v_cy) - 1.);

  /* "_glarea.pyx":147
 *     m00 = 2*cx*cx - 1.
 *     m11 = 2*cy*cy - 1.
 *     m12 = 2*sy*cy             # <<<<<<<<<<<<<<
 *     m20 = 2*sx*cx
 *     # pylint: disable=C0321
 */
  __pyx_v_m12 = ((2.0 * __pyx_v_sy) * __pyx_v_cy);

  /* "_glarea.pyx":148
 *     m11 = 2*cy*cy - 1.
 *     m12 = 2*sy*cy
 *     m20 = 2*sx*cx             # <<<<<<<<<<<<<<
 *     # pylint: disable=C0321
 *     M[0][0] =  m00;         M[1][0] = 0.;   M[2][0] =  m20
 */
  __pyx_v_m20 = ((2.0 * __pyx_v_sx) * __pyx_v_cx);

  /* "_glarea.pyx":150
 *     m20 = 2*sx*cx
 *     # pylint: disable=C0321
 *     M[0][0] =  m00;         M[1][0] = 0.;   M[2][0] =  m20             # <<<<<<<<<<<<<<
 *     M[0][1] =  m12 * m20;   M[1][1] = m11;  M[2][1] = -m00 * m12
 *     M[0][2] = -m11 * m20;   M[1][2] = m12;  M[2][2] =  m00 * m11
 */
  ((__pyx_v_M[0])[0]) = __pyx_v_m00;
  ((__pyx_v_M[1])[0]) = 0.;
  ((__pyx_v_M[2])[0]) = __pyx_v_m20;

  /* "_glarea.pyx":151
 *     # pylint: disable=C0321
 *     M[0][0] =  m00;         M[1][0] = 0.;   M[2][0] =  m20
 *     M[0][1] =  m12 * m20;   M[1][1] = m11;  M[2][1] = -m00 * m12             # <<<<<<<<<<<<<<
 *     M[0][2] = -m11 * m20;   M[1][2] = m12;  M[2][2] =  m00 * m11
 *     # py lint: enable=C0321
 */
  ((__pyx_v_M[0])[1]) = (__pyx_v_m12 * __pyx_v_m20);
  ((__pyx_v_M[1])[1]) = __pyx_v_m11;
  ((__pyx_v_M[2])[1]) = ((-__pyx_v_m00) * __pyx_v_m12);

  /* "_glarea.pyx":152
 *     M[0][0] =  m00;         M[1][0] = 0.;   M[2][0] =  m20
 *     M[0][1] =  m12 * m20;   M[1][1] = m11;  M[2][1] = -m00 * m12
 *     M[0][2] = -m11 * m20;   M[1][2] = m12;  M[2][2] =  m00 * m11             # <<<<<<<<<<<<<<
 *     # py lint: enable=C0321
 * 
 */
  ((__pyx_v_M[0])[2]) = ((-__pyx_v_m11) * __pyx_v_m20);
  ((__pyx_v_M[1])[2]) = __pyx_v_m12;
  ((__pyx_v_M[2])[2]) = (__pyx_v_m00 * __pyx_v_m11);

  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":155
 *     # py lint: enable=C0321
 * 
 * cdef void _update_projection_matrix(): #px/             # <<<<<<<<<<<<<<
 * #px def _update_projection_matrix():
 *     if terrain.width < terrain.height:
 */

static void __pyx_f_7_glarea__update_projection_matrix(void) {
  double __pyx_v_aspectx;
  double __pyx_v_aspecty;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_update_projection_matrix", 0);

  /* "_glarea.pyx":157
 * cdef void _update_projection_matrix(): #px/
 * #px def _update_projection_matrix():
 *     if terrain.width < terrain.height:             # <<<<<<<<<<<<<<
 *         aspectx = 1.
 *         aspecty = terrain.height / terrain.width
 */
  __pyx_t_1 = (__pyx_v_7_glarea_terrain.width < __pyx_v_7_glarea_terrain.height);
  if (__pyx_t_1) {

    /* "_glarea.pyx":158
 * #px def _update_projection_matrix():
 *     if terrain.width < terrain.height:
 *         aspectx = 1.             # <<<<<<<<<<<<<<
 *         aspecty = terrain.height / terrain.width
 *     else:
 */
    __pyx_v_aspectx = 1.;

    /* "_glarea.pyx":159
 *     if terrain.width < terrain.height:
 *         aspectx = 1.
 *         aspecty = terrain.height / terrain.width             # <<<<<<<<<<<<<<
 *     else:
 *         aspectx = terrain.width / terrain.height
 */
    if (unlikely(__pyx_v_7_glarea_terrain.width == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_aspecty = (((double)__pyx_v_7_glarea_terrain.height) / ((double)__pyx_v_7_glarea_terrain.width));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "_glarea.pyx":161
 *         aspecty = terrain.height / terrain.width
 *     else:
 *         aspectx = terrain.width / terrain.height             # <<<<<<<<<<<<<<
 *         aspecty = 1.
 *     # see doc of glFrustum
 */
    if (unlikely(__pyx_v_7_glarea_terrain.height == 0)) {
      PyErr_Format(PyExc_ZeroDivisionError, "float division");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_aspectx = (((double)__pyx_v_7_glarea_terrain.width) / ((double)__pyx_v_7_glarea_terrain.height));

    /* "_glarea.pyx":162
 *     else:
 *         aspectx = terrain.width / terrain.height
 *         aspecty = 1.             # <<<<<<<<<<<<<<
 *     # see doc of glFrustum
 *     frustrum.projection_matrix[0][0] = frustrum.fovy_radius / aspectx
 */
    __pyx_v_aspecty = 1.;
  }
  __pyx_L3:;

  /* "_glarea.pyx":164
 *         aspecty = 1.
 *     # see doc of glFrustum
 *     frustrum.projection_matrix[0][0] = frustrum.fovy_radius / aspectx             # <<<<<<<<<<<<<<
 *     frustrum.projection_matrix[1][1] = frustrum.fovy_radius / aspecty
 *     frustrum.projection_matrix[2][2] = -(frustrum.fovy_radius_zoom + 1.)
 */
  if (unlikely(__pyx_v_aspectx == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  ((__pyx_v_7_glarea_frustrum.projection_matrix[0])[0]) = (((double)__pyx_v_7_glarea_frustrum.fovy_radius) / __pyx_v_aspectx);

  /* "_glarea.pyx":165
 *     # see doc of glFrustum
 *     frustrum.projection_matrix[0][0] = frustrum.fovy_radius / aspectx
 *     frustrum.projection_matrix[1][1] = frustrum.fovy_radius / aspecty             # <<<<<<<<<<<<<<
 *     frustrum.projection_matrix[2][2] = -(frustrum.fovy_radius_zoom + 1.)
 *     frustrum.projection_matrix[3][2] = -(frustrum.fovy_radius_zoom + 2.
 */
  if (unlikely(__pyx_v_aspecty == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  ((__pyx_v_7_glarea_frustrum.projection_matrix[1])[1]) = (((double)__pyx_v_7_glarea_frustrum.fovy_radius) / __pyx_v_aspecty);

  /* "_glarea.pyx":166
 *     frustrum.projection_matrix[0][0] = frustrum.fovy_radius / aspectx
 *     frustrum.projection_matrix[1][1] = frustrum.fovy_radius / aspecty
 *     frustrum.projection_matrix[2][2] = -(frustrum.fovy_radius_zoom + 1.)             # <<<<<<<<<<<<<<
 *     frustrum.projection_matrix[3][2] = -(frustrum.fovy_radius_zoom + 2.
 *                     ) * frustrum.bounding_sphere_radius * frustrum.fovy_radius_zoom
 */
  ((__pyx_v_7_glarea_frustrum.projection_matrix[2])[2]) = (-(__pyx_v_7_glarea_frustrum.fovy_radius_zoom + 1.));

  /* "_glarea.pyx":167
 *     frustrum.projection_matrix[1][1] = frustrum.fovy_radius / aspecty
 *     frustrum.projection_matrix[2][2] = -(frustrum.fovy_radius_zoom + 1.)
 *     frustrum.projection_matrix[3][2] = -(frustrum.fovy_radius_zoom + 2.             # <<<<<<<<<<<<<<
 *                     ) * frustrum.bounding_sphere_radius * frustrum.fovy_radius_zoom
 * 
 */
  ((__pyx_v_7_glarea_frustrum.projection_matrix[3])[2]) = (((-(__pyx_v_7_glarea_frustrum.fovy_radius_zoom + 2.)) * __pyx_v_7_glarea_frustrum.bounding_sphere_radius) * __pyx_v_7_glarea_frustrum.fovy_radius_zoom);

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("_glarea._update_projection_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":170
 *                     ) * frustrum.bounding_sphere_radius * frustrum.fovy_radius_zoom
 * 
 * cdef void _set_picking_matrix(int x, int y): #px/             # <<<<<<<<<<<<<<
 * #px def _set_picking_matrix(x, y):
 *     # Set picking matrix, restrict drawing to one pixel of the viewport
 */

static void __pyx_f_7_glarea__set_picking_matrix(int __pyx_v_x, int __pyx_v_y) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_set_picking_matrix", 0);

  /* "_glarea.pyx":178
 *     #           glTranslatef(terrain.width - 2*x, terrain.height - 2*y, 0.)
 *     #           glScalef(terrain.width, terrain.height, 1.0)
 *     frustrum.picking_matrix[3][0] = terrain.width - 2*x             # <<<<<<<<<<<<<<
 *     frustrum.picking_matrix[3][1] = terrain.height - 2*y
 *     frustrum.picking_matrix[0][0] = terrain.width
 */
  ((__pyx_v_7_glarea_frustrum.picking_matrix[3])[0]) = (__pyx_v_7_glarea_terrain.width - (2 * __pyx_v_x));

  /* "_glarea.pyx":179
 *     #           glScalef(terrain.width, terrain.height, 1.0)
 *     frustrum.picking_matrix[3][0] = terrain.width - 2*x
 *     frustrum.picking_matrix[3][1] = terrain.height - 2*y             # <<<<<<<<<<<<<<
 *     frustrum.picking_matrix[0][0] = terrain.width
 *     frustrum.picking_matrix[1][1] = terrain.height
 */
  ((__pyx_v_7_glarea_frustrum.picking_matrix[3])[1]) = (__pyx_v_7_glarea_terrain.height - (2 * __pyx_v_y));

  /* "_glarea.pyx":180
 *     frustrum.picking_matrix[3][0] = terrain.width - 2*x
 *     frustrum.picking_matrix[3][1] = terrain.height - 2*y
 *     frustrum.picking_matrix[0][0] = terrain.width             # <<<<<<<<<<<<<<
 *     frustrum.picking_matrix[1][1] = terrain.height
 * 
 */
  __pyx_t_1 = __pyx_v_7_glarea_terrain.width;
  ((__pyx_v_7_glarea_frustrum.picking_matrix[0])[0]) = __pyx_t_1;

  /* "_glarea.pyx":181
 *     frustrum.picking_matrix[3][1] = terrain.height - 2*y
 *     frustrum.picking_matrix[0][0] = terrain.width
 *     frustrum.picking_matrix[1][1] = terrain.height             # <<<<<<<<<<<<<<
 * 
 * cdef void _set_picking_matrix_identity(): #px/
 */
  __pyx_t_1 = __pyx_v_7_glarea_terrain.height;
  ((__pyx_v_7_glarea_frustrum.picking_matrix[1])[1]) = __pyx_t_1;

  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":183
 *     frustrum.picking_matrix[1][1] = terrain.height
 * 
 * cdef void _set_picking_matrix_identity(): #px/             # <<<<<<<<<<<<<<
 * #px def _set_picking_matrix_identity():
 *     frustrum.picking_matrix[3][0] = 0.
 */

static void __pyx_f_7_glarea__set_picking_matrix_identity(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_picking_matrix_identity", 0);

  /* "_glarea.pyx":185
 * cdef void _set_picking_matrix_identity(): #px/
 * #px def _set_picking_matrix_identity():
 *     frustrum.picking_matrix[3][0] = 0.             # <<<<<<<<<<<<<<
 *     frustrum.picking_matrix[3][1] = 0.
 *     frustrum.picking_matrix[0][0] = 1.
 */
  ((__pyx_v_7_glarea_frustrum.picking_matrix[3])[0]) = 0.;

  /* "_glarea.pyx":186
 * #px def _set_picking_matrix_identity():
 *     frustrum.picking_matrix[3][0] = 0.
 *     frustrum.picking_matrix[3][1] = 0.             # <<<<<<<<<<<<<<
 *     frustrum.picking_matrix[0][0] = 1.
 *     frustrum.picking_matrix[1][1] = 1.
 */
  ((__pyx_v_7_glarea_frustrum.picking_matrix[3])[1]) = 0.;

  /* "_glarea.pyx":187
 *     frustrum.picking_matrix[3][0] = 0.
 *     frustrum.picking_matrix[3][1] = 0.
 *     frustrum.picking_matrix[0][0] = 1.             # <<<<<<<<<<<<<<
 *     frustrum.picking_matrix[1][1] = 1.
 * 
 */
  ((__pyx_v_7_glarea_frustrum.picking_matrix[0])[0]) = 1.;

  /* "_glarea.pyx":188
 *     frustrum.picking_matrix[3][1] = 0.
 *     frustrum.picking_matrix[0][0] = 1.
 *     frustrum.picking_matrix[1][1] = 1.             # <<<<<<<<<<<<<<
 * 
 * def set_frustrum(bounding_sphere_radius, zoom):
 */
  ((__pyx_v_7_glarea_frustrum.picking_matrix[1])[1]) = 1.;

  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_3set_frustrum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_3set_frustrum = {__Pyx_NAMESTR("set_frustrum"), (PyCFunction)__pyx_pw_7_glarea_3set_frustrum, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_3set_frustrum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bounding_sphere_radius = 0;
  PyObject *__pyx_v_zoom = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_frustrum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_1,&__pyx_n_s__zoom,0};
    PyObject* values[2] = {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  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_1)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__zoom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_frustrum", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_frustrum") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_bounding_sphere_radius = values[0];
    __pyx_v_zoom = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_frustrum", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea.set_frustrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_glarea_2set_frustrum(__pyx_self, __pyx_v_bounding_sphere_radius, __pyx_v_zoom);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":190
 *     frustrum.picking_matrix[1][1] = 1.
 * 
 * def set_frustrum(bounding_sphere_radius, zoom):             # <<<<<<<<<<<<<<
 *     frustrum.bounding_sphere_radius = bounding_sphere_radius
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius / zoom
 */

static PyObject *__pyx_pf_7_glarea_2set_frustrum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bounding_sphere_radius, PyObject *__pyx_v_zoom) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  float __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_frustrum", 0);

  /* "_glarea.pyx":191
 * 
 * def set_frustrum(bounding_sphere_radius, zoom):
 *     frustrum.bounding_sphere_radius = bounding_sphere_radius             # <<<<<<<<<<<<<<
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius / zoom
 *     _update_modelview_matrix_translation()
 */
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_bounding_sphere_radius); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_frustrum.bounding_sphere_radius = __pyx_t_1;

  /* "_glarea.pyx":192
 * def set_frustrum(bounding_sphere_radius, zoom):
 *     frustrum.bounding_sphere_radius = bounding_sphere_radius
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius / zoom             # <<<<<<<<<<<<<<
 *     _update_modelview_matrix_translation()
 *     _update_projection_matrix()
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_7_glarea_frustrum.fovy_radius); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_zoom); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_7_glarea_frustrum.fovy_radius_zoom = __pyx_t_4;

  /* "_glarea.pyx":193
 *     frustrum.bounding_sphere_radius = bounding_sphere_radius
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius / zoom
 *     _update_modelview_matrix_translation()             # <<<<<<<<<<<<<<
 *     _update_projection_matrix()
 * 
 */
  __pyx_f_7_glarea__update_modelview_matrix_translation();

  /* "_glarea.pyx":194
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius / zoom
 *     _update_modelview_matrix_translation()
 *     _update_projection_matrix()             # <<<<<<<<<<<<<<
 * 
 * def set_background_color(red, green, blue):
 */
  __pyx_f_7_glarea__update_projection_matrix();

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_glarea.set_frustrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_5set_background_color(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_5set_background_color = {__Pyx_NAMESTR("set_background_color"), (PyCFunction)__pyx_pw_7_glarea_5set_background_color, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_5set_background_color(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_red = 0;
  PyObject *__pyx_v_green = 0;
  PyObject *__pyx_v_blue = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_background_color (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__red,&__pyx_n_s__green,&__pyx_n_s__blue,0};
    PyObject* values[3] = {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  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__red)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__green)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_background_color", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blue)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_background_color", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_background_color") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_red = values[0];
    __pyx_v_green = values[1];
    __pyx_v_blue = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_background_color", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea.set_background_color", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_glarea_4set_background_color(__pyx_self, __pyx_v_red, __pyx_v_green, __pyx_v_blue);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":196
 *     _update_projection_matrix()
 * 
 * def set_background_color(red, green, blue):             # <<<<<<<<<<<<<<
 *     terrain.red = red
 *     terrain.green = green
 */

static PyObject *__pyx_pf_7_glarea_4set_background_color(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_red, PyObject *__pyx_v_green, PyObject *__pyx_v_blue) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  float __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_background_color", 0);

  /* "_glarea.pyx":197
 * 
 * def set_background_color(red, green, blue):
 *     terrain.red = red             # <<<<<<<<<<<<<<
 *     terrain.green = green
 *     terrain.blue = blue
 */
  __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_red); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_terrain.red = __pyx_t_1;

  /* "_glarea.pyx":198
 * def set_background_color(red, green, blue):
 *     terrain.red = red
 *     terrain.green = green             # <<<<<<<<<<<<<<
 *     terrain.blue = blue
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_green); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_terrain.green = __pyx_t_1;

  /* "_glarea.pyx":199
 *     terrain.red = red
 *     terrain.green = green
 *     terrain.blue = blue             # <<<<<<<<<<<<<<
 * 
 * def set_antialiasing(multisample):
 */
  __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_blue); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_terrain.blue = __pyx_t_1;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("_glarea.set_background_color", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_7set_antialiasing(PyObject *__pyx_self, PyObject *__pyx_v_multisample); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_7set_antialiasing = {__Pyx_NAMESTR("set_antialiasing"), (PyCFunction)__pyx_pw_7_glarea_7set_antialiasing, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_7set_antialiasing(PyObject *__pyx_self, PyObject *__pyx_v_multisample) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_antialiasing (wrapper)", 0);
  __pyx_r = __pyx_pf_7_glarea_6set_antialiasing(__pyx_self, ((PyObject *)__pyx_v_multisample));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":201
 *     terrain.blue = blue
 * 
 * def set_antialiasing(multisample):             # <<<<<<<<<<<<<<
 *     frustrum.multisample = multisample
 * 
 */

static PyObject *__pyx_pf_7_glarea_6set_antialiasing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_multisample) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_antialiasing", 0);

  /* "_glarea.pyx":202
 * 
 * def set_antialiasing(multisample):
 *     frustrum.multisample = multisample             # <<<<<<<<<<<<<<
 * 
 * def set_rotation_xy(x, y):
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_multisample); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_frustrum.multisample = __pyx_t_1;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("_glarea.set_antialiasing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_9set_rotation_xy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_9set_rotation_xy = {__Pyx_NAMESTR("set_rotation_xy"), (PyCFunction)__pyx_pw_7_glarea_9set_rotation_xy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_9set_rotation_xy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_rotation_xy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
    PyObject* values[2] = {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  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__x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_rotation_xy", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_rotation_xy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_rotation_xy", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea.set_rotation_xy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_glarea_8set_rotation_xy(__pyx_self, __pyx_v_x, __pyx_v_y);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":204
 *     frustrum.multisample = multisample
 * 
 * def set_rotation_xy(x, y):             # <<<<<<<<<<<<<<
 *     x %= 360
 *     # pylint: disable=C0321
 */

static PyObject *__pyx_pf_7_glarea_8set_rotation_xy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  float __pyx_t_5;
  float __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_rotation_xy", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "_glarea.pyx":205
 * 
 * def set_rotation_xy(x, y):
 *     x %= 360             # <<<<<<<<<<<<<<
 *     # pylint: disable=C0321
 *     if y < -90:     y = -90
 */
  __pyx_t_1 = PyNumber_InPlaceRemainder(__pyx_v_x, __pyx_int_360); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_x);
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "_glarea.pyx":207
 *     x %= 360
 *     # pylint: disable=C0321
 *     if y < -90:     y = -90             # <<<<<<<<<<<<<<
 *     elif y > 90:    y = 90
 *     _set_modelview_matrix_rotation(M_PI * x / 180.0, M_PI * y / 180.0)
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_int_neg_90, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_int_neg_90);
    __Pyx_DECREF(__pyx_v_y);
    __pyx_v_y = __pyx_int_neg_90;
    goto __pyx_L3;
  }

  /* "_glarea.pyx":208
 *     # pylint: disable=C0321
 *     if y < -90:     y = -90
 *     elif y > 90:    y = 90             # <<<<<<<<<<<<<<
 *     _set_modelview_matrix_rotation(M_PI * x / 180.0, M_PI * y / 180.0)
 *     return x, y
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_int_90, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_int_90);
    __Pyx_DECREF(__pyx_v_y);
    __pyx_v_y = __pyx_int_90;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":209
 *     if y < -90:     y = -90
 *     elif y > 90:    y = 90
 *     _set_modelview_matrix_rotation(M_PI * x / 180.0, M_PI * y / 180.0)             # <<<<<<<<<<<<<<
 *     return x, y
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(180.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_v_y); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(180.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_f_7_glarea__set_modelview_matrix_rotation(__pyx_t_5, __pyx_t_6);

  /* "_glarea.pyx":210
 *     elif y > 90:    y = 90
 *     _set_modelview_matrix_rotation(M_PI * x / 180.0, M_PI * y / 180.0)
 *     return x, y             # <<<<<<<<<<<<<<
 * 
 * ### GL state
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_glarea.set_rotation_xy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":214
 * ### GL state
 * 
 * cdef void _gl_print_string(msg, GLenum name): #px/             # <<<<<<<<<<<<<<
 * #px def _gl_print_string(msg, name):
 *     print(msg, <char*>glGetString(name)) #px/
 */

static void __pyx_f_7_glarea__gl_print_string(PyObject *__pyx_v_msg, __pyx_t_2gl_GLenum __pyx_v_name) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_print_string", 0);

  /* "_glarea.pyx":216
 * cdef void _gl_print_string(msg, GLenum name): #px/
 * #px def _gl_print_string(msg, name):
 *     print(msg, <char*>glGetString(name)) #px/             # <<<<<<<<<<<<<<
 *     #px print(msg, glGetString(name))
 * 
 */
  __pyx_t_1 = PyBytes_FromString(((char *)glGetString(__pyx_v_name))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_msg);
  __Pyx_GIVEREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("_glarea._gl_print_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":219
 *     #px print(msg, glGetString(name))
 * 
 * cdef void _gl_print_float(msg, GLenum name): #px/             # <<<<<<<<<<<<<<
 * #px def _gl_print_float(msg, name):
 *     cdef GLfloat i #px+
 */

static void __pyx_f_7_glarea__gl_print_float(PyObject *__pyx_v_msg, __pyx_t_2gl_GLenum __pyx_v_name) {
  __pyx_t_2gl_GLfloat __pyx_v_i;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_print_float", 0);

  /* "_glarea.pyx":222
 * #px def _gl_print_float(msg, name):
 *     cdef GLfloat i #px+
 *     glGetFloatv(name, &i) #px/             # <<<<<<<<<<<<<<
 *     #px i = glGetFloatv(name)
 *     print(msg, i)
 */
  glGetFloatv(__pyx_v_name, (&__pyx_v_i));

  /* "_glarea.pyx":224
 *     glGetFloatv(name, &i) #px/
 *     #px i = glGetFloatv(name)
 *     print(msg, i)             # <<<<<<<<<<<<<<
 * 
 * cdef void _gl_print_integer(msg, GLenum name): #px/
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_msg);
  __Pyx_GIVEREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("_glarea._gl_print_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":226
 *     print(msg, i)
 * 
 * cdef void _gl_print_integer(msg, GLenum name): #px/             # <<<<<<<<<<<<<<
 * #px def _gl_print_integer(msg, name):
 *     cdef GLint i #px+
 */

static void __pyx_f_7_glarea__gl_print_integer(PyObject *__pyx_v_msg, __pyx_t_2gl_GLenum __pyx_v_name) {
  __pyx_t_2gl_GLint __pyx_v_i;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_print_integer", 0);

  /* "_glarea.pyx":229
 * #px def _gl_print_integer(msg, name):
 *     cdef GLint i #px+
 *     glGetIntegerv(name, &i) #px/             # <<<<<<<<<<<<<<
 *     #px i = glGetIntegerv(name)
 *     print(msg, i)
 */
  glGetIntegerv(__pyx_v_name, (&__pyx_v_i));

  /* "_glarea.pyx":231
 *     glGetIntegerv(name, &i) #px/
 *     #px i = glGetIntegerv(name)
 *     print(msg, i)             # <<<<<<<<<<<<<<
 * 
 * cdef void _gl_print_bool(msg, GLenum name): #px/
 */
  __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_msg);
  __Pyx_GIVEREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("_glarea._gl_print_integer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":233
 *     print(msg, i)
 * 
 * cdef void _gl_print_bool(msg, GLenum name): #px/             # <<<<<<<<<<<<<<
 * #px def _gl_print_bool(msg, name):
 *     cdef GLboolean i #px+
 */

static void __pyx_f_7_glarea__gl_print_bool(PyObject *__pyx_v_msg, __pyx_t_2gl_GLenum __pyx_v_name) {
  __pyx_t_2gl_GLboolean __pyx_v_i;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_print_bool", 0);

  /* "_glarea.pyx":236
 * #px def _gl_print_bool(msg, name):
 *     cdef GLboolean i #px+
 *     glGetBooleanv(name, &i) #px/             # <<<<<<<<<<<<<<
 *     #px i = glGetBooleanv(name)
 *     print(msg, i)
 */
  glGetBooleanv(__pyx_v_name, (&__pyx_v_i));

  /* "_glarea.pyx":238
 *     glGetBooleanv(name, &i) #px/
 *     #px i = glGetBooleanv(name)
 *     print(msg, i)             # <<<<<<<<<<<<<<
 * 
 * def gl_init():
 */
  __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_msg);
  __Pyx_GIVEREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("_glarea._gl_print_bool", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_11gl_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_11gl_init = {__Pyx_NAMESTR("gl_init"), (PyCFunction)__pyx_pw_7_glarea_11gl_init, METH_NOARGS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_11gl_init(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gl_init (wrapper)", 0);
  __pyx_r = __pyx_pf_7_glarea_10gl_init(__pyx_self);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":240
 *     print(msg, i)
 * 
 * def gl_init():             # <<<<<<<<<<<<<<
 *     if DEBUG_MSG:
 *         print('GL Strings:')
 */

static PyObject *__pyx_pf_7_glarea_10gl_init(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_init", 0);

  /* "_glarea.pyx":241
 * 
 * def gl_init():
 *     if DEBUG_MSG:             # <<<<<<<<<<<<<<
 *         print('GL Strings:')
 *         _gl_print_string('  GL Vendor:', GL_VENDOR)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEBUG_MSG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "_glarea.pyx":242
 * def gl_init():
 *     if DEBUG_MSG:
 *         print('GL Strings:')             # <<<<<<<<<<<<<<
 *         _gl_print_string('  GL Vendor:', GL_VENDOR)
 *         _gl_print_string('  GL Renderer:', GL_RENDERER)
 */
    __pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":243
 *     if DEBUG_MSG:
 *         print('GL Strings:')
 *         _gl_print_string('  GL Vendor:', GL_VENDOR)             # <<<<<<<<<<<<<<
 *         _gl_print_string('  GL Renderer:', GL_RENDERER)
 *         _gl_print_string('  GL Version:', GL_VERSION)
 */
    __pyx_t_1 = ((PyObject *)__pyx_kp_u_4);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_f_7_glarea__gl_print_string(__pyx_t_1, GL_VENDOR);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":244
 *         print('GL Strings:')
 *         _gl_print_string('  GL Vendor:', GL_VENDOR)
 *         _gl_print_string('  GL Renderer:', GL_RENDERER)             # <<<<<<<<<<<<<<
 *         _gl_print_string('  GL Version:', GL_VERSION)
 *         _gl_print_string('  GL Shading Language Version:', GL_SHADING_LANGUAGE_VERSION)
 */
    __pyx_t_1 = ((PyObject *)__pyx_kp_u_5);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_f_7_glarea__gl_print_string(__pyx_t_1, GL_RENDERER);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":245
 *         _gl_print_string('  GL Vendor:', GL_VENDOR)
 *         _gl_print_string('  GL Renderer:', GL_RENDERER)
 *         _gl_print_string('  GL Version:', GL_VERSION)             # <<<<<<<<<<<<<<
 *         _gl_print_string('  GL Shading Language Version:', GL_SHADING_LANGUAGE_VERSION)
 *         #_gl_print_string('  GL Extensions:', GL_EXTENSIONS)
 */
    __pyx_t_1 = ((PyObject *)__pyx_kp_u_6);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_f_7_glarea__gl_print_string(__pyx_t_1, GL_VERSION);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":246
 *         _gl_print_string('  GL Renderer:', GL_RENDERER)
 *         _gl_print_string('  GL Version:', GL_VERSION)
 *         _gl_print_string('  GL Shading Language Version:', GL_SHADING_LANGUAGE_VERSION)             # <<<<<<<<<<<<<<
 *         #_gl_print_string('  GL Extensions:', GL_EXTENSIONS)
 *         _gl_print_integer('  GL_SAMPLE_BUFFERS:', GL_SAMPLE_BUFFERS)
 */
    __pyx_t_1 = ((PyObject *)__pyx_kp_u_7);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_f_7_glarea__gl_print_string(__pyx_t_1, GL_SHADING_LANGUAGE_VERSION);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":248
 *         _gl_print_string('  GL Shading Language Version:', GL_SHADING_LANGUAGE_VERSION)
 *         #_gl_print_string('  GL Extensions:', GL_EXTENSIONS)
 *         _gl_print_integer('  GL_SAMPLE_BUFFERS:', GL_SAMPLE_BUFFERS)             # <<<<<<<<<<<<<<
 *         _gl_print_float('  GL_SAMPLE_COVERAGE_VALUE:', GL_SAMPLE_COVERAGE_VALUE)
 *         _gl_print_bool('  GL_SAMPLE_COVERAGE_INVERT:', GL_SAMPLE_COVERAGE_INVERT)
 */
    __pyx_t_1 = ((PyObject *)__pyx_kp_u_8);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_f_7_glarea__gl_print_integer(__pyx_t_1, GL_SAMPLE_BUFFERS);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":249
 *         #_gl_print_string('  GL Extensions:', GL_EXTENSIONS)
 *         _gl_print_integer('  GL_SAMPLE_BUFFERS:', GL_SAMPLE_BUFFERS)
 *         _gl_print_float('  GL_SAMPLE_COVERAGE_VALUE:', GL_SAMPLE_COVERAGE_VALUE)             # <<<<<<<<<<<<<<
 *         _gl_print_bool('  GL_SAMPLE_COVERAGE_INVERT:', GL_SAMPLE_COVERAGE_INVERT)
 *         _gl_print_integer('  GL_SAMPLES:', GL_SAMPLES)
 */
    __pyx_t_1 = ((PyObject *)__pyx_kp_u_9);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_f_7_glarea__gl_print_float(__pyx_t_1, GL_SAMPLE_COVERAGE_VALUE);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":250
 *         _gl_print_integer('  GL_SAMPLE_BUFFERS:', GL_SAMPLE_BUFFERS)
 *         _gl_print_float('  GL_SAMPLE_COVERAGE_VALUE:', GL_SAMPLE_COVERAGE_VALUE)
 *         _gl_print_bool('  GL_SAMPLE_COVERAGE_INVERT:', GL_SAMPLE_COVERAGE_INVERT)             # <<<<<<<<<<<<<<
 *         _gl_print_integer('  GL_SAMPLES:', GL_SAMPLES)
 *         IF SOURCEGLVERSION == 'GL': #px/
 */
    __pyx_t_1 = ((PyObject *)__pyx_kp_u_10);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_f_7_glarea__gl_print_bool(__pyx_t_1, GL_SAMPLE_COVERAGE_INVERT);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":251
 *         _gl_print_float('  GL_SAMPLE_COVERAGE_VALUE:', GL_SAMPLE_COVERAGE_VALUE)
 *         _gl_print_bool('  GL_SAMPLE_COVERAGE_INVERT:', GL_SAMPLE_COVERAGE_INVERT)
 *         _gl_print_integer('  GL_SAMPLES:', GL_SAMPLES)             # <<<<<<<<<<<<<<
 *         IF SOURCEGLVERSION == 'GL': #px/
 *         #px if True:
 */
    __pyx_t_1 = ((PyObject *)__pyx_kp_u_11);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_f_7_glarea__gl_print_integer(__pyx_t_1, GL_SAMPLES);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":254
 *         IF SOURCEGLVERSION == 'GL': #px/
 *         #px if True:
 *             print('  GL_MULTISAMPLE:', glIsEnabled(GL_MULTISAMPLE))             # <<<<<<<<<<<<<<
 *         print('  GL_SAMPLE_ALPHA_TO_COVERAGE:', glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE))
 *         #print('  GL_SAMPLE_ALPHA_TO_ONE:', glIsEnabled(GL_SAMPLE_ALPHA_TO_ONE))
 */
    __pyx_t_1 = PyInt_FromLong(glIsEnabled(GL_MULTISAMPLE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_12));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_12));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":255
 *         #px if True:
 *             print('  GL_MULTISAMPLE:', glIsEnabled(GL_MULTISAMPLE))
 *         print('  GL_SAMPLE_ALPHA_TO_COVERAGE:', glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE))             # <<<<<<<<<<<<<<
 *         #print('  GL_SAMPLE_ALPHA_TO_ONE:', glIsEnabled(GL_SAMPLE_ALPHA_TO_ONE))
 *         print('  GL_SAMPLE_COVERAGE:', glIsEnabled(GL_SAMPLE_COVERAGE))
 */
    __pyx_t_1 = PyInt_FromLong(glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_13));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_13));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":257
 *         print('  GL_SAMPLE_ALPHA_TO_COVERAGE:', glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE))
 *         #print('  GL_SAMPLE_ALPHA_TO_ONE:', glIsEnabled(GL_SAMPLE_ALPHA_TO_ONE))
 *         print('  GL_SAMPLE_COVERAGE:', glIsEnabled(GL_SAMPLE_COVERAGE))             # <<<<<<<<<<<<<<
 *     glClearColor(0., 0., 0., 1.)
 *     glEnable(GL_DEPTH_TEST)
 */
    __pyx_t_1 = PyInt_FromLong(glIsEnabled(GL_SAMPLE_COVERAGE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_14));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_14));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_14));
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":258
 *         #print('  GL_SAMPLE_ALPHA_TO_ONE:', glIsEnabled(GL_SAMPLE_ALPHA_TO_ONE))
 *         print('  GL_SAMPLE_COVERAGE:', glIsEnabled(GL_SAMPLE_COVERAGE))
 *     glClearColor(0., 0., 0., 1.)             # <<<<<<<<<<<<<<
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE) # Rasterise only the exterior faces,  to speed things up
 */
  glClearColor(0., 0., 0., 1.);

  /* "_glarea.pyx":259
 *         print('  GL_SAMPLE_COVERAGE:', glIsEnabled(GL_SAMPLE_COVERAGE))
 *     glClearColor(0., 0., 0., 1.)
 *     glEnable(GL_DEPTH_TEST)             # <<<<<<<<<<<<<<
 *     glEnable(GL_CULL_FACE) # Rasterise only the exterior faces,  to speed things up
 *     glCullFace(GL_BACK)
 */
  glEnable(GL_DEPTH_TEST);

  /* "_glarea.pyx":260
 *     glClearColor(0., 0., 0., 1.)
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE) # Rasterise only the exterior faces,  to speed things up             # <<<<<<<<<<<<<<
 *     glCullFace(GL_BACK)
 *     glFrontFace(GL_CCW)
 */
  glEnable(GL_CULL_FACE);

  /* "_glarea.pyx":261
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE) # Rasterise only the exterior faces,  to speed things up
 *     glCullFace(GL_BACK)             # <<<<<<<<<<<<<<
 *     glFrontFace(GL_CCW)
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 */
  glCullFace(GL_BACK);

  /* "_glarea.pyx":262
 *     glEnable(GL_CULL_FACE) # Rasterise only the exterior faces,  to speed things up
 *     glCullFace(GL_BACK)
 *     glFrontFace(GL_CCW)             # <<<<<<<<<<<<<<
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *     gl_init_buffers()
 */
  glFrontFace(GL_CCW);

  /* "_glarea.pyx":263
 *     glCullFace(GL_BACK)
 *     glFrontFace(GL_CCW)
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)             # <<<<<<<<<<<<<<
 *     gl_init_buffers()
 * 
 */
  glClear((GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));

  /* "_glarea.pyx":264
 *     glFrontFace(GL_CCW)
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *     gl_init_buffers()             # <<<<<<<<<<<<<<
 * 
 * def gl_exit():
 */
  __pyx_f_7_gldraw_gl_init_buffers();

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_glarea.gl_init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_13gl_exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_13gl_exit = {__Pyx_NAMESTR("gl_exit"), (PyCFunction)__pyx_pw_7_glarea_13gl_exit, METH_NOARGS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_13gl_exit(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gl_exit (wrapper)", 0);
  __pyx_r = __pyx_pf_7_glarea_12gl_exit(__pyx_self);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":266
 *     gl_init_buffers()
 * 
 * def gl_exit():             # <<<<<<<<<<<<<<
 *     gl_delete_buffers()
 *     cdef GLuint prog #px+
 */

static PyObject *__pyx_pf_7_glarea_12gl_exit(CYTHON_UNUSED PyObject *__pyx_self) {
  __pyx_t_2gl_GLuint __pyx_v_prog;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  __pyx_t_2gl_GLuint __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_exit", 0);

  /* "_glarea.pyx":267
 * 
 * def gl_exit():
 *     gl_delete_buffers()             # <<<<<<<<<<<<<<
 *     cdef GLuint prog #px+
 *     for prog in [program.prog_render, program.prog_hud, program.prog_pick]:
 */
  __pyx_f_7_gldraw_gl_delete_buffers();

  /* "_glarea.pyx":269
 *     gl_delete_buffers()
 *     cdef GLuint prog #px+
 *     for prog in [program.prog_render, program.prog_hud, program.prog_pick]:             # <<<<<<<<<<<<<<
 *         if prog > 0:
 *             glDeleteProgram(prog)
 */
  __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_7_glarea_program.prog_render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_7_glarea_program.prog_hud); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_7_glarea_program.prog_pick); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyList_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = ((PyObject *)__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __pyx_t_6 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_prog = __pyx_t_6;

    /* "_glarea.pyx":270
 *     cdef GLuint prog #px+
 *     for prog in [program.prog_render, program.prog_hud, program.prog_pick]:
 *         if prog > 0:             # <<<<<<<<<<<<<<
 *             glDeleteProgram(prog)
 *     program.prog_render = 0
 */
    __pyx_t_7 = (__pyx_v_prog > 0);
    if (__pyx_t_7) {

      /* "_glarea.pyx":271
 *     for prog in [program.prog_render, program.prog_hud, program.prog_pick]:
 *         if prog > 0:
 *             glDeleteProgram(prog)             # <<<<<<<<<<<<<<
 *     program.prog_render = 0
 *     program.prog_hud = 0
 */
      glDeleteProgram(__pyx_v_prog);
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_glarea.pyx":272
 *         if prog > 0:
 *             glDeleteProgram(prog)
 *     program.prog_render = 0             # <<<<<<<<<<<<<<
 *     program.prog_hud = 0
 *     program.prog_pick = 0
 */
  __pyx_v_7_glarea_program.prog_render = 0;

  /* "_glarea.pyx":273
 *             glDeleteProgram(prog)
 *     program.prog_render = 0
 *     program.prog_hud = 0             # <<<<<<<<<<<<<<
 *     program.prog_pick = 0
 * 
 */
  __pyx_v_7_glarea_program.prog_hud = 0;

  /* "_glarea.pyx":274
 *     program.prog_render = 0
 *     program.prog_hud = 0
 *     program.prog_pick = 0             # <<<<<<<<<<<<<<
 * 
 * def gl_resize(width, height):
 */
  __pyx_v_7_glarea_program.prog_pick = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_glarea.gl_exit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_15gl_resize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_15gl_resize = {__Pyx_NAMESTR("gl_resize"), (PyCFunction)__pyx_pw_7_glarea_15gl_resize, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_15gl_resize(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_v_height = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gl_resize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__width,&__pyx_n_s__height,0};
    PyObject* values[2] = {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  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__width)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gl_resize", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gl_resize") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_width = values[0];
    __pyx_v_height = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gl_resize", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea.gl_resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_glarea_14gl_resize(__pyx_self, __pyx_v_width, __pyx_v_height);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":276
 *     program.prog_pick = 0
 * 
 * def gl_resize(width, height):             # <<<<<<<<<<<<<<
 *     terrain.width = width
 *     terrain.height = height
 */

static PyObject *__pyx_pf_7_glarea_14gl_resize(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_width, PyObject *__pyx_v_height) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_resize", 0);

  /* "_glarea.pyx":277
 * 
 * def gl_resize(width, height):
 *     terrain.width = width             # <<<<<<<<<<<<<<
 *     terrain.height = height
 *     glViewport(0, 0, terrain.width, terrain.height)
 */
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_width); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_terrain.width = __pyx_t_1;

  /* "_glarea.pyx":278
 * def gl_resize(width, height):
 *     terrain.width = width
 *     terrain.height = height             # <<<<<<<<<<<<<<
 *     glViewport(0, 0, terrain.width, terrain.height)
 *     _update_projection_matrix()
 */
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_height); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_terrain.height = __pyx_t_1;

  /* "_glarea.pyx":279
 *     terrain.width = width
 *     terrain.height = height
 *     glViewport(0, 0, terrain.width, terrain.height)             # <<<<<<<<<<<<<<
 *     _update_projection_matrix()
 * 
 */
  glViewport(0, 0, __pyx_v_7_glarea_terrain.width, __pyx_v_7_glarea_terrain.height);

  /* "_glarea.pyx":280
 *     terrain.height = height
 *     glViewport(0, 0, terrain.width, terrain.height)
 *     _update_projection_matrix()             # <<<<<<<<<<<<<<
 * 
 * ### render functions
 */
  __pyx_f_7_glarea__update_projection_matrix();

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("_glarea.gl_resize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":284
 * ### render functions
 * 
 * cdef void _gl_set_matrix(GLint location, mat4 &matrix): #px/             # <<<<<<<<<<<<<<
 * #px def _gl_set_matrix(location, matrix):
 *     glUniformMatrix4fv(location, 1, GL_FALSE, &matrix[0][0]) #px/
 */

static void __pyx_f_7_glarea__gl_set_matrix(__pyx_t_2gl_GLint __pyx_v_location, glm::mat4 &__pyx_v_matrix) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_gl_set_matrix", 0);

  /* "_glarea.pyx":286
 * cdef void _gl_set_matrix(GLint location, mat4 &matrix): #px/
 * #px def _gl_set_matrix(location, matrix):
 *     glUniformMatrix4fv(location, 1, GL_FALSE, &matrix[0][0]) #px/             # <<<<<<<<<<<<<<
 *     #px glUniformMatrix4fv(location, 1, GL_FALSE, matrix)
 * 
 */
  glUniformMatrix4fv(__pyx_v_location, 1, GL_FALSE, (&((__pyx_v_matrix[0])[0])));

  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_17gl_render(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_17gl_render = {__Pyx_NAMESTR("gl_render"), (PyCFunction)__pyx_pw_7_glarea_17gl_render, METH_NOARGS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_17gl_render(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gl_render (wrapper)", 0);
  __pyx_r = __pyx_pf_7_glarea_16gl_render(__pyx_self);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":289
 *     #px glUniformMatrix4fv(location, 1, GL_FALSE, matrix)
 * 
 * def gl_render():             # <<<<<<<<<<<<<<
 *     if DEBUG_PICK:
 *         _set_picking_matrix_identity()
 */

static PyObject *__pyx_pf_7_glarea_16gl_render(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_render", 0);

  /* "_glarea.pyx":290
 * 
 * def gl_render():
 *     if DEBUG_PICK:             # <<<<<<<<<<<<<<
 *         _set_picking_matrix_identity()
 *         _gl_render_pick()
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEBUG_PICK); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "_glarea.pyx":291
 * def gl_render():
 *     if DEBUG_PICK:
 *         _set_picking_matrix_identity()             # <<<<<<<<<<<<<<
 *         _gl_render_pick()
 *     else:
 */
    __pyx_f_7_glarea__set_picking_matrix_identity();

    /* "_glarea.pyx":292
 *     if DEBUG_PICK:
 *         _set_picking_matrix_identity()
 *         _gl_render_pick()             # <<<<<<<<<<<<<<
 *     else:
 *         glUseProgram(program.prog_render)
 */
    __pyx_f_7_glarea__gl_render_pick();
    goto __pyx_L3;
  }
  /*else*/ {

    /* "_glarea.pyx":294
 *         _gl_render_pick()
 *     else:
 *         glUseProgram(program.prog_render)             # <<<<<<<<<<<<<<
 *         IF SOURCEGLVERSION == 'GL': #px/
 *         #px if True:
 */
    glUseProgram(__pyx_v_7_glarea_program.prog_render);

    /* "_glarea.pyx":297
 *         IF SOURCEGLVERSION == 'GL': #px/
 *         #px if True:
 *             if frustrum.multisample:             # <<<<<<<<<<<<<<
 *                 glEnable(GL_MULTISAMPLE)
 *             else:
 */
    if (__pyx_v_7_glarea_frustrum.multisample) {

      /* "_glarea.pyx":298
 *         #px if True:
 *             if frustrum.multisample:
 *                 glEnable(GL_MULTISAMPLE)             # <<<<<<<<<<<<<<
 *             else:
 *                 glDisable(GL_MULTISAMPLE)
 */
      glEnable(GL_MULTISAMPLE);
      goto __pyx_L4;
    }
    /*else*/ {

      /* "_glarea.pyx":300
 *                 glEnable(GL_MULTISAMPLE)
 *             else:
 *                 glDisable(GL_MULTISAMPLE)             # <<<<<<<<<<<<<<
 *         glClearColor(terrain.red, terrain.green, terrain.blue, 1.)
 *         _gl_set_matrix(program.projection_location, frustrum.projection_matrix)
 */
      glDisable(GL_MULTISAMPLE);
    }
    __pyx_L4:;

    /* "_glarea.pyx":301
 *             else:
 *                 glDisable(GL_MULTISAMPLE)
 *         glClearColor(terrain.red, terrain.green, terrain.blue, 1.)             # <<<<<<<<<<<<<<
 *         _gl_set_matrix(program.projection_location, frustrum.projection_matrix)
 *         _gl_set_matrix(program.modelview_location, frustrum.modelview_matrix)
 */
    glClearColor(__pyx_v_7_glarea_terrain.red, __pyx_v_7_glarea_terrain.green, __pyx_v_7_glarea_terrain.blue, 1.);

    /* "_glarea.pyx":302
 *                 glDisable(GL_MULTISAMPLE)
 *         glClearColor(terrain.red, terrain.green, terrain.blue, 1.)
 *         _gl_set_matrix(program.projection_location, frustrum.projection_matrix)             # <<<<<<<<<<<<<<
 *         _gl_set_matrix(program.modelview_location, frustrum.modelview_matrix)
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 */
    __pyx_f_7_glarea__gl_set_matrix(__pyx_v_7_glarea_program.projection_location, __pyx_v_7_glarea_frustrum.projection_matrix);

    /* "_glarea.pyx":303
 *         glClearColor(terrain.red, terrain.green, terrain.blue, 1.)
 *         _gl_set_matrix(program.projection_location, frustrum.projection_matrix)
 *         _gl_set_matrix(program.modelview_location, frustrum.modelview_matrix)             # <<<<<<<<<<<<<<
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *         gl_draw_cube()
 */
    __pyx_f_7_glarea__gl_set_matrix(__pyx_v_7_glarea_program.modelview_location, __pyx_v_7_glarea_frustrum.modelview_matrix);

    /* "_glarea.pyx":304
 *         _gl_set_matrix(program.projection_location, frustrum.projection_matrix)
 *         _gl_set_matrix(program.modelview_location, frustrum.modelview_matrix)
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)             # <<<<<<<<<<<<<<
 *         gl_draw_cube()
 *     if DEBUG_DRAW:
 */
    glClear((GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));

    /* "_glarea.pyx":305
 *         _gl_set_matrix(program.modelview_location, frustrum.modelview_matrix)
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *         gl_draw_cube()             # <<<<<<<<<<<<<<
 *     if DEBUG_DRAW:
 *         gl_draw_cube_debug()
 */
    __pyx_f_7_gldraw_gl_draw_cube();
  }
  __pyx_L3:;

  /* "_glarea.pyx":306
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *         gl_draw_cube()
 *     if DEBUG_DRAW:             # <<<<<<<<<<<<<<
 *         gl_draw_cube_debug()
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEBUG_DRAW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "_glarea.pyx":307
 *         gl_draw_cube()
 *     if DEBUG_DRAW:
 *         gl_draw_cube_debug()             # <<<<<<<<<<<<<<
 * 
 * def gl_render_select_debug():
 */
    __pyx_f_7_gldraw_gl_draw_cube_debug();
    goto __pyx_L5;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("_glarea.gl_render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_19gl_render_select_debug(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_19gl_render_select_debug = {__Pyx_NAMESTR("gl_render_select_debug"), (PyCFunction)__pyx_pw_7_glarea_19gl_render_select_debug, METH_NOARGS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_19gl_render_select_debug(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gl_render_select_debug (wrapper)", 0);
  __pyx_r = __pyx_pf_7_glarea_18gl_render_select_debug(__pyx_self);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":309
 *         gl_draw_cube_debug()
 * 
 * def gl_render_select_debug():             # <<<<<<<<<<<<<<
 *     cdef GLfloat selectdata[12] #px+
 *     selectdata[0] = selection_debug_points.modelview1[0]
 */

static PyObject *__pyx_pf_7_glarea_18gl_render_select_debug(CYTHON_UNUSED PyObject *__pyx_self) {
  __pyx_t_2gl_GLfloat __pyx_v_selectdata[12];
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_render_select_debug", 0);

  /* "_glarea.pyx":311
 * def gl_render_select_debug():
 *     cdef GLfloat selectdata[12] #px+
 *     selectdata[0] = selection_debug_points.modelview1[0]             # <<<<<<<<<<<<<<
 *     selectdata[1] = selection_debug_points.modelview1[1]
 *     selectdata[2] = selection_debug_points.modelview1[2]
 */
  (__pyx_v_selectdata[0]) = (__pyx_v_7_glarea_selection_debug_points.modelview1[0]);

  /* "_glarea.pyx":312
 *     cdef GLfloat selectdata[12] #px+
 *     selectdata[0] = selection_debug_points.modelview1[0]
 *     selectdata[1] = selection_debug_points.modelview1[1]             # <<<<<<<<<<<<<<
 *     selectdata[2] = selection_debug_points.modelview1[2]
 *     selectdata[3] = selection_debug_points.modelview2[0]
 */
  (__pyx_v_selectdata[1]) = (__pyx_v_7_glarea_selection_debug_points.modelview1[1]);

  /* "_glarea.pyx":313
 *     selectdata[0] = selection_debug_points.modelview1[0]
 *     selectdata[1] = selection_debug_points.modelview1[1]
 *     selectdata[2] = selection_debug_points.modelview1[2]             # <<<<<<<<<<<<<<
 *     selectdata[3] = selection_debug_points.modelview2[0]
 *     selectdata[4] = selection_debug_points.modelview2[1]
 */
  (__pyx_v_selectdata[2]) = (__pyx_v_7_glarea_selection_debug_points.modelview1[2]);

  /* "_glarea.pyx":314
 *     selectdata[1] = selection_debug_points.modelview1[1]
 *     selectdata[2] = selection_debug_points.modelview1[2]
 *     selectdata[3] = selection_debug_points.modelview2[0]             # <<<<<<<<<<<<<<
 *     selectdata[4] = selection_debug_points.modelview2[1]
 *     selectdata[5] = selection_debug_points.modelview2[2]
 */
  (__pyx_v_selectdata[3]) = (__pyx_v_7_glarea_selection_debug_points.modelview2[0]);

  /* "_glarea.pyx":315
 *     selectdata[2] = selection_debug_points.modelview1[2]
 *     selectdata[3] = selection_debug_points.modelview2[0]
 *     selectdata[4] = selection_debug_points.modelview2[1]             # <<<<<<<<<<<<<<
 *     selectdata[5] = selection_debug_points.modelview2[2]
 *     selectdata[6] = selection_debug_points.viewport1[0] / terrain.width * 2 - 1
 */
  (__pyx_v_selectdata[4]) = (__pyx_v_7_glarea_selection_debug_points.modelview2[1]);

  /* "_glarea.pyx":316
 *     selectdata[3] = selection_debug_points.modelview2[0]
 *     selectdata[4] = selection_debug_points.modelview2[1]
 *     selectdata[5] = selection_debug_points.modelview2[2]             # <<<<<<<<<<<<<<
 *     selectdata[6] = selection_debug_points.viewport1[0] / terrain.width * 2 - 1
 *     selectdata[7] = selection_debug_points.viewport1[1] / terrain.height * 2 - 1
 */
  (__pyx_v_selectdata[5]) = (__pyx_v_7_glarea_selection_debug_points.modelview2[2]);

  /* "_glarea.pyx":317
 *     selectdata[4] = selection_debug_points.modelview2[1]
 *     selectdata[5] = selection_debug_points.modelview2[2]
 *     selectdata[6] = selection_debug_points.viewport1[0] / terrain.width * 2 - 1             # <<<<<<<<<<<<<<
 *     selectdata[7] = selection_debug_points.viewport1[1] / terrain.height * 2 - 1
 *     selectdata[8] = 0
 */
  if (unlikely(__pyx_v_7_glarea_terrain.width == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  (__pyx_v_selectdata[6]) = (((((double)(__pyx_v_7_glarea_selection_debug_points.viewport1[0])) / ((double)__pyx_v_7_glarea_terrain.width)) * 2.0) - 1.0);

  /* "_glarea.pyx":318
 *     selectdata[5] = selection_debug_points.modelview2[2]
 *     selectdata[6] = selection_debug_points.viewport1[0] / terrain.width * 2 - 1
 *     selectdata[7] = selection_debug_points.viewport1[1] / terrain.height * 2 - 1             # <<<<<<<<<<<<<<
 *     selectdata[8] = 0
 *     selectdata[9] = selection_debug_points.viewport2[0] / terrain.width * 2 - 1
 */
  if (unlikely(__pyx_v_7_glarea_terrain.height == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  (__pyx_v_selectdata[7]) = (((((double)(__pyx_v_7_glarea_selection_debug_points.viewport1[1])) / ((double)__pyx_v_7_glarea_terrain.height)) * 2.0) - 1.0);

  /* "_glarea.pyx":319
 *     selectdata[6] = selection_debug_points.viewport1[0] / terrain.width * 2 - 1
 *     selectdata[7] = selection_debug_points.viewport1[1] / terrain.height * 2 - 1
 *     selectdata[8] = 0             # <<<<<<<<<<<<<<
 *     selectdata[9] = selection_debug_points.viewport2[0] / terrain.width * 2 - 1
 *     selectdata[10] = selection_debug_points.viewport2[1] / terrain.height * 2 - 1
 */
  (__pyx_v_selectdata[8]) = 0.0;

  /* "_glarea.pyx":320
 *     selectdata[7] = selection_debug_points.viewport1[1] / terrain.height * 2 - 1
 *     selectdata[8] = 0
 *     selectdata[9] = selection_debug_points.viewport2[0] / terrain.width * 2 - 1             # <<<<<<<<<<<<<<
 *     selectdata[10] = selection_debug_points.viewport2[1] / terrain.height * 2 - 1
 *     selectdata[11] = 0
 */
  if (unlikely(__pyx_v_7_glarea_terrain.width == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  (__pyx_v_selectdata[9]) = (((((double)(__pyx_v_7_glarea_selection_debug_points.viewport2[0])) / ((double)__pyx_v_7_glarea_terrain.width)) * 2.0) - 1.0);

  /* "_glarea.pyx":321
 *     selectdata[8] = 0
 *     selectdata[9] = selection_debug_points.viewport2[0] / terrain.width * 2 - 1
 *     selectdata[10] = selection_debug_points.viewport2[1] / terrain.height * 2 - 1             # <<<<<<<<<<<<<<
 *     selectdata[11] = 0
 *     gl_draw_select_debug(&selectdata[0], sizeof(selectdata), program.prog_hud) #px/
 */
  if (unlikely(__pyx_v_7_glarea_terrain.height == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  (__pyx_v_selectdata[10]) = (((((double)(__pyx_v_7_glarea_selection_debug_points.viewport2[1])) / ((double)__pyx_v_7_glarea_terrain.height)) * 2.0) - 1.0);

  /* "_glarea.pyx":322
 *     selectdata[9] = selection_debug_points.viewport2[0] / terrain.width * 2 - 1
 *     selectdata[10] = selection_debug_points.viewport2[1] / terrain.height * 2 - 1
 *     selectdata[11] = 0             # <<<<<<<<<<<<<<
 *     gl_draw_select_debug(&selectdata[0], sizeof(selectdata), program.prog_hud) #px/
 *     #px gl_draw_select_debug(selectdata, sizeof(selectdata), program.prog_hud)
 */
  (__pyx_v_selectdata[11]) = 0.0;

  /* "_glarea.pyx":323
 *     selectdata[10] = selection_debug_points.viewport2[1] / terrain.height * 2 - 1
 *     selectdata[11] = 0
 *     gl_draw_select_debug(&selectdata[0], sizeof(selectdata), program.prog_hud) #px/             # <<<<<<<<<<<<<<
 *     #px gl_draw_select_debug(selectdata, sizeof(selectdata), program.prog_hud)
 * 
 */
  __pyx_f_7_gldraw_gl_draw_select_debug((&(__pyx_v_selectdata[0])), (sizeof(__pyx_v_selectdata)), __pyx_v_7_glarea_program.prog_hud);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("_glarea.gl_render_select_debug", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":329
 * ### picking functions
 * 
 * cdef void _gl_render_pick(): #px/             # <<<<<<<<<<<<<<
 * #px def _gl_render_pick():
 *     glUseProgram(program.prog_pick)
 */

static void __pyx_f_7_glarea__gl_render_pick(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_gl_render_pick", 0);

  /* "_glarea.pyx":331
 * cdef void _gl_render_pick(): #px/
 * #px def _gl_render_pick():
 *     glUseProgram(program.prog_pick)             # <<<<<<<<<<<<<<
 *     IF SOURCEGLVERSION == 'GL': #px/
 *     #px if True:
 */
  glUseProgram(__pyx_v_7_glarea_program.prog_pick);

  /* "_glarea.pyx":334
 *     IF SOURCEGLVERSION == 'GL': #px/
 *     #px if True:
 *         glDisable(GL_MULTISAMPLE)             # <<<<<<<<<<<<<<
 *     glClearColor(0., 0., 0., 1.)
 *     _gl_set_matrix(program.picking_location, frustrum.picking_matrix)
 */
  glDisable(GL_MULTISAMPLE);

  /* "_glarea.pyx":335
 *     #px if True:
 *         glDisable(GL_MULTISAMPLE)
 *     glClearColor(0., 0., 0., 1.)             # <<<<<<<<<<<<<<
 *     _gl_set_matrix(program.picking_location, frustrum.picking_matrix)
 *     _gl_set_matrix(program.projection_pick_location, frustrum.projection_matrix)
 */
  glClearColor(0., 0., 0., 1.);

  /* "_glarea.pyx":336
 *         glDisable(GL_MULTISAMPLE)
 *     glClearColor(0., 0., 0., 1.)
 *     _gl_set_matrix(program.picking_location, frustrum.picking_matrix)             # <<<<<<<<<<<<<<
 *     _gl_set_matrix(program.projection_pick_location, frustrum.projection_matrix)
 *     _gl_set_matrix(program.modelview_pick_location, frustrum.modelview_matrix)
 */
  __pyx_f_7_glarea__gl_set_matrix(__pyx_v_7_glarea_program.picking_location, __pyx_v_7_glarea_frustrum.picking_matrix);

  /* "_glarea.pyx":337
 *     glClearColor(0., 0., 0., 1.)
 *     _gl_set_matrix(program.picking_location, frustrum.picking_matrix)
 *     _gl_set_matrix(program.projection_pick_location, frustrum.projection_matrix)             # <<<<<<<<<<<<<<
 *     _gl_set_matrix(program.modelview_pick_location, frustrum.modelview_matrix)
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 */
  __pyx_f_7_glarea__gl_set_matrix(__pyx_v_7_glarea_program.projection_pick_location, __pyx_v_7_glarea_frustrum.projection_matrix);

  /* "_glarea.pyx":338
 *     _gl_set_matrix(program.picking_location, frustrum.picking_matrix)
 *     _gl_set_matrix(program.projection_pick_location, frustrum.projection_matrix)
 *     _gl_set_matrix(program.modelview_pick_location, frustrum.modelview_matrix)             # <<<<<<<<<<<<<<
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *     gl_pick_cube()
 */
  __pyx_f_7_glarea__gl_set_matrix(__pyx_v_7_glarea_program.modelview_pick_location, __pyx_v_7_glarea_frustrum.modelview_matrix);

  /* "_glarea.pyx":339
 *     _gl_set_matrix(program.projection_pick_location, frustrum.projection_matrix)
 *     _gl_set_matrix(program.modelview_pick_location, frustrum.modelview_matrix)
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)             # <<<<<<<<<<<<<<
 *     gl_pick_cube()
 * 
 */
  glClear((GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));

  /* "_glarea.pyx":340
 *     _gl_set_matrix(program.modelview_pick_location, frustrum.modelview_matrix)
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *     gl_pick_cube()             # <<<<<<<<<<<<<<
 * 
 * cpdef gl_pick_polygons(int x, int y): #px/
 */
  __pyx_f_7_gldraw_gl_pick_cube();

  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":342
 *     gl_pick_cube()
 * 
 * cpdef gl_pick_polygons(int x, int y): #px/             # <<<<<<<<<<<<<<
 * #px def gl_pick_polygons(x, y):
 *     cdef unsigned char pixel[3] #px+
 */

static PyObject *__pyx_pw_7_glarea_21gl_pick_polygons(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_7_glarea_gl_pick_polygons(int __pyx_v_x, int __pyx_v_y, CYTHON_UNUSED int __pyx_skip_dispatch) {
  unsigned char __pyx_v_pixel[3];
  long __pyx_v_index;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_pick_polygons", 0);

  /* "_glarea.pyx":346
 *     cdef unsigned char pixel[3] #px+
 * 
 *     if not (0 <= x < terrain.width and 0 <= y < terrain.height):             # <<<<<<<<<<<<<<
 *         return 0
 *     _set_picking_matrix(x, y)
 */
  __pyx_t_1 = (0 <= __pyx_v_x);
  if (__pyx_t_1) {
    __pyx_t_1 = (__pyx_v_x < __pyx_v_7_glarea_terrain.width);
  }
  if (__pyx_t_1) {
    __pyx_t_2 = (0 <= __pyx_v_y);
    if (__pyx_t_2) {
      __pyx_t_2 = (__pyx_v_y < __pyx_v_7_glarea_terrain.height);
    }
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  __pyx_t_1 = (!__pyx_t_3);
  if (__pyx_t_1) {

    /* "_glarea.pyx":347
 * 
 *     if not (0 <= x < terrain.width and 0 <= y < terrain.height):
 *         return 0             # <<<<<<<<<<<<<<
 *     _set_picking_matrix(x, y)
 *     _gl_render_pick()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":348
 *     if not (0 <= x < terrain.width and 0 <= y < terrain.height):
 *         return 0
 *     _set_picking_matrix(x, y)             # <<<<<<<<<<<<<<
 *     _gl_render_pick()
 *     glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, pixel) #px/
 */
  __pyx_f_7_glarea__set_picking_matrix(__pyx_v_x, __pyx_v_y);

  /* "_glarea.pyx":349
 *         return 0
 *     _set_picking_matrix(x, y)
 *     _gl_render_pick()             # <<<<<<<<<<<<<<
 *     glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, pixel) #px/
 *     #px pixel = glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, [[[0, 0, 0]]])[0][0]
 */
  __pyx_f_7_glarea__gl_render_pick();

  /* "_glarea.pyx":350
 *     _set_picking_matrix(x, y)
 *     _gl_render_pick()
 *     glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, pixel) #px/             # <<<<<<<<<<<<<<
 *     #px pixel = glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, [[[0, 0, 0]]])[0][0]
 *     index = pixel[0]<<4 | pixel[1] | pixel[2]>>4
 */
  glReadPixels(__pyx_v_x, __pyx_v_y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, __pyx_v_pixel);

  /* "_glarea.pyx":352
 *     glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, pixel) #px/
 *     #px pixel = glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, [[[0, 0, 0]]])[0][0]
 *     index = pixel[0]<<4 | pixel[1] | pixel[2]>>4             # <<<<<<<<<<<<<<
 *     return index
 * 
 */
  __pyx_v_index = ((((__pyx_v_pixel[0]) << 4) | (__pyx_v_pixel[1])) | ((__pyx_v_pixel[2]) >> 4));

  /* "_glarea.pyx":353
 *     #px pixel = glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, [[[0, 0, 0]]])[0][0]
 *     index = pixel[0]<<4 | pixel[1] | pixel[2]>>4
 *     return index             # <<<<<<<<<<<<<<
 * 
 * cdef void _modelview_to_viewport(vvect, int *mvect): #px/
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_glarea.gl_pick_polygons", __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_7_glarea_21gl_pick_polygons(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7_glarea_21gl_pick_polygons(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_x;
  int __pyx_v_y;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gl_pick_polygons (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
    PyObject* values[2] = {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  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__x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gl_pick_polygons", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gl_pick_polygons") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_y == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gl_pick_polygons", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea.gl_pick_polygons", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_glarea_20gl_pick_polygons(__pyx_self, __pyx_v_x, __pyx_v_y);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":342
 *     gl_pick_cube()
 * 
 * cpdef gl_pick_polygons(int x, int y): #px/             # <<<<<<<<<<<<<<
 * #px def gl_pick_polygons(x, y):
 *     cdef unsigned char pixel[3] #px+
 */

static PyObject *__pyx_pf_7_glarea_20gl_pick_polygons(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_x, int __pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_pick_polygons", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_7_glarea_gl_pick_polygons(__pyx_v_x, __pyx_v_y, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __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("_glarea.gl_pick_polygons", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":355
 *     return index
 * 
 * cdef void _modelview_to_viewport(vvect, int *mvect): #px/             # <<<<<<<<<<<<<<
 * #px def _modelview_to_viewport(vvect, mvect):
 *     cdef vec4 *M #px+
 */

static void __pyx_f_7_glarea__modelview_to_viewport(PyObject *__pyx_v_vvect, int *__pyx_v_mvect) {
  glm::vec4 *__pyx_v_M;
  glm::vec4 *__pyx_v_P;
  float __pyx_v_u0;
  float __pyx_v_u1;
  float __pyx_v_u2;
  float __pyx_v_v0;
  float __pyx_v_v1;
  float __pyx_v_v3;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  float __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_modelview_to_viewport", 0);

  /* "_glarea.pyx":361
 *     cdef float u0, u1, u2, v0, v1, v3 #px+
 * 
 *     M = &frustrum.modelview_matrix[0] #px/             # <<<<<<<<<<<<<<
 *     #px M = frustrum.modelview_matrix
 *     P = &frustrum.projection_matrix[0] #px/
 */
  __pyx_v_M = (&(__pyx_v_7_glarea_frustrum.modelview_matrix[0]));

  /* "_glarea.pyx":363
 *     M = &frustrum.modelview_matrix[0] #px/
 *     #px M = frustrum.modelview_matrix
 *     P = &frustrum.projection_matrix[0] #px/             # <<<<<<<<<<<<<<
 *     #px P = frustrum.projection_matrix
 * 
 */
  __pyx_v_P = (&(__pyx_v_7_glarea_frustrum.projection_matrix[0]));

  /* "_glarea.pyx":367
 * 
 *     # u = M^T * vvect
 *     u0 = M[0][0]*vvect[0] + M[1][0]*vvect[1] + M[2][0]*vvect[2] + M[3][0]             # <<<<<<<<<<<<<<
 *     u1 = M[0][1]*vvect[0] + M[1][1]*vvect[1] + M[2][1]*vvect[2] + M[3][1]
 *     u2 = M[0][2]*vvect[0] + M[1][2]*vvect[1] + M[2][2]*vvect[2] + M[3][2]
 */
  __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_M[0])[0])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_vvect, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_M[1])[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_vvect, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_M[2])[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_vvect, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_M[3])[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_u0 = __pyx_t_5;

  /* "_glarea.pyx":368
 *     # u = M^T * vvect
 *     u0 = M[0][0]*vvect[0] + M[1][0]*vvect[1] + M[2][0]*vvect[2] + M[3][0]
 *     u1 = M[0][1]*vvect[0] + M[1][1]*vvect[1] + M[2][1]*vvect[2] + M[3][1]             # <<<<<<<<<<<<<<
 *     u2 = M[0][2]*vvect[0] + M[1][2]*vvect[1] + M[2][2]*vvect[2] + M[3][2]
 *     #u3 = 1.
 */
  __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_M[0])[1])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_vvect, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_M[1])[1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_vvect, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_M[2])[1])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_vvect, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_M[3])[1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_u1 = __pyx_t_5;

  /* "_glarea.pyx":369
 *     u0 = M[0][0]*vvect[0] + M[1][0]*vvect[1] + M[2][0]*vvect[2] + M[3][0]
 *     u1 = M[0][1]*vvect[0] + M[1][1]*vvect[1] + M[2][1]*vvect[2] + M[3][1]
 *     u2 = M[0][2]*vvect[0] + M[1][2]*vvect[1] + M[2][2]*vvect[2] + M[3][2]             # <<<<<<<<<<<<<<
 *     #u3 = 1.
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_M[0])[2])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_vvect, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_M[1])[2])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_vvect, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_M[2])[2])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_vvect, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_M[3])[2])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_u2 = __pyx_t_5;

  /* "_glarea.pyx":373
 * 
 *     # v = P * u
 *     v0 = P[0][0] * u0 + P[1][0] * u1 + P[2][0] * u2 + P[3][0] #* u3             # <<<<<<<<<<<<<<
 *     v1 = P[0][1] * u0 + P[1][1] * u1 + P[2][1] * u2 + P[3][1] #* u3
 *     #v2 = P[0][2] * u0 + P[1][2] * u1 + P[2][2] * u2 + P[3][2] * u3
 */
  __pyx_v_v0 = ((((((__pyx_v_P[0])[0]) * __pyx_v_u0) + (((__pyx_v_P[1])[0]) * __pyx_v_u1)) + (((__pyx_v_P[2])[0]) * __pyx_v_u2)) + ((__pyx_v_P[3])[0]));

  /* "_glarea.pyx":374
 *     # v = P * u
 *     v0 = P[0][0] * u0 + P[1][0] * u1 + P[2][0] * u2 + P[3][0] #* u3
 *     v1 = P[0][1] * u0 + P[1][1] * u1 + P[2][1] * u2 + P[3][1] #* u3             # <<<<<<<<<<<<<<
 *     #v2 = P[0][2] * u0 + P[1][2] * u1 + P[2][2] * u2 + P[3][2] * u3
 *     v3 = P[0][3] * u0 + P[1][3] * u1 + P[2][3] * u2 + P[3][3] #* u3
 */
  __pyx_v_v1 = ((((((__pyx_v_P[0])[1]) * __pyx_v_u0) + (((__pyx_v_P[1])[1]) * __pyx_v_u1)) + (((__pyx_v_P[2])[1]) * __pyx_v_u2)) + ((__pyx_v_P[3])[1]));

  /* "_glarea.pyx":376
 *     v1 = P[0][1] * u0 + P[1][1] * u1 + P[2][1] * u2 + P[3][1] #* u3
 *     #v2 = P[0][2] * u0 + P[1][2] * u1 + P[2][2] * u2 + P[3][2] * u3
 *     v3 = P[0][3] * u0 + P[1][3] * u1 + P[2][3] * u2 + P[3][3] #* u3             # <<<<<<<<<<<<<<
 * 
 *     mvect[0] = int((v0 / v3 + 1) / 2 * terrain.width)
 */
  __pyx_v_v3 = ((((((__pyx_v_P[0])[3]) * __pyx_v_u0) + (((__pyx_v_P[1])[3]) * __pyx_v_u1)) + (((__pyx_v_P[2])[3]) * __pyx_v_u2)) + ((__pyx_v_P[3])[3]));

  /* "_glarea.pyx":378
 *     v3 = P[0][3] * u0 + P[1][3] * u1 + P[2][3] * u2 + P[3][3] #* u3
 * 
 *     mvect[0] = int((v0 / v3 + 1) / 2 * terrain.width)             # <<<<<<<<<<<<<<
 *     mvect[1] = int((v1 / v3 + 1) / 2 * terrain.height)
 * 
 */
  if (unlikely(__pyx_v_v3 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  (__pyx_v_mvect[0]) = ((int)((((__pyx_v_v0 / __pyx_v_v3) + 1.0) / 2.0) * __pyx_v_7_glarea_terrain.width));

  /* "_glarea.pyx":379
 * 
 *     mvect[0] = int((v0 / v3 + 1) / 2 * terrain.width)
 *     mvect[1] = int((v1 / v3 + 1) / 2 * terrain.height)             # <<<<<<<<<<<<<<
 * 
 * def get_cursor_angle(point1, point2):
 */
  if (unlikely(__pyx_v_v3 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  (__pyx_v_mvect[1]) = ((int)((((__pyx_v_v1 / __pyx_v_v3) + 1.0) / 2.0) * __pyx_v_7_glarea_terrain.height));

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("_glarea._modelview_to_viewport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_23get_cursor_angle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7_glarea_22get_cursor_angle[] = "The result is the angle (on the screen)\n    at which the mouse cursor needs to be drawn.";
static PyMethodDef __pyx_mdef_7_glarea_23get_cursor_angle = {__Pyx_NAMESTR("get_cursor_angle"), (PyCFunction)__pyx_pw_7_glarea_23get_cursor_angle, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7_glarea_22get_cursor_angle)};
static PyObject *__pyx_pw_7_glarea_23get_cursor_angle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_point1 = 0;
  PyObject *__pyx_v_point2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_cursor_angle (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__point1,&__pyx_n_s__point2,0};
    PyObject* values[2] = {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  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__point1)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__point2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_cursor_angle", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_cursor_angle") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_point1 = values[0];
    __pyx_v_point2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_cursor_angle", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea.get_cursor_angle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_glarea_22get_cursor_angle(__pyx_self, __pyx_v_point1, __pyx_v_point2);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":381
 *     mvect[1] = int((v1 / v3 + 1) / 2 * terrain.height)
 * 
 * def get_cursor_angle(point1, point2):             # <<<<<<<<<<<<<<
 *     '''The result is the angle (on the screen)
 *     at which the mouse cursor needs to be drawn.'''
 */

static PyObject *__pyx_pf_7_glarea_22get_cursor_angle(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_point1, PyObject *__pyx_v_point2) {
  float __pyx_v_angle;
  int __pyx_v_i;
  int __pyx_v_x;
  int __pyx_v_y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  float __pyx_t_3;
  double __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_cursor_angle", 0);

  /* "_glarea.pyx":386
 *     cdef float angle #px+
 *     cdef int i, x, y #px+
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         selection_debug_points.modelview1[i] = point1[i]
 *         selection_debug_points.modelview2[i] = point2[i]
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "_glarea.pyx":387
 *     cdef int i, x, y #px+
 *     for i in range(3):
 *         selection_debug_points.modelview1[i] = point1[i]             # <<<<<<<<<<<<<<
 *         selection_debug_points.modelview2[i] = point2[i]
 *     _modelview_to_viewport(point1, selection_debug_points.viewport1)
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_point1, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    (__pyx_v_7_glarea_selection_debug_points.modelview1[__pyx_v_i]) = __pyx_t_3;

    /* "_glarea.pyx":388
 *     for i in range(3):
 *         selection_debug_points.modelview1[i] = point1[i]
 *         selection_debug_points.modelview2[i] = point2[i]             # <<<<<<<<<<<<<<
 *     _modelview_to_viewport(point1, selection_debug_points.viewport1)
 *     _modelview_to_viewport(point2, selection_debug_points.viewport2)
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_point2, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    (__pyx_v_7_glarea_selection_debug_points.modelview2[__pyx_v_i]) = __pyx_t_3;
  }

  /* "_glarea.pyx":389
 *         selection_debug_points.modelview1[i] = point1[i]
 *         selection_debug_points.modelview2[i] = point2[i]
 *     _modelview_to_viewport(point1, selection_debug_points.viewport1)             # <<<<<<<<<<<<<<
 *     _modelview_to_viewport(point2, selection_debug_points.viewport2)
 *     x = selection_debug_points.viewport1[0] - selection_debug_points.viewport2[0]
 */
  __pyx_f_7_glarea__modelview_to_viewport(__pyx_v_point1, __pyx_v_7_glarea_selection_debug_points.viewport1);

  /* "_glarea.pyx":390
 *         selection_debug_points.modelview2[i] = point2[i]
 *     _modelview_to_viewport(point1, selection_debug_points.viewport1)
 *     _modelview_to_viewport(point2, selection_debug_points.viewport2)             # <<<<<<<<<<<<<<
 *     x = selection_debug_points.viewport1[0] - selection_debug_points.viewport2[0]
 *     y = selection_debug_points.viewport1[1] - selection_debug_points.viewport2[1]
 */
  __pyx_f_7_glarea__modelview_to_viewport(__pyx_v_point2, __pyx_v_7_glarea_selection_debug_points.viewport2);

  /* "_glarea.pyx":391
 *     _modelview_to_viewport(point1, selection_debug_points.viewport1)
 *     _modelview_to_viewport(point2, selection_debug_points.viewport2)
 *     x = selection_debug_points.viewport1[0] - selection_debug_points.viewport2[0]             # <<<<<<<<<<<<<<
 *     y = selection_debug_points.viewport1[1] - selection_debug_points.viewport2[1]
 *     angle = atan2(x, y) * 180.0 / M_PI
 */
  __pyx_v_x = ((__pyx_v_7_glarea_selection_debug_points.viewport1[0]) - (__pyx_v_7_glarea_selection_debug_points.viewport2[0]));

  /* "_glarea.pyx":392
 *     _modelview_to_viewport(point2, selection_debug_points.viewport2)
 *     x = selection_debug_points.viewport1[0] - selection_debug_points.viewport2[0]
 *     y = selection_debug_points.viewport1[1] - selection_debug_points.viewport2[1]             # <<<<<<<<<<<<<<
 *     angle = atan2(x, y) * 180.0 / M_PI
 *     return angle
 */
  __pyx_v_y = ((__pyx_v_7_glarea_selection_debug_points.viewport1[1]) - (__pyx_v_7_glarea_selection_debug_points.viewport2[1]));

  /* "_glarea.pyx":393
 *     x = selection_debug_points.viewport1[0] - selection_debug_points.viewport2[0]
 *     y = selection_debug_points.viewport1[1] - selection_debug_points.viewport2[1]
 *     angle = atan2(x, y) * 180.0 / M_PI             # <<<<<<<<<<<<<<
 *     return angle
 * 
 */
  __pyx_t_4 = (atan2(__pyx_v_x, __pyx_v_y) * 180.0);
  if (unlikely(M_PI == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_angle = (__pyx_t_4 / M_PI);

  /* "_glarea.pyx":394
 *     y = selection_debug_points.viewport1[1] - selection_debug_points.viewport2[1]
 *     angle = atan2(x, y) * 180.0 / M_PI
 *     return angle             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_angle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("_glarea.get_cursor_angle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":399
 * ### shader functions
 * 
 * cdef void _gl_print_shader_log(GLuint shader): #px/             # <<<<<<<<<<<<<<
 * #px def _gl_print_shader_log(shader):
 *     cdef GLint log_len #px+
 */

static void __pyx_f_7_glarea__gl_print_shader_log(__pyx_t_2gl_GLuint __pyx_v_shader) {
  __pyx_t_2gl_GLint __pyx_v_log_len;
  __pyx_t_2gl_GLsizei __pyx_v_length;
  char __pyx_v_log[1024];
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_print_shader_log", 0);

  /* "_glarea.pyx":404
 *     cdef GLsizei length #px+
 *     cdef char log[1024] #px+
 *     glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_len) #px/             # <<<<<<<<<<<<<<
 *     #px log_len = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:
 */
  glGetShaderiv(__pyx_v_shader, GL_INFO_LOG_LENGTH, (&__pyx_v_log_len));

  /* "_glarea.pyx":406
 *     glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_len) #px/
 *     #px log_len = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:             # <<<<<<<<<<<<<<
 *         print('==== Error compiling shader:')
 *         glGetShaderInfoLog(shader, 1023, &length, log) #px/
 */
  __pyx_t_1 = (__pyx_v_log_len > 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":407
 *     #px log_len = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:
 *         print('==== Error compiling shader:')             # <<<<<<<<<<<<<<
 *         glGetShaderInfoLog(shader, 1023, &length, log) #px/
 *         #px log = glGetShaderInfoLog(shader, 1023)
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "_glarea.pyx":408
 *     if log_len > 0:
 *         print('==== Error compiling shader:')
 *         glGetShaderInfoLog(shader, 1023, &length, log) #px/             # <<<<<<<<<<<<<<
 *         #px log = glGetShaderInfoLog(shader, 1023)
 *         print(log.decode('utf-8').rstrip())
 */
    glGetShaderInfoLog(__pyx_v_shader, 1023, (&__pyx_v_length), __pyx_v_log);

    /* "_glarea.pyx":410
 *         glGetShaderInfoLog(shader, 1023, &length, log) #px/
 *         #px log = glGetShaderInfoLog(shader, 1023)
 *         print(log.decode('utf-8').rstrip())             # <<<<<<<<<<<<<<
 *         print('====')
 *     else:
 */
    __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_log, 0, strlen(__pyx_v_log), NULL, NULL, PyUnicode_DecodeUTF8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_t_2), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "_glarea.pyx":411
 *         #px log = glGetShaderInfoLog(shader, 1023)
 *         print(log.decode('utf-8').rstrip())
 *         print('====')             # <<<<<<<<<<<<<<
 *     else:
 *         print('==== Error compiling shader (no log)')
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "_glarea.pyx":413
 *         print('====')
 *     else:
 *         print('==== Error compiling shader (no log)')             # <<<<<<<<<<<<<<
 * 
 * cdef void _gl_print_program_log(GLuint program): #px/
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("_glarea._gl_print_shader_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":415
 *         print('==== Error compiling shader (no log)')
 * 
 * cdef void _gl_print_program_log(GLuint program): #px/             # <<<<<<<<<<<<<<
 * #px def _gl_print_program_log(program):
 *     cdef GLint log_len #px+
 */

static void __pyx_f_7_glarea__gl_print_program_log(__pyx_t_2gl_GLuint __pyx_v_program) {
  __pyx_t_2gl_GLint __pyx_v_log_len;
  __pyx_t_2gl_GLsizei __pyx_v_length;
  char __pyx_v_log[1024];
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_print_program_log", 0);

  /* "_glarea.pyx":420
 *     cdef GLsizei length #px+
 *     cdef char log[1024] #px+
 *     glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_len) #px/             # <<<<<<<<<<<<<<
 *     #px log_len = glGetProgramiv(program, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:
 */
  glGetProgramiv(__pyx_v_program, GL_INFO_LOG_LENGTH, (&__pyx_v_log_len));

  /* "_glarea.pyx":422
 *     glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_len) #px/
 *     #px log_len = glGetProgramiv(program, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:             # <<<<<<<<<<<<<<
 *         print('==== Error linking shader program:')
 *         glGetProgramInfoLog(program, 1023, &length, log) #px/
 */
  __pyx_t_1 = (__pyx_v_log_len > 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":423
 *     #px log_len = glGetProgramiv(program, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:
 *         print('==== Error linking shader program:')             # <<<<<<<<<<<<<<
 *         glGetProgramInfoLog(program, 1023, &length, log) #px/
 *         #px log = glGetProgramInfoLog(program, 1023)
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "_glarea.pyx":424
 *     if log_len > 0:
 *         print('==== Error linking shader program:')
 *         glGetProgramInfoLog(program, 1023, &length, log) #px/             # <<<<<<<<<<<<<<
 *         #px log = glGetProgramInfoLog(program, 1023)
 *         print(log.decode('utf-8').rstrip())
 */
    glGetProgramInfoLog(__pyx_v_program, 1023, (&__pyx_v_length), __pyx_v_log);

    /* "_glarea.pyx":426
 *         glGetProgramInfoLog(program, 1023, &length, log) #px/
 *         #px log = glGetProgramInfoLog(program, 1023)
 *         print(log.decode('utf-8').rstrip())             # <<<<<<<<<<<<<<
 *         print('====')
 *     else:
 */
    __pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_log, 0, strlen(__pyx_v_log), NULL, NULL, PyUnicode_DecodeUTF8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_t_2), __pyx_n_s__rstrip); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "_glarea.pyx":427
 *         #px log = glGetProgramInfoLog(program, 1023)
 *         print(log.decode('utf-8').rstrip())
 *         print('====')             # <<<<<<<<<<<<<<
 *     else:
 *         print('==== Error linking shader program (no log)')
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "_glarea.pyx":429
 *         print('====')
 *     else:
 *         print('==== Error linking shader program (no log)')             # <<<<<<<<<<<<<<
 * 
 * cdef GLuint _gl_create_compiled_shader(GLenum shadertype, bytes source): #px/
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("_glarea._gl_print_program_log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":431
 *         print('==== Error linking shader program (no log)')
 * 
 * cdef GLuint _gl_create_compiled_shader(GLenum shadertype, bytes source): #px/             # <<<<<<<<<<<<<<
 * #px def _gl_create_compiled_shader(shadertype, source):
 *     cdef GLuint shader #px+
 */

static __pyx_t_2gl_GLuint __pyx_f_7_glarea__gl_create_compiled_shader(__pyx_t_2gl_GLenum __pyx_v_shadertype, PyObject *__pyx_v_source) {
  __pyx_t_2gl_GLuint __pyx_v_shader;
  const GLchar* __pyx_v_pchar;
  __pyx_t_2gl_GLint __pyx_v_compile_status;
  __pyx_t_2gl_GLuint __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  char *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_create_compiled_shader", 0);

  /* "_glarea.pyx":437
 *     cdef GLint compile_status #px+
 * 
 *     shader = glCreateShader(shadertype)             # <<<<<<<<<<<<<<
 *     if shader == 0:
 *         print('Failed to create shader')
 */
  __pyx_v_shader = glCreateShader(__pyx_v_shadertype);

  /* "_glarea.pyx":438
 * 
 *     shader = glCreateShader(shadertype)
 *     if shader == 0:             # <<<<<<<<<<<<<<
 *         print('Failed to create shader')
 *         return 0
 */
  __pyx_t_1 = (__pyx_v_shader == 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":439
 *     shader = glCreateShader(shadertype)
 *     if shader == 0:
 *         print('Failed to create shader')             # <<<<<<<<<<<<<<
 *         return 0
 *     pchar = <const_GLchar_ptr><char*>source #px+
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "_glarea.pyx":440
 *     if shader == 0:
 *         print('Failed to create shader')
 *         return 0             # <<<<<<<<<<<<<<
 *     pchar = <const_GLchar_ptr><char*>source #px+
 *     glShaderSource(shader, 1, &pchar, NULL) #px/
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":441
 *         print('Failed to create shader')
 *         return 0
 *     pchar = <const_GLchar_ptr><char*>source #px+             # <<<<<<<<<<<<<<
 *     glShaderSource(shader, 1, &pchar, NULL) #px/
 *     #px glShaderSource(shader, source)
 */
  __pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_source)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_pchar = ((const GLchar*)((char *)__pyx_t_3));

  /* "_glarea.pyx":442
 *         return 0
 *     pchar = <const_GLchar_ptr><char*>source #px+
 *     glShaderSource(shader, 1, &pchar, NULL) #px/             # <<<<<<<<<<<<<<
 *     #px glShaderSource(shader, source)
 *     glCompileShader(shader)
 */
  glShaderSource(__pyx_v_shader, 1, (&__pyx_v_pchar), NULL);

  /* "_glarea.pyx":444
 *     glShaderSource(shader, 1, &pchar, NULL) #px/
 *     #px glShaderSource(shader, source)
 *     glCompileShader(shader)             # <<<<<<<<<<<<<<
 *     glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) #px/
 *     #px compile_status = glGetShaderiv(shader, GL_COMPILE_STATUS)
 */
  glCompileShader(__pyx_v_shader);

  /* "_glarea.pyx":445
 *     #px glShaderSource(shader, source)
 *     glCompileShader(shader)
 *     glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) #px/             # <<<<<<<<<<<<<<
 *     #px compile_status = glGetShaderiv(shader, GL_COMPILE_STATUS)
 *     if not compile_status:
 */
  glGetShaderiv(__pyx_v_shader, GL_COMPILE_STATUS, (&__pyx_v_compile_status));

  /* "_glarea.pyx":447
 *     glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) #px/
 *     #px compile_status = glGetShaderiv(shader, GL_COMPILE_STATUS)
 *     if not compile_status:             # <<<<<<<<<<<<<<
 *         _gl_print_shader_log(shader)
 *         return 0
 */
  __pyx_t_1 = (!__pyx_v_compile_status);
  if (__pyx_t_1) {

    /* "_glarea.pyx":448
 *     #px compile_status = glGetShaderiv(shader, GL_COMPILE_STATUS)
 *     if not compile_status:
 *         _gl_print_shader_log(shader)             # <<<<<<<<<<<<<<
 *         return 0
 *     return shader
 */
    __pyx_f_7_glarea__gl_print_shader_log(__pyx_v_shader);

    /* "_glarea.pyx":449
 *     if not compile_status:
 *         _gl_print_shader_log(shader)
 *         return 0             # <<<<<<<<<<<<<<
 *     return shader
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "_glarea.pyx":450
 *         _gl_print_shader_log(shader)
 *         return 0
 *     return shader             # <<<<<<<<<<<<<<
 * 
 * cdef void _gl_print_program_info(GLuint program): #px/
 */
  __pyx_r = __pyx_v_shader;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("_glarea._gl_create_compiled_shader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":452
 *     return shader
 * 
 * cdef void _gl_print_program_info(GLuint program): #px/             # <<<<<<<<<<<<<<
 * #px def _gl_print_program_info(program):
 *     cdef GLint param #px+
 */

static void __pyx_f_7_glarea__gl_print_program_info(__pyx_t_2gl_GLuint __pyx_v_program) {
  __pyx_t_2gl_GLint __pyx_v_param;
  int __pyx_v_i;
  __pyx_t_2gl_GLsizei __pyx_v_alength;
  __pyx_t_2gl_GLint __pyx_v_asize;
  __pyx_t_2gl_GLint __pyx_v_location;
  __pyx_t_2gl_GLenum __pyx_v_atype;
  char __pyx_v_aname[1024];
  PyObject *__pyx_v_program_info = NULL;
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_v_pname = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  __pyx_t_2gl_GLenum __pyx_t_13;
  long __pyx_t_14;
  int __pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_print_program_info", 0);

  /* "_glarea.pyx":461
 *     cdef char aname[1024] #px+
 * 
 *     print('shader program info', program)             # <<<<<<<<<<<<<<
 *     glValidateProgram(program)
 *     program_info = {}
 */
  __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_program); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_28));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_u_28));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_28));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_glarea.pyx":462
 * 
 *     print('shader program info', program)
 *     glValidateProgram(program)             # <<<<<<<<<<<<<<
 *     program_info = {}
 *     for msg, pname in [('delete status', GL_DELETE_STATUS),
 */
  glValidateProgram(__pyx_v_program);

  /* "_glarea.pyx":463
 *     print('shader program info', program)
 *     glValidateProgram(program)
 *     program_info = {}             # <<<<<<<<<<<<<<
 *     for msg, pname in [('delete status', GL_DELETE_STATUS),
 *                        ('link status', GL_LINK_STATUS),
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_program_info = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "_glarea.pyx":464
 *     glValidateProgram(program)
 *     program_info = {}
 *     for msg, pname in [('delete status', GL_DELETE_STATUS),             # <<<<<<<<<<<<<<
 *                        ('link status', GL_LINK_STATUS),
 *                        ('validate status', GL_VALIDATE_STATUS),
 */
  __pyx_t_1 = PyInt_FromLong(GL_DELETE_STATUS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_29));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_u_29));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_29));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":465
 *     program_info = {}
 *     for msg, pname in [('delete status', GL_DELETE_STATUS),
 *                        ('link status', GL_LINK_STATUS),             # <<<<<<<<<<<<<<
 *                        ('validate status', GL_VALIDATE_STATUS),
 *                        ('info log length', GL_INFO_LOG_LENGTH),
 */
  __pyx_t_1 = PyInt_FromLong(GL_LINK_STATUS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_30));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_30));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_30));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":466
 *     for msg, pname in [('delete status', GL_DELETE_STATUS),
 *                        ('link status', GL_LINK_STATUS),
 *                        ('validate status', GL_VALIDATE_STATUS),             # <<<<<<<<<<<<<<
 *                        ('info log length', GL_INFO_LOG_LENGTH),
 *                        ('attached shaders', GL_ATTACHED_SHADERS),
 */
  __pyx_t_1 = PyInt_FromLong(GL_VALIDATE_STATUS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_31));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_31));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_31));
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":467
 *                        ('link status', GL_LINK_STATUS),
 *                        ('validate status', GL_VALIDATE_STATUS),
 *                        ('info log length', GL_INFO_LOG_LENGTH),             # <<<<<<<<<<<<<<
 *                        ('attached shaders', GL_ATTACHED_SHADERS),
 *                        ('active attributes', GL_ACTIVE_ATTRIBUTES),
 */
  __pyx_t_1 = PyInt_FromLong(GL_INFO_LOG_LENGTH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_32));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_32));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_32));
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":468
 *                        ('validate status', GL_VALIDATE_STATUS),
 *                        ('info log length', GL_INFO_LOG_LENGTH),
 *                        ('attached shaders', GL_ATTACHED_SHADERS),             # <<<<<<<<<<<<<<
 *                        ('active attributes', GL_ACTIVE_ATTRIBUTES),
 *                        ('active attribute max length', GL_ACTIVE_ATTRIBUTE_MAX_LENGTH),
 */
  __pyx_t_1 = PyInt_FromLong(GL_ATTACHED_SHADERS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_33));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_u_33));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_33));
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":469
 *                        ('info log length', GL_INFO_LOG_LENGTH),
 *                        ('attached shaders', GL_ATTACHED_SHADERS),
 *                        ('active attributes', GL_ACTIVE_ATTRIBUTES),             # <<<<<<<<<<<<<<
 *                        ('active attribute max length', GL_ACTIVE_ATTRIBUTE_MAX_LENGTH),
 *                        ('active uniforms', GL_ACTIVE_UNIFORMS),
 */
  __pyx_t_1 = PyInt_FromLong(GL_ACTIVE_ATTRIBUTES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_34));
  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_u_34));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_34));
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":470
 *                        ('attached shaders', GL_ATTACHED_SHADERS),
 *                        ('active attributes', GL_ACTIVE_ATTRIBUTES),
 *                        ('active attribute max length', GL_ACTIVE_ATTRIBUTE_MAX_LENGTH),             # <<<<<<<<<<<<<<
 *                        ('active uniforms', GL_ACTIVE_UNIFORMS),
 *                        ('active uniform max length', GL_ACTIVE_UNIFORM_MAX_LENGTH)]:
 */
  __pyx_t_1 = PyInt_FromLong(GL_ACTIVE_ATTRIBUTE_MAX_LENGTH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_35));
  PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_u_35));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_35));
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":471
 *                        ('active attributes', GL_ACTIVE_ATTRIBUTES),
 *                        ('active attribute max length', GL_ACTIVE_ATTRIBUTE_MAX_LENGTH),
 *                        ('active uniforms', GL_ACTIVE_UNIFORMS),             # <<<<<<<<<<<<<<
 *                        ('active uniform max length', GL_ACTIVE_UNIFORM_MAX_LENGTH)]:
 *         glGetProgramiv(program, pname, &param) #px/
 */
  __pyx_t_1 = PyInt_FromLong(GL_ACTIVE_UNIFORMS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_36));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_kp_u_36));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_36));
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":472
 *                        ('active attribute max length', GL_ACTIVE_ATTRIBUTE_MAX_LENGTH),
 *                        ('active uniforms', GL_ACTIVE_UNIFORMS),
 *                        ('active uniform max length', GL_ACTIVE_UNIFORM_MAX_LENGTH)]:             # <<<<<<<<<<<<<<
 *         glGetProgramiv(program, pname, &param) #px/
 *         #px param = glGetProgramiv(program, pname)
 */
  __pyx_t_1 = PyInt_FromLong(GL_ACTIVE_UNIFORM_MAX_LENGTH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_37));
  PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_kp_u_37));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_37));
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_t_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_t_6));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
  PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_t_7));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
  PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_t_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
  PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_t_9));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
  PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_t_10));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_10 = ((PyObject *)__pyx_t_1); __Pyx_INCREF(__pyx_t_10); __pyx_t_11 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  for (;;) {

    /* "_glarea.pyx":464
 *     glValidateProgram(program)
 *     program_info = {}
 *     for msg, pname in [('delete status', GL_DELETE_STATUS),             # <<<<<<<<<<<<<<
 *                        ('link status', GL_LINK_STATUS),
 *                        ('validate status', GL_VALIDATE_STATUS),
 */
    if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_10)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_8);
      #else
      __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_8 = __pyx_t_12(__pyx_t_7); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_msg);
    __pyx_v_msg = __pyx_t_9;
    __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_v_pname);
    __pyx_v_pname = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "_glarea.pyx":473
 *                        ('active uniforms', GL_ACTIVE_UNIFORMS),
 *                        ('active uniform max length', GL_ACTIVE_UNIFORM_MAX_LENGTH)]:
 *         glGetProgramiv(program, pname, &param) #px/             # <<<<<<<<<<<<<<
 *         #px param = glGetProgramiv(program, pname)
 *         program_info[pname] = param
 */
    __pyx_t_13 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_pname); if (unlikely((__pyx_t_13 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    glGetProgramiv(__pyx_v_program, __pyx_t_13, (&__pyx_v_param));

    /* "_glarea.pyx":475
 *         glGetProgramiv(program, pname, &param) #px/
 *         #px param = glGetProgramiv(program, pname)
 *         program_info[pname] = param             # <<<<<<<<<<<<<<
 *         print(' ', msg, param)
 *     print('active attributes:')
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_v_param); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(((PyObject *)__pyx_v_program_info), __pyx_v_pname, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":476
 *         #px param = glGetProgramiv(program, pname)
 *         program_info[pname] = param
 *         print(' ', msg, param)             # <<<<<<<<<<<<<<
 *     print('active attributes:')
 *     for i in range(program_info[GL_ACTIVE_ATTRIBUTES]):
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_v_param); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_kp_u_38));
    PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_u_38));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_38));
    __Pyx_INCREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "_glarea.pyx":477
 *         program_info[pname] = param
 *         print(' ', msg, param)
 *     print('active attributes:')             # <<<<<<<<<<<<<<
 *     for i in range(program_info[GL_ACTIVE_ATTRIBUTES]):
 *         glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) #px/
 */
  __pyx_t_10 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "_glarea.pyx":478
 *         print(' ', msg, param)
 *     print('active attributes:')
 *     for i in range(program_info[GL_ACTIVE_ATTRIBUTES]):             # <<<<<<<<<<<<<<
 *         glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) #px/
 *         #px aname, asize, atype = glGetActiveAttrib(program, i); alength = '?'
 */
  __pyx_t_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_program_info), GL_ACTIVE_ATTRIBUTES, sizeof(int), PyInt_FromLong); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_14 = __Pyx_PyInt_AsLong(__pyx_t_10); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
    __pyx_v_i = __pyx_t_15;

    /* "_glarea.pyx":479
 *     print('active attributes:')
 *     for i in range(program_info[GL_ACTIVE_ATTRIBUTES]):
 *         glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) #px/             # <<<<<<<<<<<<<<
 *         #px aname, asize, atype = glGetActiveAttrib(program, i); alength = '?'
 *         location = glGetAttribLocation(program, aname)
 */
    glGetActiveAttrib(__pyx_v_program, __pyx_v_i, 1023, (&__pyx_v_alength), (&__pyx_v_asize), (&__pyx_v_atype), __pyx_v_aname);

    /* "_glarea.pyx":481
 *         glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) #px/
 *         #px aname, asize, atype = glGetActiveAttrib(program, i); alength = '?'
 *         location = glGetAttribLocation(program, aname)             # <<<<<<<<<<<<<<
 *         print('  {}, {}: length={} size={} type={} location={}'.format(i, aname, alength, asize, atype, location))
 *     print('active uniforms:')
 */
    __pyx_v_location = glGetAttribLocation(__pyx_v_program, __pyx_v_aname);

    /* "_glarea.pyx":482
 *         #px aname, asize, atype = glGetActiveAttrib(program, i); alength = '?'
 *         location = glGetAttribLocation(program, aname)
 *         print('  {}, {}: length={} size={} type={} location={}'.format(i, aname, alength, asize, atype, location))             # <<<<<<<<<<<<<<
 *     print('active uniforms:')
 *     for i in range(program_info[GL_ACTIVE_UNIFORMS]):
 */
    __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_kp_u_41), __pyx_n_s__format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyBytes_FromString(__pyx_v_aname); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __pyx_t_9 = PyInt_FromLong(__pyx_v_alength); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = PyInt_FromLong(__pyx_v_asize); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_atype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyInt_FromLong(__pyx_v_location); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_8));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_1 = 0;
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;
    __pyx_t_7 = 0;
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "_glarea.pyx":483
 *         location = glGetAttribLocation(program, aname)
 *         print('  {}, {}: length={} size={} type={} location={}'.format(i, aname, alength, asize, atype, location))
 *     print('active uniforms:')             # <<<<<<<<<<<<<<
 *     for i in range(program_info[GL_ACTIVE_UNIFORMS]):
 *         glGetActiveUniform(program, i, 1023, &alength, &asize, &atype, aname) #px/
 */
  __pyx_t_5 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_k_tuple_43), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "_glarea.pyx":484
 *         print('  {}, {}: length={} size={} type={} location={}'.format(i, aname, alength, asize, atype, location))
 *     print('active uniforms:')
 *     for i in range(program_info[GL_ACTIVE_UNIFORMS]):             # <<<<<<<<<<<<<<
 *         glGetActiveUniform(program, i, 1023, &alength, &asize, &atype, aname) #px/
 *         #px aname, asize, atype = glGetActiveUniform(program, i); alength = '?'
 */
  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_program_info), GL_ACTIVE_UNIFORMS, sizeof(int), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_14 = __Pyx_PyInt_AsLong(__pyx_t_5); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
    __pyx_v_i = __pyx_t_15;

    /* "_glarea.pyx":485
 *     print('active uniforms:')
 *     for i in range(program_info[GL_ACTIVE_UNIFORMS]):
 *         glGetActiveUniform(program, i, 1023, &alength, &asize, &atype, aname) #px/             # <<<<<<<<<<<<<<
 *         #px aname, asize, atype = glGetActiveUniform(program, i); alength = '?'
 *         location = glGetUniformLocation(program, aname)
 */
    glGetActiveUniform(__pyx_v_program, __pyx_v_i, 1023, (&__pyx_v_alength), (&__pyx_v_asize), (&__pyx_v_atype), __pyx_v_aname);

    /* "_glarea.pyx":487
 *         glGetActiveUniform(program, i, 1023, &alength, &asize, &atype, aname) #px/
 *         #px aname, asize, atype = glGetActiveUniform(program, i); alength = '?'
 *         location = glGetUniformLocation(program, aname)             # <<<<<<<<<<<<<<
 *         print('  {}, {}: length={} size={} type={} location={}'.format(i, aname, alength, asize, atype, location))
 * 
 */
    __pyx_v_location = glGetUniformLocation(__pyx_v_program, __pyx_v_aname);

    /* "_glarea.pyx":488
 *         #px aname, asize, atype = glGetActiveUniform(program, i); alength = '?'
 *         location = glGetUniformLocation(program, aname)
 *         print('  {}, {}: length={} size={} type={} location={}'.format(i, aname, alength, asize, atype, location))             # <<<<<<<<<<<<<<
 * 
 * cdef GLuint _gl_create_program(bytes vertex_source, bytes fragment_source, list attributes): #px/
 */
    __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_u_41), __pyx_n_s__format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = PyBytes_FromString(__pyx_v_aname); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_10));
    __pyx_t_6 = PyInt_FromLong(__pyx_v_alength); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyInt_FromLong(__pyx_v_asize); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = PyLong_FromUnsignedLong(__pyx_v_atype); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyInt_FromLong(__pyx_v_location); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_10));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_10));
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_4 = 0;
    __pyx_t_10 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_9 = 0;
    __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_builtin_print, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_WriteUnraisable("_glarea._gl_print_program_info", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_program_info);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XDECREF(__pyx_v_pname);
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":490
 *         print('  {}, {}: length={} size={} type={} location={}'.format(i, aname, alength, asize, atype, location))
 * 
 * cdef GLuint _gl_create_program(bytes vertex_source, bytes fragment_source, list attributes): #px/             # <<<<<<<<<<<<<<
 * #px def _gl_create_program(vertex_source, fragment_source, attributes):
 *     cdef GLuint vertex_shader = 0, fragment_shader = 0 #px+
 */

static __pyx_t_2gl_GLuint __pyx_f_7_glarea__gl_create_program(PyObject *__pyx_v_vertex_source, PyObject *__pyx_v_fragment_source, PyObject *__pyx_v_attributes) {
  __pyx_t_2gl_GLuint __pyx_v_vertex_shader;
  __pyx_t_2gl_GLuint __pyx_v_fragment_shader;
  __pyx_t_2gl_GLuint __pyx_v_program;
  __pyx_t_2gl_GLint __pyx_v_link_status;
  PyObject *__pyx_v_index = NULL;
  PyObject *__pyx_v_name = NULL;
  __pyx_t_2gl_GLuint __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  __pyx_t_2gl_GLuint __pyx_t_10;
  __pyx_t_2gl_GLchar *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_create_program", 0);

  /* "_glarea.pyx":492
 * cdef GLuint _gl_create_program(bytes vertex_source, bytes fragment_source, list attributes): #px/
 * #px def _gl_create_program(vertex_source, fragment_source, attributes):
 *     cdef GLuint vertex_shader = 0, fragment_shader = 0 #px+             # <<<<<<<<<<<<<<
 *     cdef GLuint program #px+
 *     cdef GLint link_status #px+
 */
  __pyx_v_vertex_shader = 0;
  __pyx_v_fragment_shader = 0;

  /* "_glarea.pyx":496
 *     cdef GLint link_status #px+
 * 
 *     if DEBUG_NOSHADER:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEBUG_NOSHADER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "_glarea.pyx":497
 * 
 *     if DEBUG_NOSHADER:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     program = glCreateProgram()
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":499
 *         return 0
 * 
 *     program = glCreateProgram()             # <<<<<<<<<<<<<<
 *     if not DEBUG_NOVSHADER:
 *         debug('  creating vertex shader')
 */
  __pyx_v_program = glCreateProgram();

  /* "_glarea.pyx":500
 * 
 *     program = glCreateProgram()
 *     if not DEBUG_NOVSHADER:             # <<<<<<<<<<<<<<
 *         debug('  creating vertex shader')
 *         vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEBUG_NOVSHADER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (__pyx_t_3) {

    /* "_glarea.pyx":501
 *     program = glCreateProgram()
 *     if not DEBUG_NOVSHADER:
 *         debug('  creating vertex shader')             # <<<<<<<<<<<<<<
 *         vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *         glAttachShader(program, vertex_shader)
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_45), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "_glarea.pyx":502
 *     if not DEBUG_NOVSHADER:
 *         debug('  creating vertex shader')
 *         vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)             # <<<<<<<<<<<<<<
 *         glAttachShader(program, vertex_shader)
 *     if not DEBUG_NOFSHADER:
 */
    __pyx_v_vertex_shader = __pyx_f_7_glarea__gl_create_compiled_shader(GL_VERTEX_SHADER, __pyx_v_vertex_source);

    /* "_glarea.pyx":503
 *         debug('  creating vertex shader')
 *         vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *         glAttachShader(program, vertex_shader)             # <<<<<<<<<<<<<<
 *     if not DEBUG_NOFSHADER:
 *         debug('  creating fragment shader')
 */
    glAttachShader(__pyx_v_program, __pyx_v_vertex_shader);
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "_glarea.pyx":504
 *         vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *         glAttachShader(program, vertex_shader)
 *     if not DEBUG_NOFSHADER:             # <<<<<<<<<<<<<<
 *         debug('  creating fragment shader')
 *         fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEBUG_NOFSHADER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = (!__pyx_t_3);
  if (__pyx_t_2) {

    /* "_glarea.pyx":505
 *         glAttachShader(program, vertex_shader)
 *     if not DEBUG_NOFSHADER:
 *         debug('  creating fragment shader')             # <<<<<<<<<<<<<<
 *         fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *         glAttachShader(program, fragment_shader)
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_47), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":506
 *     if not DEBUG_NOFSHADER:
 *         debug('  creating fragment shader')
 *         fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)             # <<<<<<<<<<<<<<
 *         glAttachShader(program, fragment_shader)
 *     for index, name in attributes:
 */
    __pyx_v_fragment_shader = __pyx_f_7_glarea__gl_create_compiled_shader(GL_FRAGMENT_SHADER, __pyx_v_fragment_source);

    /* "_glarea.pyx":507
 *         debug('  creating fragment shader')
 *         fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *         glAttachShader(program, fragment_shader)             # <<<<<<<<<<<<<<
 *     for index, name in attributes:
 *         glBindAttribLocation(program, index, name)
 */
    glAttachShader(__pyx_v_program, __pyx_v_fragment_shader);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "_glarea.pyx":508
 *         fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *         glAttachShader(program, fragment_shader)
 *     for index, name in attributes:             # <<<<<<<<<<<<<<
 *         glBindAttribLocation(program, index, name)
 *     glLinkProgram(program)
 */
  if (unlikely(((PyObject *)__pyx_v_attributes) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = ((PyObject *)__pyx_v_attributes); __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L9_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_index);
    __pyx_v_index = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_v_name);
    __pyx_v_name = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "_glarea.pyx":509
 *         glAttachShader(program, fragment_shader)
 *     for index, name in attributes:
 *         glBindAttribLocation(program, index, name)             # <<<<<<<<<<<<<<
 *     glLinkProgram(program)
 *     glGetProgramiv(program, GL_LINK_STATUS, &link_status) #px/
 */
    __pyx_t_10 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_index); if (unlikely((__pyx_t_10 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    glBindAttribLocation(__pyx_v_program, __pyx_t_10, __pyx_t_11);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_glarea.pyx":510
 *     for index, name in attributes:
 *         glBindAttribLocation(program, index, name)
 *     glLinkProgram(program)             # <<<<<<<<<<<<<<
 *     glGetProgramiv(program, GL_LINK_STATUS, &link_status) #px/
 *     #px link_status = glGetProgramiv(program, GL_LINK_STATUS)
 */
  glLinkProgram(__pyx_v_program);

  /* "_glarea.pyx":511
 *         glBindAttribLocation(program, index, name)
 *     glLinkProgram(program)
 *     glGetProgramiv(program, GL_LINK_STATUS, &link_status) #px/             # <<<<<<<<<<<<<<
 *     #px link_status = glGetProgramiv(program, GL_LINK_STATUS)
 *     if not link_status:
 */
  glGetProgramiv(__pyx_v_program, GL_LINK_STATUS, (&__pyx_v_link_status));

  /* "_glarea.pyx":513
 *     glGetProgramiv(program, GL_LINK_STATUS, &link_status) #px/
 *     #px link_status = glGetProgramiv(program, GL_LINK_STATUS)
 *     if not link_status:             # <<<<<<<<<<<<<<
 *         _gl_print_program_log(program)
 *         return 0
 */
  __pyx_t_2 = (!__pyx_v_link_status);
  if (__pyx_t_2) {

    /* "_glarea.pyx":514
 *     #px link_status = glGetProgramiv(program, GL_LINK_STATUS)
 *     if not link_status:
 *         _gl_print_program_log(program)             # <<<<<<<<<<<<<<
 *         return 0
 *     if DEBUG_MSG:
 */
    __pyx_f_7_glarea__gl_print_program_log(__pyx_v_program);

    /* "_glarea.pyx":515
 *     if not link_status:
 *         _gl_print_program_log(program)
 *         return 0             # <<<<<<<<<<<<<<
 *     if DEBUG_MSG:
 *         _gl_print_program_info(program)
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "_glarea.pyx":516
 *         _gl_print_program_log(program)
 *         return 0
 *     if DEBUG_MSG:             # <<<<<<<<<<<<<<
 *         _gl_print_program_info(program)
 *     glDetachShader(program, vertex_shader)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__DEBUG_MSG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "_glarea.pyx":517
 *         return 0
 *     if DEBUG_MSG:
 *         _gl_print_program_info(program)             # <<<<<<<<<<<<<<
 *     glDetachShader(program, vertex_shader)
 *     glDetachShader(program, fragment_shader)
 */
    __pyx_f_7_glarea__gl_print_program_info(__pyx_v_program);
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "_glarea.pyx":518
 *     if DEBUG_MSG:
 *         _gl_print_program_info(program)
 *     glDetachShader(program, vertex_shader)             # <<<<<<<<<<<<<<
 *     glDetachShader(program, fragment_shader)
 *     glDeleteShader(vertex_shader)
 */
  glDetachShader(__pyx_v_program, __pyx_v_vertex_shader);

  /* "_glarea.pyx":519
 *         _gl_print_program_info(program)
 *     glDetachShader(program, vertex_shader)
 *     glDetachShader(program, fragment_shader)             # <<<<<<<<<<<<<<
 *     glDeleteShader(vertex_shader)
 *     glDeleteShader(fragment_shader)
 */
  glDetachShader(__pyx_v_program, __pyx_v_fragment_shader);

  /* "_glarea.pyx":520
 *     glDetachShader(program, vertex_shader)
 *     glDetachShader(program, fragment_shader)
 *     glDeleteShader(vertex_shader)             # <<<<<<<<<<<<<<
 *     glDeleteShader(fragment_shader)
 *     return program
 */
  glDeleteShader(__pyx_v_vertex_shader);

  /* "_glarea.pyx":521
 *     glDetachShader(program, fragment_shader)
 *     glDeleteShader(vertex_shader)
 *     glDeleteShader(fragment_shader)             # <<<<<<<<<<<<<<
 *     return program
 * 
 */
  glDeleteShader(__pyx_v_fragment_shader);

  /* "_glarea.pyx":522
 *     glDeleteShader(vertex_shader)
 *     glDeleteShader(fragment_shader)
 *     return program             # <<<<<<<<<<<<<<
 * 
 * def gl_create_render_program(bytes vertex_source, bytes fragment_source): #px/
 */
  __pyx_r = __pyx_v_program;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("_glarea._gl_create_program", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_25gl_create_render_program(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_25gl_create_render_program = {__Pyx_NAMESTR("gl_create_render_program"), (PyCFunction)__pyx_pw_7_glarea_25gl_create_render_program, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_25gl_create_render_program(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vertex_source = 0;
  PyObject *__pyx_v_fragment_source = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gl_create_render_program (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vertex_source,&__pyx_n_s__fragment_source,0};
    PyObject* values[2] = {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  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__vertex_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fragment_source)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gl_create_render_program", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gl_create_render_program") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_vertex_source = ((PyObject*)values[0]);
    __pyx_v_fragment_source = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gl_create_render_program", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea.gl_create_render_program", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vertex_source), (&PyBytes_Type), 1, "vertex_source", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fragment_source), (&PyBytes_Type), 1, "fragment_source", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7_glarea_24gl_create_render_program(__pyx_self, __pyx_v_vertex_source, __pyx_v_fragment_source);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":524
 *     return program
 * 
 * def gl_create_render_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #px def gl_create_render_program(vertex_source, fragment_source):
 *     cdef GLint location #px+
 */

static PyObject *__pyx_pf_7_glarea_24gl_create_render_program(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vertex_source, PyObject *__pyx_v_fragment_source) {
  __pyx_t_2gl_GLint __pyx_v_location;
  PyObject *__pyx_v_attributes = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_create_render_program", 0);

  /* "_glarea.pyx":527
 * #px def gl_create_render_program(vertex_source, fragment_source):
 *     cdef GLint location #px+
 *     if program.prog_render > 0:             # <<<<<<<<<<<<<<
 *         glDeleteProgram(program.prog_render)
 *     attributes = [
 */
  __pyx_t_1 = (__pyx_v_7_glarea_program.prog_render > 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":528
 *     cdef GLint location #px+
 *     if program.prog_render > 0:
 *         glDeleteProgram(program.prog_render)             # <<<<<<<<<<<<<<
 *     attributes = [
 *                   (VERTEX_ATTRIB_LOCATION, b'vertex_attr'),
 */
    glDeleteProgram(__pyx_v_7_glarea_program.prog_render);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":530
 *         glDeleteProgram(program.prog_render)
 *     attributes = [
 *                   (VERTEX_ATTRIB_LOCATION, b'vertex_attr'),             # <<<<<<<<<<<<<<
 *                   (NORMAL_ATTRIB_LOCATION, b'normal_attr'),
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr'),
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_e_7_gldraw_VERTEX_ATTRIB_LOCATION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_b__vertex_attr));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_b__vertex_attr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_b__vertex_attr));
  __pyx_t_2 = 0;

  /* "_glarea.pyx":531
 *     attributes = [
 *                   (VERTEX_ATTRIB_LOCATION, b'vertex_attr'),
 *                   (NORMAL_ATTRIB_LOCATION, b'normal_attr'),             # <<<<<<<<<<<<<<
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr'),
 *                   (TEXCOORD_ATTRIB_LOCATION, b'texcoord_attr'),
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_e_7_gldraw_NORMAL_ATTRIB_LOCATION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_b__normal_attr));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_b__normal_attr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_b__normal_attr));
  __pyx_t_2 = 0;

  /* "_glarea.pyx":532
 *                   (VERTEX_ATTRIB_LOCATION, b'vertex_attr'),
 *                   (NORMAL_ATTRIB_LOCATION, b'normal_attr'),
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr'),             # <<<<<<<<<<<<<<
 *                   (TEXCOORD_ATTRIB_LOCATION, b'texcoord_attr'),
 *                  ]
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_e_7_gldraw_COLOR_ATTRIB_LOCATION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_b__color_attr));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_n_b__color_attr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_b__color_attr));
  __pyx_t_2 = 0;

  /* "_glarea.pyx":533
 *                   (NORMAL_ATTRIB_LOCATION, b'normal_attr'),
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr'),
 *                   (TEXCOORD_ATTRIB_LOCATION, b'texcoord_attr'),             # <<<<<<<<<<<<<<
 *                  ]
 *     program.prog_render = _gl_create_program(vertex_source, fragment_source, attributes)
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_e_7_gldraw_TEXCOORD_ATTRIB_LOCATION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_b__texcoord_attr));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_n_b__texcoord_attr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_b__texcoord_attr));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_t_6));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_v_attributes = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "_glarea.pyx":535
 *                   (TEXCOORD_ATTRIB_LOCATION, b'texcoord_attr'),
 *                  ]
 *     program.prog_render = _gl_create_program(vertex_source, fragment_source, attributes)             # <<<<<<<<<<<<<<
 *     if program.prog_render > 0:
 *         glUseProgram(program.prog_render)
 */
  __pyx_v_7_glarea_program.prog_render = __pyx_f_7_glarea__gl_create_program(__pyx_v_vertex_source, __pyx_v_fragment_source, __pyx_v_attributes);

  /* "_glarea.pyx":536
 *                  ]
 *     program.prog_render = _gl_create_program(vertex_source, fragment_source, attributes)
 *     if program.prog_render > 0:             # <<<<<<<<<<<<<<
 *         glUseProgram(program.prog_render)
 *         location = glGetUniformLocation(program.prog_render, b'tex')
 */
  __pyx_t_1 = (__pyx_v_7_glarea_program.prog_render > 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":537
 *     program.prog_render = _gl_create_program(vertex_source, fragment_source, attributes)
 *     if program.prog_render > 0:
 *         glUseProgram(program.prog_render)             # <<<<<<<<<<<<<<
 *         location = glGetUniformLocation(program.prog_render, b'tex')
 *         glUniform1i(location, 0) # 0 is the texture unit (-> glActiveTexture)
 */
    glUseProgram(__pyx_v_7_glarea_program.prog_render);

    /* "_glarea.pyx":538
 *     if program.prog_render > 0:
 *         glUseProgram(program.prog_render)
 *         location = glGetUniformLocation(program.prog_render, b'tex')             # <<<<<<<<<<<<<<
 *         glUniform1i(location, 0) # 0 is the texture unit (-> glActiveTexture)
 *         program.modelview_location = glGetUniformLocation(program.prog_render, b'modelview')
 */
    __pyx_v_location = glGetUniformLocation(__pyx_v_7_glarea_program.prog_render, __pyx_k__tex);

    /* "_glarea.pyx":539
 *         glUseProgram(program.prog_render)
 *         location = glGetUniformLocation(program.prog_render, b'tex')
 *         glUniform1i(location, 0) # 0 is the texture unit (-> glActiveTexture)             # <<<<<<<<<<<<<<
 *         program.modelview_location = glGetUniformLocation(program.prog_render, b'modelview')
 *         program.projection_location = glGetUniformLocation(program.prog_render, b'projection')
 */
    glUniform1i(__pyx_v_location, 0);

    /* "_glarea.pyx":540
 *         location = glGetUniformLocation(program.prog_render, b'tex')
 *         glUniform1i(location, 0) # 0 is the texture unit (-> glActiveTexture)
 *         program.modelview_location = glGetUniformLocation(program.prog_render, b'modelview')             # <<<<<<<<<<<<<<
 *         program.projection_location = glGetUniformLocation(program.prog_render, b'projection')
 *         location = glGetUniformLocation(program.prog_render, b'object')
 */
    __pyx_v_7_glarea_program.modelview_location = glGetUniformLocation(__pyx_v_7_glarea_program.prog_render, __pyx_k__modelview);

    /* "_glarea.pyx":541
 *         glUniform1i(location, 0) # 0 is the texture unit (-> glActiveTexture)
 *         program.modelview_location = glGetUniformLocation(program.prog_render, b'modelview')
 *         program.projection_location = glGetUniformLocation(program.prog_render, b'projection')             # <<<<<<<<<<<<<<
 *         location = glGetUniformLocation(program.prog_render, b'object')
 *         gl_init_object_location(location)
 */
    __pyx_v_7_glarea_program.projection_location = glGetUniformLocation(__pyx_v_7_glarea_program.prog_render, __pyx_k__projection);

    /* "_glarea.pyx":542
 *         program.modelview_location = glGetUniformLocation(program.prog_render, b'modelview')
 *         program.projection_location = glGetUniformLocation(program.prog_render, b'projection')
 *         location = glGetUniformLocation(program.prog_render, b'object')             # <<<<<<<<<<<<<<
 *         gl_init_object_location(location)
 * 
 */
    __pyx_v_location = glGetUniformLocation(__pyx_v_7_glarea_program.prog_render, __pyx_k__object);

    /* "_glarea.pyx":543
 *         program.projection_location = glGetUniformLocation(program.prog_render, b'projection')
 *         location = glGetUniformLocation(program.prog_render, b'object')
 *         gl_init_object_location(location)             # <<<<<<<<<<<<<<
 * 
 * def gl_create_hud_program(bytes vertex_source, bytes fragment_source): #px/
 */
    __pyx_f_7_gldraw_gl_init_object_location(__pyx_v_location);
    goto __pyx_L4;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("_glarea.gl_create_render_program", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_27gl_create_hud_program(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_27gl_create_hud_program = {__Pyx_NAMESTR("gl_create_hud_program"), (PyCFunction)__pyx_pw_7_glarea_27gl_create_hud_program, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_27gl_create_hud_program(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vertex_source = 0;
  PyObject *__pyx_v_fragment_source = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gl_create_hud_program (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vertex_source,&__pyx_n_s__fragment_source,0};
    PyObject* values[2] = {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  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__vertex_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fragment_source)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gl_create_hud_program", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gl_create_hud_program") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_vertex_source = ((PyObject*)values[0]);
    __pyx_v_fragment_source = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gl_create_hud_program", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea.gl_create_hud_program", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vertex_source), (&PyBytes_Type), 1, "vertex_source", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fragment_source), (&PyBytes_Type), 1, "fragment_source", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7_glarea_26gl_create_hud_program(__pyx_self, __pyx_v_vertex_source, __pyx_v_fragment_source);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":545
 *         gl_init_object_location(location)
 * 
 * def gl_create_hud_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #px def gl_create_hud_program(vertex_source, fragment_source):
 *     cdef GLint location #px+
 */

static PyObject *__pyx_pf_7_glarea_26gl_create_hud_program(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vertex_source, PyObject *__pyx_v_fragment_source) {
  PyObject *__pyx_v_attributes = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_create_hud_program", 0);

  /* "_glarea.pyx":548
 * #px def gl_create_hud_program(vertex_source, fragment_source):
 *     cdef GLint location #px+
 *     if program.prog_hud > 0:             # <<<<<<<<<<<<<<
 *         glDeleteProgram(program.prog_hud)
 *     attributes = [
 */
  __pyx_t_1 = (__pyx_v_7_glarea_program.prog_hud > 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":549
 *     cdef GLint location #px+
 *     if program.prog_hud > 0:
 *         glDeleteProgram(program.prog_hud)             # <<<<<<<<<<<<<<
 *     attributes = [
 *                   (VERTEX_ATTRIB_LOCATION, b'vertex_attr'),
 */
    glDeleteProgram(__pyx_v_7_glarea_program.prog_hud);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":551
 *         glDeleteProgram(program.prog_hud)
 *     attributes = [
 *                   (VERTEX_ATTRIB_LOCATION, b'vertex_attr'),             # <<<<<<<<<<<<<<
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr'),
 *                  ]
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_e_7_gldraw_VERTEX_ATTRIB_LOCATION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_b__vertex_attr));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_b__vertex_attr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_b__vertex_attr));
  __pyx_t_2 = 0;

  /* "_glarea.pyx":552
 *     attributes = [
 *                   (VERTEX_ATTRIB_LOCATION, b'vertex_attr'),
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr'),             # <<<<<<<<<<<<<<
 *                  ]
 *     program.prog_hud = _gl_create_program(vertex_source, fragment_source, attributes)
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_e_7_gldraw_COLOR_ATTRIB_LOCATION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_b__color_attr));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_b__color_attr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_b__color_attr));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_v_attributes = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "_glarea.pyx":554
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr'),
 *                  ]
 *     program.prog_hud = _gl_create_program(vertex_source, fragment_source, attributes)             # <<<<<<<<<<<<<<
 *     if program.prog_hud > 0:
 *         glUseProgram(program.prog_hud)
 */
  __pyx_v_7_glarea_program.prog_hud = __pyx_f_7_glarea__gl_create_program(__pyx_v_vertex_source, __pyx_v_fragment_source, __pyx_v_attributes);

  /* "_glarea.pyx":555
 *                  ]
 *     program.prog_hud = _gl_create_program(vertex_source, fragment_source, attributes)
 *     if program.prog_hud > 0:             # <<<<<<<<<<<<<<
 *         glUseProgram(program.prog_hud)
 * 
 */
  __pyx_t_1 = (__pyx_v_7_glarea_program.prog_hud > 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":556
 *     program.prog_hud = _gl_create_program(vertex_source, fragment_source, attributes)
 *     if program.prog_hud > 0:
 *         glUseProgram(program.prog_hud)             # <<<<<<<<<<<<<<
 * 
 * def gl_create_pick_program(bytes vertex_source, bytes fragment_source): #px/
 */
    glUseProgram(__pyx_v_7_glarea_program.prog_hud);
    goto __pyx_L4;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_glarea.gl_create_hud_program", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_29gl_create_pick_program(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_29gl_create_pick_program = {__Pyx_NAMESTR("gl_create_pick_program"), (PyCFunction)__pyx_pw_7_glarea_29gl_create_pick_program, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_7_glarea_29gl_create_pick_program(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vertex_source = 0;
  PyObject *__pyx_v_fragment_source = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gl_create_pick_program (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__vertex_source,&__pyx_n_s__fragment_source,0};
    PyObject* values[2] = {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  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__vertex_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fragment_source)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gl_create_pick_program", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gl_create_pick_program") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_vertex_source = ((PyObject*)values[0]);
    __pyx_v_fragment_source = ((PyObject*)values[1]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gl_create_pick_program", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea.gl_create_pick_program", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vertex_source), (&PyBytes_Type), 1, "vertex_source", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fragment_source), (&PyBytes_Type), 1, "fragment_source", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_7_glarea_28gl_create_pick_program(__pyx_self, __pyx_v_vertex_source, __pyx_v_fragment_source);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":558
 *         glUseProgram(program.prog_hud)
 * 
 * def gl_create_pick_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #px def gl_create_pick_program(vertex_source, fragment_source):
 *     if program.prog_pick > 0:
 */

static PyObject *__pyx_pf_7_glarea_28gl_create_pick_program(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vertex_source, PyObject *__pyx_v_fragment_source) {
  PyObject *__pyx_v_attributes = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_create_pick_program", 0);

  /* "_glarea.pyx":560
 * def gl_create_pick_program(bytes vertex_source, bytes fragment_source): #px/
 * #px def gl_create_pick_program(vertex_source, fragment_source):
 *     if program.prog_pick > 0:             # <<<<<<<<<<<<<<
 *         glDeleteProgram(program.prog_pick)
 *     attributes = [(VERTEX_ATTRIB_LOCATION, b'vertex_attr'),
 */
  __pyx_t_1 = (__pyx_v_7_glarea_program.prog_pick > 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":561
 * #px def gl_create_pick_program(vertex_source, fragment_source):
 *     if program.prog_pick > 0:
 *         glDeleteProgram(program.prog_pick)             # <<<<<<<<<<<<<<
 *     attributes = [(VERTEX_ATTRIB_LOCATION, b'vertex_attr'),
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr')]
 */
    glDeleteProgram(__pyx_v_7_glarea_program.prog_pick);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":562
 *     if program.prog_pick > 0:
 *         glDeleteProgram(program.prog_pick)
 *     attributes = [(VERTEX_ATTRIB_LOCATION, b'vertex_attr'),             # <<<<<<<<<<<<<<
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr')]
 *     program.prog_pick = _gl_create_program(vertex_source, fragment_source, attributes)
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_e_7_gldraw_VERTEX_ATTRIB_LOCATION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_b__vertex_attr));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_b__vertex_attr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_b__vertex_attr));
  __pyx_t_2 = 0;

  /* "_glarea.pyx":563
 *         glDeleteProgram(program.prog_pick)
 *     attributes = [(VERTEX_ATTRIB_LOCATION, b'vertex_attr'),
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr')]             # <<<<<<<<<<<<<<
 *     program.prog_pick = _gl_create_program(vertex_source, fragment_source, attributes)
 *     if program.prog_pick > 0:
 */
  __pyx_t_2 = PyInt_FromLong(__pyx_e_7_gldraw_COLOR_ATTRIB_LOCATION); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_b__color_attr));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_b__color_attr));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_b__color_attr));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_v_attributes = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "_glarea.pyx":564
 *     attributes = [(VERTEX_ATTRIB_LOCATION, b'vertex_attr'),
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr')]
 *     program.prog_pick = _gl_create_program(vertex_source, fragment_source, attributes)             # <<<<<<<<<<<<<<
 *     if program.prog_pick > 0:
 *         glUseProgram(program.prog_pick)
 */
  __pyx_v_7_glarea_program.prog_pick = __pyx_f_7_glarea__gl_create_program(__pyx_v_vertex_source, __pyx_v_fragment_source, __pyx_v_attributes);

  /* "_glarea.pyx":565
 *                   (COLOR_ATTRIB_LOCATION, b'color_attr')]
 *     program.prog_pick = _gl_create_program(vertex_source, fragment_source, attributes)
 *     if program.prog_pick > 0:             # <<<<<<<<<<<<<<
 *         glUseProgram(program.prog_pick)
 *         program.picking_location = glGetUniformLocation(program.prog_pick, b'picking')
 */
  __pyx_t_1 = (__pyx_v_7_glarea_program.prog_pick > 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":566
 *     program.prog_pick = _gl_create_program(vertex_source, fragment_source, attributes)
 *     if program.prog_pick > 0:
 *         glUseProgram(program.prog_pick)             # <<<<<<<<<<<<<<
 *         program.picking_location = glGetUniformLocation(program.prog_pick, b'picking')
 *         program.projection_pick_location = glGetUniformLocation(program.prog_pick, b'projection')
 */
    glUseProgram(__pyx_v_7_glarea_program.prog_pick);

    /* "_glarea.pyx":567
 *     if program.prog_pick > 0:
 *         glUseProgram(program.prog_pick)
 *         program.picking_location = glGetUniformLocation(program.prog_pick, b'picking')             # <<<<<<<<<<<<<<
 *         program.projection_pick_location = glGetUniformLocation(program.prog_pick, b'projection')
 *         program.modelview_pick_location = glGetUniformLocation(program.prog_pick, b'modelview')
 */
    __pyx_v_7_glarea_program.picking_location = glGetUniformLocation(__pyx_v_7_glarea_program.prog_pick, __pyx_k__picking);

    /* "_glarea.pyx":568
 *         glUseProgram(program.prog_pick)
 *         program.picking_location = glGetUniformLocation(program.prog_pick, b'picking')
 *         program.projection_pick_location = glGetUniformLocation(program.prog_pick, b'projection')             # <<<<<<<<<<<<<<
 *         program.modelview_pick_location = glGetUniformLocation(program.prog_pick, b'modelview')
 * 
 */
    __pyx_v_7_glarea_program.projection_pick_location = glGetUniformLocation(__pyx_v_7_glarea_program.prog_pick, __pyx_k__projection);

    /* "_glarea.pyx":569
 *         program.picking_location = glGetUniformLocation(program.prog_pick, b'picking')
 *         program.projection_pick_location = glGetUniformLocation(program.prog_pick, b'projection')
 *         program.modelview_pick_location = glGetUniformLocation(program.prog_pick, b'modelview')             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_7_glarea_program.modelview_pick_location = glGetUniformLocation(__pyx_v_7_glarea_program.prog_pick, __pyx_k__modelview);
    goto __pyx_L4;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_glarea.gl_create_pick_program", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_attributes);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("gl_pick_polygons"), (PyCFunction)__pyx_pw_7_glarea_21gl_pick_polygons, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("_glarea"),
    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_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1},
  {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0},
  {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
  {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0},
  {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0},
  {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0},
  {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0},
  {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0},
  {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 1, 0, 0},
  {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0},
  {&__pyx_kp_u_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 1, 0, 0},
  {&__pyx_kp_u_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 1, 0, 0},
  {&__pyx_kp_u_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 1, 0, 0},
  {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0},
  {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0},
  {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0, 0},
  {&__pyx_kp_u_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 1, 0, 0},
  {&__pyx_kp_u_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0, 0},
  {&__pyx_kp_u_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 1, 0, 0},
  {&__pyx_kp_u_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 1, 0, 0},
  {&__pyx_kp_u_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 1, 0, 0},
  {&__pyx_kp_u_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0, 0},
  {&__pyx_kp_u_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 0, 0},
  {&__pyx_kp_u_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 1, 0, 0},
  {&__pyx_kp_u_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 1, 0, 0},
  {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0},
  {&__pyx_kp_u_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 1, 0, 0},
  {&__pyx_kp_u_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 1, 0, 0},
  {&__pyx_kp_u_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 1, 0, 0},
  {&__pyx_kp_u_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 1, 0, 0},
  {&__pyx_kp_u_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 1, 0, 0},
  {&__pyx_kp_u_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 1, 0, 0},
  {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0},
  {&__pyx_kp_u_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 1, 0, 0},
  {&__pyx_kp_u_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 1, 0, 0},
  {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
  {&__pyx_n_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 1},
  {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0},
  {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0},
  {&__pyx_n_s_72, __pyx_k_72, sizeof(__pyx_k_72), 0, 0, 1, 1},
  {&__pyx_n_s_77, __pyx_k_77, sizeof(__pyx_k_77), 0, 0, 1, 1},
  {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
  {&__pyx_n_s_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 1, 1},
  {&__pyx_n_s_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 0, 1, 1},
  {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0},
  {&__pyx_n_s__DEBUG_DRAW, __pyx_k__DEBUG_DRAW, sizeof(__pyx_k__DEBUG_DRAW), 0, 0, 1, 1},
  {&__pyx_n_s__DEBUG_MSG, __pyx_k__DEBUG_MSG, sizeof(__pyx_k__DEBUG_MSG), 0, 0, 1, 1},
  {&__pyx_n_s__DEBUG_NOFSHADER, __pyx_k__DEBUG_NOFSHADER, sizeof(__pyx_k__DEBUG_NOFSHADER), 0, 0, 1, 1},
  {&__pyx_n_s__DEBUG_NOSHADER, __pyx_k__DEBUG_NOSHADER, sizeof(__pyx_k__DEBUG_NOSHADER), 0, 0, 1, 1},
  {&__pyx_n_s__DEBUG_NOVSHADER, __pyx_k__DEBUG_NOVSHADER, sizeof(__pyx_k__DEBUG_NOVSHADER), 0, 0, 1, 1},
  {&__pyx_n_s__DEBUG_PICK, __pyx_k__DEBUG_PICK, sizeof(__pyx_k__DEBUG_PICK), 0, 0, 1, 1},
  {&__pyx_n_u__GL, __pyx_k__GL, sizeof(__pyx_k__GL), 0, 1, 0, 1},
  {&__pyx_n_s____compiled, __pyx_k____compiled, sizeof(__pyx_k____compiled), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
  {&__pyx_n_s____package__, __pyx_k____package__, sizeof(__pyx_k____package__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s___glarea, __pyx_k___glarea, sizeof(__pyx_k___glarea), 0, 0, 1, 1},
  {&__pyx_n_s__angle, __pyx_k__angle, sizeof(__pyx_k__angle), 0, 0, 1, 1},
  {&__pyx_n_s__attributes, __pyx_k__attributes, sizeof(__pyx_k__attributes), 0, 0, 1, 1},
  {&__pyx_n_s__blue, __pyx_k__blue, sizeof(__pyx_k__blue), 0, 0, 1, 1},
  {&__pyx_n_b__color_attr, __pyx_k__color_attr, sizeof(__pyx_k__color_attr), 0, 0, 0, 1},
  {&__pyx_n_s__debug, __pyx_k__debug, sizeof(__pyx_k__debug), 0, 0, 1, 1},
  {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
  {&__pyx_n_s__fragment_source, __pyx_k__fragment_source, sizeof(__pyx_k__fragment_source), 0, 0, 1, 1},
  {&__pyx_n_s__get_cursor_angle, __pyx_k__get_cursor_angle, sizeof(__pyx_k__get_cursor_angle), 0, 0, 1, 1},
  {&__pyx_n_s__gl_exit, __pyx_k__gl_exit, sizeof(__pyx_k__gl_exit), 0, 0, 1, 1},
  {&__pyx_n_s__gl_init, __pyx_k__gl_init, sizeof(__pyx_k__gl_init), 0, 0, 1, 1},
  {&__pyx_n_s__gl_render, __pyx_k__gl_render, sizeof(__pyx_k__gl_render), 0, 0, 1, 1},
  {&__pyx_n_s__gl_resize, __pyx_k__gl_resize, sizeof(__pyx_k__gl_resize), 0, 0, 1, 1},
  {&__pyx_n_s__green, __pyx_k__green, sizeof(__pyx_k__green), 0, 0, 1, 1},
  {&__pyx_n_s__height, __pyx_k__height, sizeof(__pyx_k__height), 0, 0, 1, 1},
  {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
  {&__pyx_n_s__init_module, __pyx_k__init_module, sizeof(__pyx_k__init_module), 0, 0, 1, 1},
  {&__pyx_n_s__location, __pyx_k__location, sizeof(__pyx_k__location), 0, 0, 1, 1},
  {&__pyx_n_s__multisample, __pyx_k__multisample, sizeof(__pyx_k__multisample), 0, 0, 1, 1},
  {&__pyx_n_b__normal_attr, __pyx_k__normal_attr, sizeof(__pyx_k__normal_attr), 0, 0, 0, 1},
  {&__pyx_n_s__point1, __pyx_k__point1, sizeof(__pyx_k__point1), 0, 0, 1, 1},
  {&__pyx_n_s__point2, __pyx_k__point2, sizeof(__pyx_k__point2), 0, 0, 1, 1},
  {&__pyx_n_s__print, __pyx_k__print, sizeof(__pyx_k__print), 0, 0, 1, 1},
  {&__pyx_n_s__prog, __pyx_k__prog, sizeof(__pyx_k__prog), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__red, __pyx_k__red, sizeof(__pyx_k__red), 0, 0, 1, 1},
  {&__pyx_n_s__rstrip, __pyx_k__rstrip, sizeof(__pyx_k__rstrip), 0, 0, 1, 1},
  {&__pyx_n_s__selectdata, __pyx_k__selectdata, sizeof(__pyx_k__selectdata), 0, 0, 1, 1},
  {&__pyx_n_s__set_antialiasing, __pyx_k__set_antialiasing, sizeof(__pyx_k__set_antialiasing), 0, 0, 1, 1},
  {&__pyx_n_s__set_frustrum, __pyx_k__set_frustrum, sizeof(__pyx_k__set_frustrum), 0, 0, 1, 1},
  {&__pyx_n_s__set_rotation_xy, __pyx_k__set_rotation_xy, sizeof(__pyx_k__set_rotation_xy), 0, 0, 1, 1},
  {&__pyx_n_b__texcoord_attr, __pyx_k__texcoord_attr, sizeof(__pyx_k__texcoord_attr), 0, 0, 0, 1},
  {&__pyx_n_b__vertex_attr, __pyx_k__vertex_attr, sizeof(__pyx_k__vertex_attr), 0, 0, 0, 1},
  {&__pyx_n_s__vertex_source, __pyx_k__vertex_source, sizeof(__pyx_k__vertex_source), 0, 0, 1, 1},
  {&__pyx_n_s__width, __pyx_k__width, sizeof(__pyx_k__width), 0, 0, 1, 1},
  {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
  {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1},
  {&__pyx_n_s__zoom, __pyx_k__zoom, sizeof(__pyx_k__zoom), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_print = __Pyx_GetName(__pyx_b, __pyx_n_s__print); if (!__pyx_builtin_print) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "_glarea.pyx":242
 * def gl_init():
 *     if DEBUG_MSG:
 *         print('GL Strings:')             # <<<<<<<<<<<<<<
 *         _gl_print_string('  GL Vendor:', GL_VENDOR)
 *         _gl_print_string('  GL Renderer:', GL_RENDERER)
 */
  __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_2));
  PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_u_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));

  /* "_glarea.pyx":407
 *     #px log_len = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:
 *         print('==== Error compiling shader:')             # <<<<<<<<<<<<<<
 *         glGetShaderInfoLog(shader, 1023, &length, log) #px/
 *         #px log = glGetShaderInfoLog(shader, 1023)
 */
  __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_16);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_15));
  PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_u_15));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));

  /* "_glarea.pyx":411
 *         #px log = glGetShaderInfoLog(shader, 1023)
 *         print(log.decode('utf-8').rstrip())
 *         print('====')             # <<<<<<<<<<<<<<
 *     else:
 *         print('==== Error compiling shader (no log)')
 */
  __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_18);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_17));
  PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_u_17));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_17));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));

  /* "_glarea.pyx":413
 *         print('====')
 *     else:
 *         print('==== Error compiling shader (no log)')             # <<<<<<<<<<<<<<
 * 
 * cdef void _gl_print_program_log(GLuint program): #px/
 */
  __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_20);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_19));
  PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_u_19));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));

  /* "_glarea.pyx":423
 *     #px log_len = glGetProgramiv(program, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:
 *         print('==== Error linking shader program:')             # <<<<<<<<<<<<<<
 *         glGetProgramInfoLog(program, 1023, &length, log) #px/
 *         #px log = glGetProgramInfoLog(program, 1023)
 */
  __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_22);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_21));
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_u_21));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_21));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));

  /* "_glarea.pyx":427
 *         #px log = glGetProgramInfoLog(program, 1023)
 *         print(log.decode('utf-8').rstrip())
 *         print('====')             # <<<<<<<<<<<<<<
 *     else:
 *         print('==== Error linking shader program (no log)')
 */
  __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_23);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_17));
  PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_u_17));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_17));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));

  /* "_glarea.pyx":429
 *         print('====')
 *     else:
 *         print('==== Error linking shader program (no log)')             # <<<<<<<<<<<<<<
 * 
 * cdef GLuint _gl_create_compiled_shader(GLenum shadertype, bytes source): #px/
 */
  __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_25);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_24));
  PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_kp_u_24));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_24));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));

  /* "_glarea.pyx":439
 *     shader = glCreateShader(shadertype)
 *     if shader == 0:
 *         print('Failed to create shader')             # <<<<<<<<<<<<<<
 *         return 0
 *     pchar = <const_GLchar_ptr><char*>source #px+
 */
  __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_27);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_26));
  PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_u_26));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_26));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));

  /* "_glarea.pyx":477
 *         program_info[pname] = param
 *         print(' ', msg, param)
 *     print('active attributes:')             # <<<<<<<<<<<<<<
 *     for i in range(program_info[GL_ACTIVE_ATTRIBUTES]):
 *         glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) #px/
 */
  __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_40);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_39));
  PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_u_39));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_39));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));

  /* "_glarea.pyx":483
 *         location = glGetAttribLocation(program, aname)
 *         print('  {}, {}: length={} size={} type={} location={}'.format(i, aname, alength, asize, atype, location))
 *     print('active uniforms:')             # <<<<<<<<<<<<<<
 *     for i in range(program_info[GL_ACTIVE_UNIFORMS]):
 *         glGetActiveUniform(program, i, 1023, &alength, &asize, &atype, aname) #px/
 */
  __pyx_k_tuple_43 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_43);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_42));
  PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_kp_u_42));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_42));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43));

  /* "_glarea.pyx":501
 *     program = glCreateProgram()
 *     if not DEBUG_NOVSHADER:
 *         debug('  creating vertex shader')             # <<<<<<<<<<<<<<
 *         vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *         glAttachShader(program, vertex_shader)
 */
  __pyx_k_tuple_45 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_45);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_44));
  PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_kp_u_44));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_44));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45));

  /* "_glarea.pyx":505
 *         glAttachShader(program, vertex_shader)
 *     if not DEBUG_NOFSHADER:
 *         debug('  creating fragment shader')             # <<<<<<<<<<<<<<
 *         fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *         glAttachShader(program, fragment_shader)
 */
  __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_47);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_46));
  PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_kp_u_46));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_46));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47));

  /* "_glarea.pyx":56
 * debug('  from package:', __package__)
 * debug('  compiled:', __compiled)
 * debug('  GL/GLES:', SOURCEGLVERSION)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_k_tuple_52 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_52);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_51));
  PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, ((PyObject *)__pyx_kp_u_51));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_51));
  __Pyx_INCREF(((PyObject *)__pyx_n_u__GL));
  PyTuple_SET_ITEM(__pyx_k_tuple_52, 1, ((PyObject *)__pyx_n_u__GL));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_u__GL));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_52));

  /* "_glarea.pyx":100
 * ### module state
 * 
 * def init_module():             # <<<<<<<<<<<<<<
 *     terrain.red = 0.0
 *     terrain.green = 0.0
 */
  __pyx_k_codeobj_53 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__init_module, 100, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":190
 *     frustrum.picking_matrix[1][1] = 1.
 * 
 * def set_frustrum(bounding_sphere_radius, zoom):             # <<<<<<<<<<<<<<
 *     frustrum.bounding_sphere_radius = bounding_sphere_radius
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius / zoom
 */
  __pyx_k_tuple_55 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_55);
  __Pyx_INCREF(((PyObject *)__pyx_n_s_1));
  PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_n_s_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__zoom));
  PyTuple_SET_ITEM(__pyx_k_tuple_55, 1, ((PyObject *)__pyx_n_s__zoom));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zoom));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));
  __pyx_k_codeobj_56 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__set_frustrum, 190, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":196
 *     _update_projection_matrix()
 * 
 * def set_background_color(red, green, blue):             # <<<<<<<<<<<<<<
 *     terrain.red = red
 *     terrain.green = green
 */
  __pyx_k_tuple_57 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_57);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__red));
  PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_n_s__red));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__red));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__green));
  PyTuple_SET_ITEM(__pyx_k_tuple_57, 1, ((PyObject *)__pyx_n_s__green));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__green));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__blue));
  PyTuple_SET_ITEM(__pyx_k_tuple_57, 2, ((PyObject *)__pyx_n_s__blue));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__blue));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
  __pyx_k_codeobj_58 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s_59, 196, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":201
 *     terrain.blue = blue
 * 
 * def set_antialiasing(multisample):             # <<<<<<<<<<<<<<
 *     frustrum.multisample = multisample
 * 
 */
  __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_60);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__multisample));
  PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_n_s__multisample));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multisample));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));
  __pyx_k_codeobj_61 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__set_antialiasing, 201, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":204
 *     frustrum.multisample = multisample
 * 
 * def set_rotation_xy(x, y):             # <<<<<<<<<<<<<<
 *     x %= 360
 *     # pylint: disable=C0321
 */
  __pyx_k_tuple_62 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_62);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
  PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_n_s__x));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__y));
  PyTuple_SET_ITEM(__pyx_k_tuple_62, 1, ((PyObject *)__pyx_n_s__y));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));
  __pyx_k_codeobj_63 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__set_rotation_xy, 204, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":240
 *     print(msg, i)
 * 
 * def gl_init():             # <<<<<<<<<<<<<<
 *     if DEBUG_MSG:
 *         print('GL Strings:')
 */
  __pyx_k_codeobj_64 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__gl_init, 240, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":266
 *     gl_init_buffers()
 * 
 * def gl_exit():             # <<<<<<<<<<<<<<
 *     gl_delete_buffers()
 *     cdef GLuint prog #px+
 */
  __pyx_k_tuple_65 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_65);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__prog));
  PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, ((PyObject *)__pyx_n_s__prog));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__prog));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));
  __pyx_k_codeobj_66 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__gl_exit, 266, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":276
 *     program.prog_pick = 0
 * 
 * def gl_resize(width, height):             # <<<<<<<<<<<<<<
 *     terrain.width = width
 *     terrain.height = height
 */
  __pyx_k_tuple_67 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_67);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__width));
  PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_n_s__width));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__width));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__height));
  PyTuple_SET_ITEM(__pyx_k_tuple_67, 1, ((PyObject *)__pyx_n_s__height));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__height));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
  __pyx_k_codeobj_68 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__gl_resize, 276, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":289
 *     #px glUniformMatrix4fv(location, 1, GL_FALSE, matrix)
 * 
 * def gl_render():             # <<<<<<<<<<<<<<
 *     if DEBUG_PICK:
 *         _set_picking_matrix_identity()
 */
  __pyx_k_codeobj_69 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__gl_render, 289, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":309
 *         gl_draw_cube_debug()
 * 
 * def gl_render_select_debug():             # <<<<<<<<<<<<<<
 *     cdef GLfloat selectdata[12] #px+
 *     selectdata[0] = selection_debug_points.modelview1[0]
 */
  __pyx_k_tuple_70 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_70);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__selectdata));
  PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, ((PyObject *)__pyx_n_s__selectdata));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__selectdata));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70));
  __pyx_k_codeobj_71 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s_72, 309, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":381
 *     mvect[1] = int((v1 / v3 + 1) / 2 * terrain.height)
 * 
 * def get_cursor_angle(point1, point2):             # <<<<<<<<<<<<<<
 *     '''The result is the angle (on the screen)
 *     at which the mouse cursor needs to be drawn.'''
 */
  __pyx_k_tuple_73 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_73);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__point1));
  PyTuple_SET_ITEM(__pyx_k_tuple_73, 0, ((PyObject *)__pyx_n_s__point1));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__point1));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__point2));
  PyTuple_SET_ITEM(__pyx_k_tuple_73, 1, ((PyObject *)__pyx_n_s__point2));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__point2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__angle));
  PyTuple_SET_ITEM(__pyx_k_tuple_73, 2, ((PyObject *)__pyx_n_s__angle));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__angle));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
  PyTuple_SET_ITEM(__pyx_k_tuple_73, 3, ((PyObject *)__pyx_n_s__i));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__x));
  PyTuple_SET_ITEM(__pyx_k_tuple_73, 4, ((PyObject *)__pyx_n_s__x));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__y));
  PyTuple_SET_ITEM(__pyx_k_tuple_73, 5, ((PyObject *)__pyx_n_s__y));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73));
  __pyx_k_codeobj_74 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s__get_cursor_angle, 381, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":524
 *     return program
 * 
 * def gl_create_render_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #px def gl_create_render_program(vertex_source, fragment_source):
 *     cdef GLint location #px+
 */
  __pyx_k_tuple_75 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_75);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vertex_source));
  PyTuple_SET_ITEM(__pyx_k_tuple_75, 0, ((PyObject *)__pyx_n_s__vertex_source));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vertex_source));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fragment_source));
  PyTuple_SET_ITEM(__pyx_k_tuple_75, 1, ((PyObject *)__pyx_n_s__fragment_source));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fragment_source));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__location));
  PyTuple_SET_ITEM(__pyx_k_tuple_75, 2, ((PyObject *)__pyx_n_s__location));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__location));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__attributes));
  PyTuple_SET_ITEM(__pyx_k_tuple_75, 3, ((PyObject *)__pyx_n_s__attributes));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__attributes));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_75));
  __pyx_k_codeobj_76 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s_77, 524, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":545
 *         gl_init_object_location(location)
 * 
 * def gl_create_hud_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #px def gl_create_hud_program(vertex_source, fragment_source):
 *     cdef GLint location #px+
 */
  __pyx_k_tuple_78 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_78);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vertex_source));
  PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, ((PyObject *)__pyx_n_s__vertex_source));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vertex_source));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fragment_source));
  PyTuple_SET_ITEM(__pyx_k_tuple_78, 1, ((PyObject *)__pyx_n_s__fragment_source));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fragment_source));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__location));
  PyTuple_SET_ITEM(__pyx_k_tuple_78, 2, ((PyObject *)__pyx_n_s__location));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__location));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__attributes));
  PyTuple_SET_ITEM(__pyx_k_tuple_78, 3, ((PyObject *)__pyx_n_s__attributes));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__attributes));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78));
  __pyx_k_codeobj_79 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s_80, 545, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":558
 *         glUseProgram(program.prog_hud)
 * 
 * def gl_create_pick_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #px def gl_create_pick_program(vertex_source, fragment_source):
 *     if program.prog_pick > 0:
 */
  __pyx_k_tuple_81 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_81);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__vertex_source));
  PyTuple_SET_ITEM(__pyx_k_tuple_81, 0, ((PyObject *)__pyx_n_s__vertex_source));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vertex_source));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fragment_source));
  PyTuple_SET_ITEM(__pyx_k_tuple_81, 1, ((PyObject *)__pyx_n_s__fragment_source));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fragment_source));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__attributes));
  PyTuple_SET_ITEM(__pyx_k_tuple_81, 2, ((PyObject *)__pyx_n_s__attributes));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__attributes));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81));
  __pyx_k_codeobj_82 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_54, __pyx_n_s_83, 558, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

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;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_90 = PyInt_FromLong(90); if (unlikely(!__pyx_int_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_90 = PyInt_FromLong(-90); if (unlikely(!__pyx_int_neg_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_360 = PyInt_FromLong(360); if (unlikely(!__pyx_int_360)) {__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_glarea(void); /*proto*/
PyMODINIT_FUNC init_glarea(void)
#else
PyMODINIT_FUNC PyInit__glarea(void); /*proto*/
PyMODINIT_FUNC PyInit__glarea(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = 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__glarea(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("_glarea"), __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, "_glarea")) {
      if (unlikely(PyDict_SetItemString(modules, "_glarea", __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__glarea) {
    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 ---*/
  __pyx_t_1 = __Pyx_ImportModule("_gldraw"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_draw_cube", (void (**)(void))&__pyx_f_7_gldraw_gl_draw_cube, "void (void)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_pick_cube", (void (**)(void))&__pyx_f_7_gldraw_gl_pick_cube, "void (void)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_init_buffers", (void (**)(void))&__pyx_f_7_gldraw_gl_init_buffers, "void (void)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_delete_buffers", (void (**)(void))&__pyx_f_7_gldraw_gl_delete_buffers, "void (void)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_draw_cube_debug", (void (**)(void))&__pyx_f_7_gldraw_gl_draw_cube_debug, "void (void)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_draw_select_debug", (void (**)(void))&__pyx_f_7_gldraw_gl_draw_select_debug, "void (__pyx_t_2gl_GLfloat *, __pyx_t_2gl_GLsizeiptr, __pyx_t_2gl_GLuint)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_init_object_location", (void (**)(void))&__pyx_f_7_gldraw_gl_init_object_location, "void (__pyx_t_2gl_GLuint)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*--- Execution code ---*/

  /* "_glarea.pyx":30
 * # This line makes cython happy
 * global __name__, __package__    # pylint: disable=W0604
 * __compiled = True #px/             # <<<<<<<<<<<<<<
 * #px __compiled = False
 * 
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____compiled, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":48
 * # pylint: enable=W0614,W0401
 * 
 * from .debug import debug, DEBUG_DRAW, DEBUG_PICK, DEBUG_MSG, DEBUG_NOVSHADER, DEBUG_NOFSHADER, DEBUG_NOSHADER             # <<<<<<<<<<<<<<
 * 
 * DEF SOURCEGLVERSION = 'GL' #px/
 */
  __pyx_t_2 = PyList_New(7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__debug));
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__debug));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__debug));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DEBUG_DRAW));
  PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__DEBUG_DRAW));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DEBUG_DRAW));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DEBUG_PICK));
  PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__DEBUG_PICK));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DEBUG_PICK));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DEBUG_MSG));
  PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__DEBUG_MSG));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DEBUG_MSG));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DEBUG_NOVSHADER));
  PyList_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_n_s__DEBUG_NOVSHADER));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DEBUG_NOVSHADER));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DEBUG_NOFSHADER));
  PyList_SET_ITEM(__pyx_t_2, 5, ((PyObject *)__pyx_n_s__DEBUG_NOFSHADER));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DEBUG_NOFSHADER));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DEBUG_NOSHADER));
  PyList_SET_ITEM(__pyx_t_2, 6, ((PyObject *)__pyx_n_s__DEBUG_NOSHADER));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DEBUG_NOSHADER));
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__debug), ((PyObject *)__pyx_t_2), 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__debug);
  if (__pyx_t_2 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__debug);
    if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__debug, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__DEBUG_DRAW);
  if (__pyx_t_2 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__DEBUG_DRAW);
    if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEBUG_DRAW, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__DEBUG_PICK);
  if (__pyx_t_2 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__DEBUG_PICK);
    if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEBUG_PICK, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__DEBUG_MSG);
  if (__pyx_t_2 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__DEBUG_MSG);
    if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEBUG_MSG, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__DEBUG_NOVSHADER);
  if (__pyx_t_2 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__DEBUG_NOVSHADER);
    if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEBUG_NOVSHADER, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__DEBUG_NOFSHADER);
  if (__pyx_t_2 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__DEBUG_NOFSHADER);
    if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEBUG_NOFSHADER, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__DEBUG_NOSHADER);
  if (__pyx_t_2 == NULL) {
    if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__DEBUG_NOSHADER);
    if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEBUG_NOSHADER, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_glarea.pyx":53
 * #px SOURCEGLVERSION = 'GL'
 * 
 * debug('Importing module:', __name__)             # <<<<<<<<<<<<<<
 * debug('  from package:', __package__)
 * debug('  compiled:', __compiled)
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s____name__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_48));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_48));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_48));
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":54
 * 
 * debug('Importing module:', __name__)
 * debug('  from package:', __package__)             # <<<<<<<<<<<<<<
 * debug('  compiled:', __compiled)
 * debug('  GL/GLES:', SOURCEGLVERSION)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__debug); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s____package__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_49));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_49));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_49));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "_glarea.pyx":55
 * debug('Importing module:', __name__)
 * debug('  from package:', __package__)
 * debug('  compiled:', __compiled)             # <<<<<<<<<<<<<<
 * debug('  GL/GLES:', SOURCEGLVERSION)
 * 
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s____compiled); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_u_50));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_u_50));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_50));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_glarea.pyx":56
 * debug('  from package:', __package__)
 * debug('  compiled:', __compiled)
 * debug('  GL/GLES:', SOURCEGLVERSION)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_52), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":100
 * ### module state
 * 
 * def init_module():             # <<<<<<<<<<<<<<
 *     terrain.red = 0.0
 *     terrain.green = 0.0
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_1init_module, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__init_module, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":190
 *     frustrum.picking_matrix[1][1] = 1.
 * 
 * def set_frustrum(bounding_sphere_radius, zoom):             # <<<<<<<<<<<<<<
 *     frustrum.bounding_sphere_radius = bounding_sphere_radius
 *     frustrum.fovy_radius_zoom = frustrum.fovy_radius / zoom
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_3set_frustrum, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_frustrum, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":196
 *     _update_projection_matrix()
 * 
 * def set_background_color(red, green, blue):             # <<<<<<<<<<<<<<
 *     terrain.red = red
 *     terrain.green = green
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_5set_background_color, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_59, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":201
 *     terrain.blue = blue
 * 
 * def set_antialiasing(multisample):             # <<<<<<<<<<<<<<
 *     frustrum.multisample = multisample
 * 
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_7set_antialiasing, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_antialiasing, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":204
 *     frustrum.multisample = multisample
 * 
 * def set_rotation_xy(x, y):             # <<<<<<<<<<<<<<
 *     x %= 360
 *     # pylint: disable=C0321
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_9set_rotation_xy, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__set_rotation_xy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":240
 *     print(msg, i)
 * 
 * def gl_init():             # <<<<<<<<<<<<<<
 *     if DEBUG_MSG:
 *         print('GL Strings:')
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_11gl_init, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gl_init, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":266
 *     gl_init_buffers()
 * 
 * def gl_exit():             # <<<<<<<<<<<<<<
 *     gl_delete_buffers()
 *     cdef GLuint prog #px+
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_13gl_exit, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gl_exit, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":276
 *     program.prog_pick = 0
 * 
 * def gl_resize(width, height):             # <<<<<<<<<<<<<<
 *     terrain.width = width
 *     terrain.height = height
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_15gl_resize, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gl_resize, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":289
 *     #px glUniformMatrix4fv(location, 1, GL_FALSE, matrix)
 * 
 * def gl_render():             # <<<<<<<<<<<<<<
 *     if DEBUG_PICK:
 *         _set_picking_matrix_identity()
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_17gl_render, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gl_render, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":309
 *         gl_draw_cube_debug()
 * 
 * def gl_render_select_debug():             # <<<<<<<<<<<<<<
 *     cdef GLfloat selectdata[12] #px+
 *     selectdata[0] = selection_debug_points.modelview1[0]
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_19gl_render_select_debug, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_72, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":381
 *     mvect[1] = int((v1 / v3 + 1) / 2 * terrain.height)
 * 
 * def get_cursor_angle(point1, point2):             # <<<<<<<<<<<<<<
 *     '''The result is the angle (on the screen)
 *     at which the mouse cursor needs to be drawn.'''
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_23get_cursor_angle, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__get_cursor_angle, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":524
 *     return program
 * 
 * def gl_create_render_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #px def gl_create_render_program(vertex_source, fragment_source):
 *     cdef GLint location #px+
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_25gl_create_render_program, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_77, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":545
 *         gl_init_object_location(location)
 * 
 * def gl_create_hud_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #px def gl_create_hud_program(vertex_source, fragment_source):
 *     cdef GLint location #px+
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_27gl_create_hud_program, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_80, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":558
 *         glUseProgram(program.prog_hud)
 * 
 * def gl_create_pick_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #px def gl_create_pick_program(vertex_source, fragment_source):
 *     if program.prog_pick > 0:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_29gl_create_pick_program, NULL, __pyx_n_s___glarea); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_83, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":1
 * #-*- coding:utf-8 -*-             # <<<<<<<<<<<<<<
 * # cython: profile=False
 * # distutils: language = c++
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  if (__pyx_m) {
    __Pyx_AddTraceback("init _glarea", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init _glarea");
  }
  __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 CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        length = strlen(cstring);
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                /* try package relative import first */
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0; /* try absolute import on failure */
        }
        #endif
        if (!module) {
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
        }
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) {
#if PY_MAJOR_VERSION < 3
    PyErr_Format(PyExc_ImportError, "cannot import name %.230s",
                 PyString_AsString(name));
#else
    PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
#endif
}

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 CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

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;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%s does not export expected C function %s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0)
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %s.%s has wrong signature (expected %s, got %s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %s.%s has wrong signature (expected %s, got %s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

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;
}


/* Type Conversion Functions */

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 */
