/* Generated by Cython 0.21.1 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#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 < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_21_1"
#include <stddef.h>
#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 CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
#define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#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+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#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)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
  #define Py_TPFLAGS_HAVE_FINALIZE 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_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #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_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
  #define __Pyx_PyFrozenSet_Size(s)         PyObject_Size(s)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  #define __Pyx_PyFrozenSet_Size(s)         PySet_Size(s)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#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_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#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
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  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
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#ifdef __cplusplus
template<typename T>
void __Pyx_call_destructor(T* x) {
    x->~T();
}
#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"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (    \
    (sizeof(type) < sizeof(Py_ssize_t))  ||             \
    (sizeof(type) > sizeof(Py_ssize_t) &&               \
          likely(v < (type)PY_SSIZE_T_MAX ||            \
                 v == (type)PY_SSIZE_T_MAX)  &&         \
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||       \
                                v == (type)PY_SSIZE_T_MIN)))  ||  \
    (sizeof(type) == sizeof(Py_ssize_t) &&              \
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||        \
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromUString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#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);
#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))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */

static PyObject *__pyx_m;
static PyObject *__pyx_d;
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":64
 * # 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":65
 * 
 * ctypedef unsigned int	GLenum
 * ctypedef unsigned char	GLboolean             # <<<<<<<<<<<<<<
 * ctypedef unsigned int	GLbitfield
 * ctypedef void		GLvoid
 */
typedef unsigned char __pyx_t_2gl_GLboolean;

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

/* "gl.pxd":68
 * ctypedef unsigned int	GLbitfield
 * ctypedef void		GLvoid
 * ctypedef int		GLint             # <<<<<<<<<<<<<<
 * ctypedef unsigned char	GLubyte
 * ctypedef unsigned int	GLuint
 */
typedef int __pyx_t_2gl_GLint;

/* "gl.pxd":69
 * ctypedef void		GLvoid
 * ctypedef int		GLint
 * ctypedef unsigned char	GLubyte             # <<<<<<<<<<<<<<
 * ctypedef unsigned int	GLuint
 * ctypedef int		GLsizei
 */
typedef unsigned char __pyx_t_2gl_GLubyte;

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

/* "gl.pxd":71
 * ctypedef unsigned char	GLubyte
 * ctypedef unsigned int	GLuint
 * ctypedef int		GLsizei             # <<<<<<<<<<<<<<
 * ctypedef float		GLfloat
 * ctypedef float		GLclampf
 */
typedef int __pyx_t_2gl_GLsizei;

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

/* "gl.pxd":73
 * ctypedef int		GLsizei
 * ctypedef float		GLfloat
 * ctypedef float		GLclampf             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef float __pyx_t_2gl_GLclampf;

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

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

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

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

/* "gl.pxd":67
 * ctypedef unsigned char	GLboolean
 * ctypedef unsigned int	GLbitfield
 * ctypedef void		GLvoid             # <<<<<<<<<<<<<<
 * ctypedef int		GLint
 * ctypedef unsigned char	GLubyte
 */
typedef void __pyx_t_2gl_GLvoid;

/* "_gldraw.pxd":4
 * 
 * from gl cimport *    #line 35
 * cdef enum: #    #line 52             # <<<<<<<<<<<<<<
 *     ATTRIB_LOCATION = 0    #line 57
 *     PICKATTRIB_LOCATION = 5    #line 58
 */
enum  {
  __pyx_e_7_gldraw_ATTRIB_LOCATION = 0,
  __pyx_e_7_gldraw_PICKATTRIB_LOCATION = 5
};

/* "_gldraw.pxd":7
 *     ATTRIB_LOCATION = 0    #line 57
 *     PICKATTRIB_LOCATION = 5    #line 58
 * ctypedef float vec4[4]    #line 61             # <<<<<<<<<<<<<<
 * ctypedef vec4 mat4[4]    #line 62
 * cdef matrix_set_identity(mat4& matrix)    #line 66
 */
typedef float __pyx_t_7_gldraw_vec4[4];

/* "_gldraw.pxd":8
 *     PICKATTRIB_LOCATION = 5    #line 58
 * ctypedef float vec4[4]    #line 61
 * ctypedef vec4 mat4[4]    #line 62             # <<<<<<<<<<<<<<
 * cdef matrix_set_identity(mat4& matrix)    #line 66
 * cdef void gl_draw_cube()    #line 186
 */
typedef __pyx_t_7_gldraw_vec4 __pyx_t_7_gldraw_mat4[4];
struct __pyx_t_7_glarea_Terrain;
struct __pyx_t_7_glarea_Frustum;
struct __pyx_t_7_glarea_Program;
struct __pyx_t_7_glarea_SelectionDebugPoints;

/* "_glarea.pyx":53
 * 
 * 
 * cdef struct Terrain: #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":62
 * cdef Terrain terrain #px+
 * 
 * cdef struct Frustum: #px/             # <<<<<<<<<<<<<<
 * #class frustum:
 *     float fovy_angle  # field of view angle #px+
 */
struct __pyx_t_7_glarea_Frustum {
  float fovy_angle;
  float fovy_radius;
  float fovy_radius_zoom;
  double bounding_sphere_radius;
  int multisample;
  __pyx_t_7_gldraw_mat4 modelview_matrix;
  __pyx_t_7_gldraw_mat4 projection_matrix;
  __pyx_t_7_gldraw_mat4 picking_matrix;
};

/* "_glarea.pyx":77
 * cdef Frustum frustum #px+
 * 
 * cdef struct Program: #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":89
 * cdef Program program #px+
 * 
 * cdef struct SelectionDebugPoints: #px/             # <<<<<<<<<<<<<<
 * #class selection_debug_points:
 *     float modelview1[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);
  #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
#define __Pyx_XDECREF_SET(r, v) do {                            \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_XDECREF(tmp);                              \
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {                             \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_DECREF(tmp);                               \
    } while (0)
#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)

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name);

#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);

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

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

static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
    const char* function_name);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

#include <string.h>

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

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args))
                PyErr_SetObject(PyExc_KeyError, args);
            Py_XDECREF(args);
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

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

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

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

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);

static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

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

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

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


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

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

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

/* Module declarations from 'gl' */

/* Module declarations from '_gldraw' */
static PyObject *(*__pyx_f_7_gldraw_matrix_set_identity)(__pyx_t_7_gldraw_vec4 *); /*proto*/
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_Frustum __pyx_v_7_glarea_frustum;
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, __pyx_t_7_gldraw_vec4 *); /*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(float *, int *); /*proto*/
static void __pyx_f_7_glarea__viewport_to_modelview(int *, float *); /*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 *, int, 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_builtin_enumerate;
static PyObject *__pyx_pf_7_glarea_init_module(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7_glarea_2set_frustum(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_xi, PyObject *__pyx_v_yi, PyObject *__pyx_v_d); /* 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_d[] = "d";
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__3[] = "====";
static char __pyx_k_xi[] = "xi";
static char __pyx_k_yi[] = "yi";
static char __pyx_k__10[] = " ";
static char __pyx_k_red[] = "red";
static char __pyx_k_tex[] = "tex";
static char __pyx_k_blue[] = "blue";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_name[] = "__name__";
static char __pyx_k_prog[] = "prog";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_zoom[] = "zoom";
static char __pyx_k_DEBUG[] = "DEBUG";
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_glarea[] = "_glarea";
static char __pyx_k_height[] = "height";
static char __pyx_k_import[] = "__import__";
static char __pyx_k_object[] = "object";
static char __pyx_k_rstrip[] = "rstrip";
static char __pyx_k_GL_GLES[] = "  GL/GLES:";
static char __pyx_k_gl_exit[] = "gl_exit";
static char __pyx_k_gl_init[] = "gl_init";
static char __pyx_k_package[] = "__package__";
static char __pyx_k_picking[] = "picking";
static char __pyx_k_compiled[] = "__compiled";
static char __pyx_k_location[] = "location";
static char __pyx_k_DEBUG_MSG[] = "DEBUG_MSG";
static char __pyx_k_GL_Vendor[] = "  GL Vendor:";
static char __pyx_k_enumerate[] = "enumerate";
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_GL_SAMPLES[] = "  GL_SAMPLES:";
static char __pyx_k_GL_Strings[] = "GL Strings:";
static char __pyx_k_GL_Version[] = "  GL Version:";
static char __pyx_k_attributes[] = "attributes";
static char __pyx_k_color_attr[] = "color_attr";
static char __pyx_k_compiled_2[] = "  compiled:";
static char __pyx_k_projection[] = "projection";
static char __pyx_k_selectdata[] = "selectdata";
static char __pyx_k_GL_Renderer[] = "  GL Renderer:";
static char __pyx_k_init_module[] = "init_module";
static char __pyx_k_link_status[] = "link status";
static char __pyx_k_multisample[] = "multisample";
static char __pyx_k_normal_attr[] = "normal_attr";
static char __pyx_k_set_frustum[] = "set_frustum";
static char __pyx_k_vertex_attr[] = "vertex_attr";
static char __pyx_k_from_package[] = "  from package:";
static char __pyx_k_delete_status[] = "delete status";
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_GL_MULTISAMPLE[] = "  GL_MULTISAMPLE:";
static char __pyx_k_DEBUG_NOFSHADER[] = "DEBUG_NOFSHADER";
static char __pyx_k_DEBUG_NOVSHADER[] = "DEBUG_NOVSHADER";
static char __pyx_k_active_uniforms[] = "active uniforms";
static char __pyx_k_fragment_source[] = "fragment_source";
static char __pyx_k_info_log_length[] = "info log length";
static char __pyx_k_set_rotation_xy[] = "set_rotation_xy";
static char __pyx_k_validate_status[] = "validate status";
static char __pyx_k_Importing_module[] = "Importing module:";
static char __pyx_k_attached_shaders[] = "attached shaders";
static char __pyx_k_barycentric_attr[] = "barycentric_attr";
static char __pyx_k_get_cursor_angle[] = "get_cursor_angle";
static char __pyx_k_set_antialiasing[] = "set_antialiasing";
static char __pyx_k_GL_SAMPLE_BUFFERS[] = "  GL_SAMPLE_BUFFERS:";
static char __pyx_k_active_attributes[] = "active attributes";
static char __pyx_k_active_uniforms_2[] = "active uniforms:";
static char __pyx_k_GL_SAMPLE_COVERAGE[] = "  GL_SAMPLE_COVERAGE:";
static char __pyx_k_active_attributes_2[] = "active attributes:";
static char __pyx_k_shader_program_info[] = "shader program info";
static char __pyx_k_set_background_color[] = "set_background_color";
static char __pyx_k_GL_MAX_VERTEX_ATTRIBS[] = "  GL_MAX_VERTEX_ATTRIBS:";
static char __pyx_k_gl_create_hud_program[] = "gl_create_hud_program";
static char __pyx_k_Error_compiling_shader[] = "==== Error compiling shader:";
static char __pyx_k_bounding_sphere_radius[] = "bounding_sphere_radius";
static char __pyx_k_creating_vertex_shader[] = "  creating vertex shader";
static char __pyx_k_error_no_vertex_shader[] = "error: no vertex shader";
static char __pyx_k_gl_create_pick_program[] = "gl_create_pick_program";
static char __pyx_k_gl_render_select_debug[] = "gl_render_select_debug";
static char __pyx_k_Failed_to_create_shader[] = "Failed to create shader";
static char __pyx_k_GL_SAMPLE_COVERAGE_VALUE[] = "  GL_SAMPLE_COVERAGE_VALUE:";
static char __pyx_k_creating_fragment_shader[] = "  creating fragment shader";
static char __pyx_k_error_no_fragment_shader[] = "error: no fragment shader";
static char __pyx_k_gl_create_render_program[] = "gl_create_render_program";
static char __pyx_k_GL_SAMPLE_COVERAGE_INVERT[] = "  GL_SAMPLE_COVERAGE_INVERT:";
static char __pyx_k_active_uniform_max_length[] = "active uniform max length";
static char __pyx_k_length_size_type_location[] = "  {}, {}: length={} size={} type={} location={}";
static char __pyx_k_GL_SAMPLE_ALPHA_TO_COVERAGE[] = "  GL_SAMPLE_ALPHA_TO_COVERAGE:";
static char __pyx_k_GL_Shading_Language_Version[] = "  GL Shading Language Version:";
static char __pyx_k_active_attribute_max_length[] = "active attribute max length";
static char __pyx_k_Error_linking_shader_program[] = "==== Error linking shader program:";
static char __pyx_k_Error_compiling_shader_no_log[] = "==== Error compiling shader (no log)";
static char __pyx_k_Error_linking_shader_program_no[] = "==== Error linking shader program (no log)";
static char __pyx_k_tmp[] = "/tmp/build/temp.linux-x86_64-3.4/pybiklib/_glarea.pyx";
static PyObject *__pyx_n_s_DEBUG;
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_kp_u_Error_compiling_shader;
static PyObject *__pyx_kp_u_Error_compiling_shader_no_log;
static PyObject *__pyx_kp_u_Error_linking_shader_program;
static PyObject *__pyx_kp_u_Error_linking_shader_program_no;
static PyObject *__pyx_kp_u_Failed_to_create_shader;
static PyObject *__pyx_n_u_GL;
static PyObject *__pyx_kp_u_GL_GLES;
static PyObject *__pyx_kp_u_GL_MAX_VERTEX_ATTRIBS;
static PyObject *__pyx_kp_u_GL_MULTISAMPLE;
static PyObject *__pyx_kp_u_GL_Renderer;
static PyObject *__pyx_kp_u_GL_SAMPLES;
static PyObject *__pyx_kp_u_GL_SAMPLE_ALPHA_TO_COVERAGE;
static PyObject *__pyx_kp_u_GL_SAMPLE_BUFFERS;
static PyObject *__pyx_kp_u_GL_SAMPLE_COVERAGE;
static PyObject *__pyx_kp_u_GL_SAMPLE_COVERAGE_INVERT;
static PyObject *__pyx_kp_u_GL_SAMPLE_COVERAGE_VALUE;
static PyObject *__pyx_kp_u_GL_Shading_Language_Version;
static PyObject *__pyx_kp_u_GL_Strings;
static PyObject *__pyx_kp_u_GL_Vendor;
static PyObject *__pyx_kp_u_GL_Version;
static PyObject *__pyx_kp_u_Importing_module;
static PyObject *__pyx_kp_u__10;
static PyObject *__pyx_kp_u__3;
static PyObject *__pyx_kp_u_active_attribute_max_length;
static PyObject *__pyx_kp_u_active_attributes;
static PyObject *__pyx_kp_u_active_attributes_2;
static PyObject *__pyx_kp_u_active_uniform_max_length;
static PyObject *__pyx_kp_u_active_uniforms;
static PyObject *__pyx_kp_u_active_uniforms_2;
static PyObject *__pyx_n_s_angle;
static PyObject *__pyx_kp_u_attached_shaders;
static PyObject *__pyx_n_s_attributes;
static PyObject *__pyx_n_b_barycentric_attr;
static PyObject *__pyx_n_s_blue;
static PyObject *__pyx_n_s_bounding_sphere_radius;
static PyObject *__pyx_n_b_color_attr;
static PyObject *__pyx_n_s_compiled;
static PyObject *__pyx_kp_u_compiled_2;
static PyObject *__pyx_kp_u_creating_fragment_shader;
static PyObject *__pyx_kp_u_creating_vertex_shader;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_kp_u_delete_status;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_kp_u_error_no_fragment_shader;
static PyObject *__pyx_kp_u_error_no_vertex_shader;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_fragment_source;
static PyObject *__pyx_kp_u_from_package;
static PyObject *__pyx_n_s_get_cursor_angle;
static PyObject *__pyx_n_s_gl_create_hud_program;
static PyObject *__pyx_n_s_gl_create_pick_program;
static PyObject *__pyx_n_s_gl_create_render_program;
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_render_select_debug;
static PyObject *__pyx_n_s_gl_resize;
static PyObject *__pyx_n_s_glarea;
static PyObject *__pyx_n_s_green;
static PyObject *__pyx_n_s_height;
static PyObject *__pyx_kp_s_tmp;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_kp_u_info_log_length;
static PyObject *__pyx_n_s_init_module;
static PyObject *__pyx_kp_u_length_size_type_location;
static PyObject *__pyx_kp_u_link_status;
static PyObject *__pyx_n_s_location;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_multisample;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_b_normal_attr;
static PyObject *__pyx_n_s_package;
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_background_color;
static PyObject *__pyx_n_s_set_frustum;
static PyObject *__pyx_n_s_set_rotation_xy;
static PyObject *__pyx_kp_u_shader_program_info;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_b_texcoord_attr;
static PyObject *__pyx_kp_u_validate_status;
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_xi;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_yi;
static PyObject *__pyx_n_s_zoom;
static PyObject *__pyx_float_180_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_90;
static PyObject *__pyx_int_360;
static PyObject *__pyx_int_neg_90;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_codeobj__18;
static PyObject *__pyx_codeobj__20;
static PyObject *__pyx_codeobj__22;
static PyObject *__pyx_codeobj__24;
static PyObject *__pyx_codeobj__26;
static PyObject *__pyx_codeobj__27;
static PyObject *__pyx_codeobj__29;
static PyObject *__pyx_codeobj__31;
static PyObject *__pyx_codeobj__32;
static PyObject *__pyx_codeobj__34;
static PyObject *__pyx_codeobj__36;
static PyObject *__pyx_codeobj__38;
static PyObject *__pyx_codeobj__40;
static PyObject *__pyx_codeobj__42;

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

/* 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 = {"init_module", (PyCFunction)__pyx_pw_7_glarea_1init_module, METH_NOARGS, 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);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init_module", 0);

  /* "_glarea.pyx":104
 * 
 * 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":105
 * 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":106
 *     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":107
 *     terrain.green = 0.0
 *     terrain.blue = 0.0
 *     terrain.width = 1             # <<<<<<<<<<<<<<
 *     terrain.height = 1
 * 
 */
  __pyx_v_7_glarea_terrain.width = 1;

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

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

  /* "_glarea.pyx":111
 * 
 *     frustum.fovy_angle = 33.0  # field of view angle
 *     frustum.fovy_radius = 1 / tan(frustum.fovy_angle * M_PI / 360.0)             # <<<<<<<<<<<<<<
 *     frustum.fovy_radius_zoom = frustum.fovy_radius  # zoom == 1.
 *     frustum.bounding_sphere_radius = 1.
 */
  __pyx_t_1 = tan(((__pyx_v_7_glarea_frustum.fovy_angle * M_PI) / 360.0));
  if (unlikely(__pyx_t_1 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_7_glarea_frustum.fovy_radius = (1.0 / __pyx_t_1);

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

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

  /* "_glarea.pyx":114
 *     frustum.fovy_radius_zoom = frustum.fovy_radius  # zoom == 1.
 *     frustum.bounding_sphere_radius = 1.
 *     frustum.multisample = 0             # <<<<<<<<<<<<<<
 *     # fill modelview_matrix
 *     matrix_set_identity(frustum.modelview_matrix)
 */
  __pyx_v_7_glarea_frustum.multisample = 0;

  /* "_glarea.pyx":116
 *     frustum.multisample = 0
 *     # fill modelview_matrix
 *     matrix_set_identity(frustum.modelview_matrix)             # <<<<<<<<<<<<<<
 *     _update_modelview_matrix_translation()
 *     # fill projection_matrix, see doc of _glFrustum
 */
  __pyx_t_3 = __pyx_f_7_gldraw_matrix_set_identity(__pyx_v_7_glarea_frustum.modelview_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_glarea.pyx":117
 *     # fill modelview_matrix
 *     matrix_set_identity(frustum.modelview_matrix)
 *     _update_modelview_matrix_translation()             # <<<<<<<<<<<<<<
 *     # fill projection_matrix, see doc of _glFrustum
 *     matrix_set_identity(frustum.projection_matrix)
 */
  __pyx_f_7_glarea__update_modelview_matrix_translation();

  /* "_glarea.pyx":119
 *     _update_modelview_matrix_translation()
 *     # fill projection_matrix, see doc of _glFrustum
 *     matrix_set_identity(frustum.projection_matrix)             # <<<<<<<<<<<<<<
 *     frustum.projection_matrix[2][3] = -1.
 *     frustum.projection_matrix[3][3] = 0.
 */
  __pyx_t_3 = __pyx_f_7_gldraw_matrix_set_identity(__pyx_v_7_glarea_frustum.projection_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_glarea.pyx":120
 *     # fill projection_matrix, see doc of _glFrustum
 *     matrix_set_identity(frustum.projection_matrix)
 *     frustum.projection_matrix[2][3] = -1.             # <<<<<<<<<<<<<<
 *     frustum.projection_matrix[3][3] = 0.
 *     _update_projection_matrix()
 */
  ((__pyx_v_7_glarea_frustum.projection_matrix[2])[3]) = -1.;

  /* "_glarea.pyx":121
 *     matrix_set_identity(frustum.projection_matrix)
 *     frustum.projection_matrix[2][3] = -1.
 *     frustum.projection_matrix[3][3] = 0.             # <<<<<<<<<<<<<<
 *     _update_projection_matrix()
 *     # fill picking_matrix
 */
  ((__pyx_v_7_glarea_frustum.projection_matrix[3])[3]) = 0.;

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

  /* "_glarea.pyx":124
 *     _update_projection_matrix()
 *     # fill picking_matrix
 *     matrix_set_identity(frustum.picking_matrix)             # <<<<<<<<<<<<<<
 * 
 *     program.prog_render = 0
 */
  __pyx_t_3 = __pyx_f_7_gldraw_matrix_set_identity(__pyx_v_7_glarea_frustum.picking_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_glarea.pyx":126
 *     matrix_set_identity(frustum.picking_matrix)
 * 
 *     program.prog_render = 0             # <<<<<<<<<<<<<<
 *     program.prog_hud = 0
 *     program.prog_pick = 0
 */
  __pyx_v_7_glarea_program.prog_render = 0;

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

  /* "_glarea.pyx":128
 *     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;

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

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __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":130
 *     program.prog_pick = 0
 * 
 * cdef void _update_modelview_matrix_translation(): #px/             # <<<<<<<<<<<<<<
 * #def _update_modelview_matrix_translation():
 *     frustum.modelview_matrix[3][2] = -frustum.bounding_sphere_radius * (frustum.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":132
 * cdef void _update_modelview_matrix_translation(): #px/
 * #def _update_modelview_matrix_translation():
 *     frustum.modelview_matrix[3][2] = -frustum.bounding_sphere_radius * (frustum.fovy_radius_zoom + 1.)             # <<<<<<<<<<<<<<
 * 
 * cdef void _set_modelview_matrix_rotation(float radiansx, float radiansy): #px/
 */
  ((__pyx_v_7_glarea_frustum.modelview_matrix[3])[2]) = ((-__pyx_v_7_glarea_frustum.bounding_sphere_radius) * (__pyx_v_7_glarea_frustum.fovy_radius_zoom + 1.));

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

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":134
 *     frustum.modelview_matrix[3][2] = -frustum.bounding_sphere_radius * (frustum.fovy_radius_zoom + 1.)
 * 
 * cdef void _set_modelview_matrix_rotation(float radiansx, float radiansy): #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) {
  __pyx_t_7_gldraw_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":140
 *     cdef float m00, m11, m12, m20 #px+
 * 
 *     M = <vec4*>&frustum.modelview_matrix[0][0] #px/             # <<<<<<<<<<<<<<
 *     #M = frustum.modelview_matrix
 * 
 */
  __pyx_v_M = ((__pyx_t_7_gldraw_vec4 *)(&((__pyx_v_7_glarea_frustum.modelview_matrix[0])[0])));

  /* "_glarea.pyx":143
 *     #M = frustum.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":144
 * 
 *     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":145
 *     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":146
 *     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":148
 *     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":149
 * 
 *     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":150
 *     m00 = 2*cx*cx - 1.
 *     m11 = 2*cy*cy - 1.
 *     m12 = 2*sy*cy             # <<<<<<<<<<<<<<
 *     m20 = 2*sx*cx
 *     # pylint: disable=C0321,C0326
 */
  __pyx_v_m12 = ((2.0 * __pyx_v_sy) * __pyx_v_cy);

  /* "_glarea.pyx":151
 *     m11 = 2*cy*cy - 1.
 *     m12 = 2*sy*cy
 *     m20 = 2*sx*cx             # <<<<<<<<<<<<<<
 *     # pylint: disable=C0321,C0326
 *     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":153
 *     m20 = 2*sx*cx
 *     # pylint: disable=C0321,C0326
 *     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":154
 *     # pylint: disable=C0321,C0326
 *     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])[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":155
 *     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             # <<<<<<<<<<<<<<
 * 
 * cdef void _update_projection_matrix(): #px/
 */
  ((__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);

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

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":157
 *     M[0][2] = -m11 * m20;   M[1][2] = m12;  M[2][2] =  m00 * m11
 * 
 * cdef void _update_projection_matrix(): #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":159
 * cdef void _update_projection_matrix(): #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) != 0);
  if (__pyx_t_1) {

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

    /* "_glarea.pyx":161
 *     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)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __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":163
 *         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)) {
      #ifdef WITH_THREAD
      PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
      #endif
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      #ifdef WITH_THREAD
      PyGILState_Release(__pyx_gilstate_save);
      #endif
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __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":164
 *     else:
 *         aspectx = terrain.width / terrain.height
 *         aspecty = 1.             # <<<<<<<<<<<<<<
 *     # see doc of _glFrustum
 *     frustum.projection_matrix[0][0] = frustum.fovy_radius / aspectx
 */
    __pyx_v_aspecty = 1.;
  }
  __pyx_L3:;

  /* "_glarea.pyx":166
 *         aspecty = 1.
 *     # see doc of _glFrustum
 *     frustum.projection_matrix[0][0] = frustum.fovy_radius / aspectx             # <<<<<<<<<<<<<<
 *     frustum.projection_matrix[1][1] = frustum.fovy_radius / aspecty
 *     frustum.projection_matrix[2][2] = -(frustum.fovy_radius_zoom + 1.)
 */
  if (unlikely(__pyx_v_aspectx == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  ((__pyx_v_7_glarea_frustum.projection_matrix[0])[0]) = (((double)__pyx_v_7_glarea_frustum.fovy_radius) / __pyx_v_aspectx);

  /* "_glarea.pyx":167
 *     # see doc of _glFrustum
 *     frustum.projection_matrix[0][0] = frustum.fovy_radius / aspectx
 *     frustum.projection_matrix[1][1] = frustum.fovy_radius / aspecty             # <<<<<<<<<<<<<<
 *     frustum.projection_matrix[2][2] = -(frustum.fovy_radius_zoom + 1.)
 *     frustum.projection_matrix[3][2] = -(frustum.fovy_radius_zoom + 2.
 */
  if (unlikely(__pyx_v_aspecty == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  ((__pyx_v_7_glarea_frustum.projection_matrix[1])[1]) = (((double)__pyx_v_7_glarea_frustum.fovy_radius) / __pyx_v_aspecty);

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

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

  /* "_glarea.pyx":157
 *     M[0][2] = -m11 * m20;   M[1][2] = m12;  M[2][2] =  m00 * m11
 * 
 * cdef void _update_projection_matrix(): #px/             # <<<<<<<<<<<<<<
 * #def _update_projection_matrix():
 *     if terrain.width < terrain.height:
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("_glarea._update_projection_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":172
 *                     ) * frustum.bounding_sphere_radius * frustum.fovy_radius_zoom
 * 
 * cdef void _set_picking_matrix(int x, int y): #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":180
 *     #           _glTranslatef(terrain.width - 2*x, terrain.height - 2*y, 0.)
 *     #           _glScalef(terrain.width, terrain.height, 1.0)
 *     frustum.picking_matrix[3][0] = terrain.width - 2*x             # <<<<<<<<<<<<<<
 *     frustum.picking_matrix[3][1] = terrain.height - 2*y
 *     frustum.picking_matrix[0][0] = terrain.width
 */
  ((__pyx_v_7_glarea_frustum.picking_matrix[3])[0]) = (__pyx_v_7_glarea_terrain.width - (2 * __pyx_v_x));

  /* "_glarea.pyx":181
 *     #           _glScalef(terrain.width, terrain.height, 1.0)
 *     frustum.picking_matrix[3][0] = terrain.width - 2*x
 *     frustum.picking_matrix[3][1] = terrain.height - 2*y             # <<<<<<<<<<<<<<
 *     frustum.picking_matrix[0][0] = terrain.width
 *     frustum.picking_matrix[1][1] = terrain.height
 */
  ((__pyx_v_7_glarea_frustum.picking_matrix[3])[1]) = (__pyx_v_7_glarea_terrain.height - (2 * __pyx_v_y));

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

  /* "_glarea.pyx":183
 *     frustum.picking_matrix[3][1] = terrain.height - 2*y
 *     frustum.picking_matrix[0][0] = terrain.width
 *     frustum.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_frustum.picking_matrix[1])[1]) = __pyx_t_1;

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

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":185
 *     frustum.picking_matrix[1][1] = terrain.height
 * 
 * cdef void _set_picking_matrix_identity(): #px/             # <<<<<<<<<<<<<<
 * #def _set_picking_matrix_identity():
 *     frustum.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":187
 * cdef void _set_picking_matrix_identity(): #px/
 * #def _set_picking_matrix_identity():
 *     frustum.picking_matrix[3][0] = 0.             # <<<<<<<<<<<<<<
 *     frustum.picking_matrix[3][1] = 0.
 *     frustum.picking_matrix[0][0] = 1.
 */
  ((__pyx_v_7_glarea_frustum.picking_matrix[3])[0]) = 0.;

  /* "_glarea.pyx":188
 * #def _set_picking_matrix_identity():
 *     frustum.picking_matrix[3][0] = 0.
 *     frustum.picking_matrix[3][1] = 0.             # <<<<<<<<<<<<<<
 *     frustum.picking_matrix[0][0] = 1.
 *     frustum.picking_matrix[1][1] = 1.
 */
  ((__pyx_v_7_glarea_frustum.picking_matrix[3])[1]) = 0.;

  /* "_glarea.pyx":189
 *     frustum.picking_matrix[3][0] = 0.
 *     frustum.picking_matrix[3][1] = 0.
 *     frustum.picking_matrix[0][0] = 1.             # <<<<<<<<<<<<<<
 *     frustum.picking_matrix[1][1] = 1.
 * 
 */
  ((__pyx_v_7_glarea_frustum.picking_matrix[0])[0]) = 1.;

  /* "_glarea.pyx":190
 *     frustum.picking_matrix[3][1] = 0.
 *     frustum.picking_matrix[0][0] = 1.
 *     frustum.picking_matrix[1][1] = 1.             # <<<<<<<<<<<<<<
 * 
 * def set_frustum(bounding_sphere_radius, zoom):
 */
  ((__pyx_v_7_glarea_frustum.picking_matrix[1])[1]) = 1.;

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

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":192
 *     frustum.picking_matrix[1][1] = 1.
 * 
 * def set_frustum(bounding_sphere_radius, zoom):             # <<<<<<<<<<<<<<
 *     if bounding_sphere_radius > 0:
 *         frustum.bounding_sphere_radius = bounding_sphere_radius
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_3set_frustum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_3set_frustum = {"set_frustum", (PyCFunction)__pyx_pw_7_glarea_3set_frustum, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_glarea_3set_frustum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bounding_sphere_radius = 0;
  PyObject *__pyx_v_zoom = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_frustum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bounding_sphere_radius,&__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_bounding_sphere_radius)) != 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_frustum", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __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_frustum") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __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_frustum", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea.set_frustum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7_glarea_2set_frustum(__pyx_self, __pyx_v_bounding_sphere_radius, __pyx_v_zoom);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

  /* "_glarea.pyx":193
 * 
 * def set_frustum(bounding_sphere_radius, zoom):
 *     if bounding_sphere_radius > 0:             # <<<<<<<<<<<<<<
 *         frustum.bounding_sphere_radius = bounding_sphere_radius
 *     frustum.fovy_radius_zoom = frustum.fovy_radius / zoom
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_bounding_sphere_radius, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __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 = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "_glarea.pyx":194
 * def set_frustum(bounding_sphere_radius, zoom):
 *     if bounding_sphere_radius > 0:
 *         frustum.bounding_sphere_radius = bounding_sphere_radius             # <<<<<<<<<<<<<<
 *     frustum.fovy_radius_zoom = frustum.fovy_radius / zoom
 *     _update_modelview_matrix_translation()
 */
    __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_bounding_sphere_radius); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_7_glarea_frustum.bounding_sphere_radius = __pyx_t_3;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":195
 *     if bounding_sphere_radius > 0:
 *         frustum.bounding_sphere_radius = bounding_sphere_radius
 *     frustum.fovy_radius_zoom = frustum.fovy_radius / zoom             # <<<<<<<<<<<<<<
 *     _update_modelview_matrix_translation()
 *     _update_projection_matrix()
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_7_glarea_frustum.fovy_radius); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_zoom); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __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 = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_7_glarea_frustum.fovy_radius_zoom = __pyx_t_5;

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

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

  /* "_glarea.pyx":192
 *     frustum.picking_matrix[1][1] = 1.
 * 
 * def set_frustum(bounding_sphere_radius, zoom):             # <<<<<<<<<<<<<<
 *     if bounding_sphere_radius > 0:
 *         frustum.bounding_sphere_radius = bounding_sphere_radius
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("_glarea.set_frustum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* 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 = {"set_background_color", (PyCFunction)__pyx_pw_7_glarea_5set_background_color, METH_VARARGS|METH_KEYWORDS, 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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 = 199; __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 = 199; __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 = 199; __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 = 199; __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);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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":200
 * 
 * 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 = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_terrain.red = __pyx_t_1;

  /* "_glarea.pyx":201
 * 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 = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_terrain.green = __pyx_t_1;

  /* "_glarea.pyx":202
 *     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 = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_terrain.blue = __pyx_t_1;

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

  /* function exit code */
  __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;
}

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

/* 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 = {"set_antialiasing", (PyCFunction)__pyx_pw_7_glarea_7set_antialiasing, METH_O, 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));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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":205
 * 
 * def set_antialiasing(multisample):
 *     frustum.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 = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_frustum.multisample = __pyx_t_1;

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

  /* function exit code */
  __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;
}

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

/* 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 = {"set_rotation_xy", (PyCFunction)__pyx_pw_7_glarea_9set_rotation_xy, METH_VARARGS|METH_KEYWORDS, 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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 = 207; __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 = 207; __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 = 207; __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);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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;
  float __pyx_t_4;
  float __pyx_t_5;
  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":208
 * 
 * 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 = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":210
 *     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 = 210; __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 = 210; __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_SET(__pyx_v_y, __pyx_int_neg_90);
    goto __pyx_L3;
  }

  /* "_glarea.pyx":211
 *     # 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 = 211; __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 = 211; __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_SET(__pyx_v_y, __pyx_int_90);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":212
 *     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 = 212; __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 = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_float_180_0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_float_180_0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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 = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_f_7_glarea__set_modelview_matrix_rotation(__pyx_t_4, __pyx_t_5);

  /* "_glarea.pyx":213
 *     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_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __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":217
 * ### GL state
 * 
 * cdef void _gl_print_string(msg, GLenum name): #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":219
 * cdef void _gl_print_string(msg, GLenum name): #px/
 * #def _gl_print_string(msg, name):
 *     print(msg, <char*>glGetString(name)) #px/             # <<<<<<<<<<<<<<
 *     #print(msg, glGetString(name))
 * 
 */
  __pyx_t_1 = __Pyx_PyBytes_FromString(((char *)glGetString(__pyx_v_name))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __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 = 219; __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 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

  /* function exit code */
  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, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":222
 *     #print(msg, glGetString(name))
 * 
 * cdef void _gl_print_float(msg, GLenum name): #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":225
 * #def _gl_print_float(msg, name):
 *     cdef GLfloat i #px+
 *     glGetFloatv(name, &i) #px/             # <<<<<<<<<<<<<<
 *     #i = glGetFloatv(name)
 *     print(msg, i)
 */
  glGetFloatv(__pyx_v_name, (&__pyx_v_i));

  /* "_glarea.pyx":227
 *     glGetFloatv(name, &i) #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 = 227; __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 = 227; __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 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

  /* function exit code */
  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, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":229
 *     print(msg, i)
 * 
 * cdef void _gl_print_integer(msg, GLenum name): #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":232
 * #def _gl_print_integer(msg, name):
 *     cdef GLint i #px+
 *     glGetIntegerv(name, &i) #px/             # <<<<<<<<<<<<<<
 *     #i = glGetIntegerv(name)
 *     print(msg, i)
 */
  glGetIntegerv(__pyx_v_name, (&__pyx_v_i));

  /* "_glarea.pyx":234
 *     glGetIntegerv(name, &i) #px/
 *     #i = glGetIntegerv(name)
 *     print(msg, i)             # <<<<<<<<<<<<<<
 * 
 * cdef void _gl_print_bool(msg, GLenum name): #px/
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __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 = 234; __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 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

  /* function exit code */
  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, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":236
 *     print(msg, i)
 * 
 * cdef void _gl_print_bool(msg, GLenum name): #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":239
 * #def _gl_print_bool(msg, name):
 *     cdef GLboolean i #px+
 *     glGetBooleanv(name, &i) #px/             # <<<<<<<<<<<<<<
 *     #i = glGetBooleanv(name)
 *     print(msg, i)
 */
  glGetBooleanv(__pyx_v_name, (&__pyx_v_i));

  /* "_glarea.pyx":241
 *     glGetBooleanv(name, &i) #px/
 *     #i = glGetBooleanv(name)
 *     print(msg, i)             # <<<<<<<<<<<<<<
 * 
 * def gl_init():
 */
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_char(__pyx_v_i); 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 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __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 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

  /* function exit code */
  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, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

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

/* 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 = {"gl_init", (PyCFunction)__pyx_pw_7_glarea_11gl_init, METH_NOARGS, 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);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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":244
 * 
 * def gl_init():
 *     if DEBUG_MSG:             # <<<<<<<<<<<<<<
 *         print('GL Strings:')
 *         _gl_print_string('  GL Vendor:', GL_VENDOR)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_MSG); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __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 = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "_glarea.pyx":245
 * 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 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":246
 *     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_f_7_glarea__gl_print_string(__pyx_kp_u_GL_Vendor, GL_VENDOR);

    /* "_glarea.pyx":247
 *         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_f_7_glarea__gl_print_string(__pyx_kp_u_GL_Renderer, GL_RENDERER);

    /* "_glarea.pyx":248
 *         _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_f_7_glarea__gl_print_string(__pyx_kp_u_GL_Version, GL_VERSION);

    /* "_glarea.pyx":249
 *         _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_f_7_glarea__gl_print_string(__pyx_kp_u_GL_Shading_Language_Version, GL_SHADING_LANGUAGE_VERSION);

    /* "_glarea.pyx":251
 *         _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_f_7_glarea__gl_print_integer(__pyx_kp_u_GL_SAMPLE_BUFFERS, GL_SAMPLE_BUFFERS);

    /* "_glarea.pyx":252
 *         #_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_f_7_glarea__gl_print_float(__pyx_kp_u_GL_SAMPLE_COVERAGE_VALUE, GL_SAMPLE_COVERAGE_VALUE);

    /* "_glarea.pyx":253
 *         _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_f_7_glarea__gl_print_bool(__pyx_kp_u_GL_SAMPLE_COVERAGE_INVERT, GL_SAMPLE_COVERAGE_INVERT);

    /* "_glarea.pyx":254
 *         _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/
 *         #if True:
 */
    __pyx_f_7_glarea__gl_print_integer(__pyx_kp_u_GL_SAMPLES, GL_SAMPLES);

    /* "_glarea.pyx":257
 *         IF SOURCEGLVERSION == 'GL': #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 = __Pyx_PyInt_From_unsigned_char(glIsEnabled(GL_MULTISAMPLE)); 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(__pyx_kp_u_GL_MULTISAMPLE);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_GL_MULTISAMPLE);
    __Pyx_GIVEREF(__pyx_kp_u_GL_MULTISAMPLE);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __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(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":258
 *         #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 = __Pyx_PyInt_From_unsigned_char(glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __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 = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_kp_u_GL_SAMPLE_ALPHA_TO_COVERAGE);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_GL_SAMPLE_ALPHA_TO_COVERAGE);
    __Pyx_GIVEREF(__pyx_kp_u_GL_SAMPLE_ALPHA_TO_COVERAGE);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __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_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":260
 *         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))             # <<<<<<<<<<<<<<
 *         _gl_print_integer('  GL_MAX_VERTEX_ATTRIBS:', GL_MAX_VERTEX_ATTRIBS)
 *     glClearColor(0., 0., 0., 1.)
 */
    __pyx_t_1 = __Pyx_PyInt_From_unsigned_char(glIsEnabled(GL_SAMPLE_COVERAGE)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __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 = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_kp_u_GL_SAMPLE_COVERAGE);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_GL_SAMPLE_COVERAGE);
    __Pyx_GIVEREF(__pyx_kp_u_GL_SAMPLE_COVERAGE);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __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_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":261
 *         #print('  GL_SAMPLE_ALPHA_TO_ONE:', glIsEnabled(GL_SAMPLE_ALPHA_TO_ONE))
 *         print('  GL_SAMPLE_COVERAGE:', glIsEnabled(GL_SAMPLE_COVERAGE))
 *         _gl_print_integer('  GL_MAX_VERTEX_ATTRIBS:', GL_MAX_VERTEX_ATTRIBS)             # <<<<<<<<<<<<<<
 *     glClearColor(0., 0., 0., 1.)
 *     glEnable(GL_DEPTH_TEST)
 */
    __pyx_f_7_glarea__gl_print_integer(__pyx_kp_u_GL_MAX_VERTEX_ATTRIBS, GL_MAX_VERTEX_ATTRIBS);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":262
 *         print('  GL_SAMPLE_COVERAGE:', glIsEnabled(GL_SAMPLE_COVERAGE))
 *         _gl_print_integer('  GL_MAX_VERTEX_ATTRIBS:', GL_MAX_VERTEX_ATTRIBS)
 *     glClearColor(0., 0., 0., 1.)             # <<<<<<<<<<<<<<
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE)
 */
  glClearColor(0., 0., 0., 1.);

  /* "_glarea.pyx":263
 *         _gl_print_integer('  GL_MAX_VERTEX_ATTRIBS:', GL_MAX_VERTEX_ATTRIBS)
 *     glClearColor(0., 0., 0., 1.)
 *     glEnable(GL_DEPTH_TEST)             # <<<<<<<<<<<<<<
 *     glEnable(GL_CULL_FACE)
 *     glCullFace(GL_BACK)
 */
  glEnable(GL_DEPTH_TEST);

  /* "_glarea.pyx":264
 *     glClearColor(0., 0., 0., 1.)
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE)             # <<<<<<<<<<<<<<
 *     glCullFace(GL_BACK)
 *     glFrontFace(GL_CCW)
 */
  glEnable(GL_CULL_FACE);

  /* "_glarea.pyx":265
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE)
 *     glCullFace(GL_BACK)             # <<<<<<<<<<<<<<
 *     glFrontFace(GL_CCW)
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 */
  glCullFace(GL_BACK);

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

  /* "_glarea.pyx":267
 *     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":268
 *     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();

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

  /* function exit code */
  __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;
}

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

/* 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 = {"gl_exit", (PyCFunction)__pyx_pw_7_glarea_13gl_exit, METH_NOARGS, 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);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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":271
 * 
 * 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":273
 *     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 = __Pyx_PyInt_From_unsigned_int(__pyx_v_7_glarea_program.prog_render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_7_glarea_program.prog_hud); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_7_glarea_program.prog_pick); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __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, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_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 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_5 >= 3) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_4 = PyTuple_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 = 273; __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 = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_t_4); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_prog = __pyx_t_6;

    /* "_glarea.pyx":274
 *     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) != 0);
    if (__pyx_t_7) {

      /* "_glarea.pyx":275
 *     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:;

    /* "_glarea.pyx":273
 *     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_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "_glarea.pyx":276
 *         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":277
 *             glDeleteProgram(prog)
 *     program.prog_render = 0
 *     program.prog_hud = 0             # <<<<<<<<<<<<<<
 *     program.prog_pick = 0
 * 
 */
  __pyx_v_7_glarea_program.prog_hud = 0;

  /* "_glarea.pyx":278
 *     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;

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

  /* function exit code */
  __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;
}

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

/* 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 = {"gl_resize", (PyCFunction)__pyx_pw_7_glarea_15gl_resize, METH_VARARGS|METH_KEYWORDS, 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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 = 280; __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 = 280; __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 = 280; __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);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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":281
 * 
 * def gl_resize(width, height):
 *     terrain.width = width             # <<<<<<<<<<<<<<
 *     terrain.height = height
 *     glViewport(0, 0, terrain.width, terrain.height)
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_width); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_terrain.width = __pyx_t_1;

  /* "_glarea.pyx":282
 * 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_As_int(__pyx_v_height); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_7_glarea_terrain.height = __pyx_t_1;

  /* "_glarea.pyx":283
 *     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":284
 *     terrain.height = height
 *     glViewport(0, 0, terrain.width, terrain.height)
 *     _update_projection_matrix()             # <<<<<<<<<<<<<<
 * 
 * ### render functions
 */
  __pyx_f_7_glarea__update_projection_matrix();

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

  /* function exit code */
  __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":288
 * ### render functions
 * 
 * cdef void _gl_set_matrix(GLint location, mat4 &matrix): #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, __pyx_t_7_gldraw_vec4 *__pyx_v_matrix) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_gl_set_matrix", 0);

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

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

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

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

/* 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 = {"gl_render", (PyCFunction)__pyx_pw_7_glarea_17gl_render, METH_NOARGS, 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);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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":294
 * 
 * def gl_render():
 *     if DEBUG_PICK:             # <<<<<<<<<<<<<<
 *         _set_picking_matrix_identity()
 *         _gl_render_pick()
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_PICK); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __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 = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

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

    /* "_glarea.pyx":296
 *     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":298
 *         _gl_render_pick()
 *     else:
 *         glUseProgram(program.prog_render)             # <<<<<<<<<<<<<<
 *         IF SOURCEGLVERSION == 'GL': #px/
 *         #if True:
 */
    glUseProgram(__pyx_v_7_glarea_program.prog_render);

    /* "_glarea.pyx":301
 *         IF SOURCEGLVERSION == 'GL': #px/
 *         #if True:
 *             if frustum.multisample:             # <<<<<<<<<<<<<<
 *                 glEnable(GL_MULTISAMPLE)
 *             else:
 */
    __pyx_t_2 = (__pyx_v_7_glarea_frustum.multisample != 0);
    if (__pyx_t_2) {

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

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

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

    /* "_glarea.pyx":306
 *                 glDisable(GL_MULTISAMPLE)
 *         glClearColor(terrain.red, terrain.green, terrain.blue, 1.)
 *         _gl_set_matrix(program.projection_location, frustum.projection_matrix)             # <<<<<<<<<<<<<<
 *         _gl_set_matrix(program.modelview_location, frustum.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_frustum.projection_matrix);

    /* "_glarea.pyx":307
 *         glClearColor(terrain.red, terrain.green, terrain.blue, 1.)
 *         _gl_set_matrix(program.projection_location, frustum.projection_matrix)
 *         _gl_set_matrix(program.modelview_location, frustum.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_frustum.modelview_matrix);

    /* "_glarea.pyx":308
 *         _gl_set_matrix(program.projection_location, frustum.projection_matrix)
 *         _gl_set_matrix(program.modelview_location, frustum.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":309
 *         _gl_set_matrix(program.modelview_location, frustum.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":310
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *         gl_draw_cube()
 *     if DEBUG_DRAW:             # <<<<<<<<<<<<<<
 *         gl_draw_cube_debug()
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_DRAW); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __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 = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "_glarea.pyx":311
 *         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:;

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

  /* function exit code */
  __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;
}

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

/* 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 = {"gl_render_select_debug", (PyCFunction)__pyx_pw_7_glarea_19gl_render_select_debug, METH_NOARGS, 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);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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":316
 *     cdef GLfloat selectdata[12] #px/
 *     #selectdata = [0.] * 12
 *     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":317
 *     #selectdata = [0.] * 12
 *     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":318
 *     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":319
 *     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":320
 *     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":321
 *     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":322
 *     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)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __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":323
 *     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)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __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":324
 *     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":325
 *     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)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __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":326
 *     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)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __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":327
 *     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/
 *     #gl_draw_select_debug(selectdata, 0, program.prog_hud)
 */
  (__pyx_v_selectdata[11]) = 0.0;

  /* "_glarea.pyx":328
 *     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/             # <<<<<<<<<<<<<<
 *     #gl_draw_select_debug(selectdata, 0, 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);

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

  /* function exit code */
  __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":334
 * ### picking functions
 * 
 * cdef void _gl_render_pick(): #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":336
 * cdef void _gl_render_pick(): #px/
 * #def _gl_render_pick():
 *     glUseProgram(program.prog_pick)             # <<<<<<<<<<<<<<
 *     IF SOURCEGLVERSION == 'GL': #px/
 *     #if True:
 */
  glUseProgram(__pyx_v_7_glarea_program.prog_pick);

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

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

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

  /* "_glarea.pyx":342
 *     glClearColor(0., 0., 0., 1.)
 *     _gl_set_matrix(program.picking_location, frustum.picking_matrix)
 *     _gl_set_matrix(program.projection_pick_location, frustum.projection_matrix)             # <<<<<<<<<<<<<<
 *     _gl_set_matrix(program.modelview_pick_location, frustum.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_frustum.projection_matrix);

  /* "_glarea.pyx":343
 *     _gl_set_matrix(program.picking_location, frustum.picking_matrix)
 *     _gl_set_matrix(program.projection_pick_location, frustum.projection_matrix)
 *     _gl_set_matrix(program.modelview_pick_location, frustum.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_frustum.modelview_matrix);

  /* "_glarea.pyx":344
 *     _gl_set_matrix(program.projection_pick_location, frustum.projection_matrix)
 *     _gl_set_matrix(program.modelview_pick_location, frustum.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":345
 *     _gl_set_matrix(program.modelview_pick_location, frustum.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();

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

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":347
 *     gl_pick_cube()
 * 
 * cpdef gl_pick_polygons(int x, int y): #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":351
 *     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_2 = (0 <= __pyx_v_x);
  if (__pyx_t_2) {
    __pyx_t_2 = (__pyx_v_x < __pyx_v_7_glarea_terrain.width);
  }
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (0 <= __pyx_v_y);
  if (__pyx_t_3) {
    __pyx_t_3 = (__pyx_v_y < __pyx_v_7_glarea_terrain.height);
  }
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "_glarea.pyx":352
 * 
 *     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;
  }

  /* "_glarea.pyx":353
 *     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":354
 *         return 0
 *     _set_picking_matrix(x, y)
 *     _gl_render_pick()             # <<<<<<<<<<<<<<
 *     glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, pixel) #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":355
 *     _set_picking_matrix(x, y)
 *     _gl_render_pick()
 *     glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, pixel) #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":357
 *     glReadPixels(x, y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, pixel) #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":358
 *     #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(float *vvect, int *mvect): #px/
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_index); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

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

  /* function exit code */
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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 = 347; __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 = 347; __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_As_int(values[0]); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_y == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __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 = 347; __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);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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 = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* function exit code */
  __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":360
 *     return index
 * 
 * cdef void _modelview_to_viewport(float *vvect, int *mvect): #px/             # <<<<<<<<<<<<<<
 * #def _modelview_to_viewport(vvect, mvect):
 *     cdef vec4 *M #px+
 */

static void __pyx_f_7_glarea__modelview_to_viewport(float *__pyx_v_vvect, int *__pyx_v_mvect) {
  __pyx_t_7_gldraw_vec4 *__pyx_v_M;
  __pyx_t_7_gldraw_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
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_modelview_to_viewport", 0);

  /* "_glarea.pyx":366
 *     cdef float u0, u1, u2, v0, v1, v3 #px+
 * 
 *     M = <vec4*>&frustum.modelview_matrix[0][0] #px/             # <<<<<<<<<<<<<<
 *     #M = frustum.modelview_matrix
 *     P = <vec4*>&frustum.projection_matrix[0][0] #px/
 */
  __pyx_v_M = ((__pyx_t_7_gldraw_vec4 *)(&((__pyx_v_7_glarea_frustum.modelview_matrix[0])[0])));

  /* "_glarea.pyx":368
 *     M = <vec4*>&frustum.modelview_matrix[0][0] #px/
 *     #M = frustum.modelview_matrix
 *     P = <vec4*>&frustum.projection_matrix[0][0] #px/             # <<<<<<<<<<<<<<
 *     #P = frustum.projection_matrix
 * 
 */
  __pyx_v_P = ((__pyx_t_7_gldraw_vec4 *)(&((__pyx_v_7_glarea_frustum.projection_matrix[0])[0])));

  /* "_glarea.pyx":373
 *     # u = M^T * vvect
 *     #assert M[1][0] == 0
 *     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_v_u0 = ((((((__pyx_v_M[0])[0]) * (__pyx_v_vvect[0])) + (((__pyx_v_M[1])[0]) * (__pyx_v_vvect[1]))) + (((__pyx_v_M[2])[0]) * (__pyx_v_vvect[2]))) + ((__pyx_v_M[3])[0]));

  /* "_glarea.pyx":374
 *     #assert M[1][0] == 0
 *     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_v_u1 = ((((((__pyx_v_M[0])[1]) * (__pyx_v_vvect[0])) + (((__pyx_v_M[1])[1]) * (__pyx_v_vvect[1]))) + (((__pyx_v_M[2])[1]) * (__pyx_v_vvect[2]))) + ((__pyx_v_M[3])[1]));

  /* "_glarea.pyx":375
 *     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_v_u2 = ((((((__pyx_v_M[0])[2]) * (__pyx_v_vvect[0])) + (((__pyx_v_M[1])[2]) * (__pyx_v_vvect[1]))) + (((__pyx_v_M[2])[2]) * (__pyx_v_vvect[2]))) + ((__pyx_v_M[3])[2]));

  /* "_glarea.pyx":379
 * 
 *     # 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":380
 *     # 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":382
 *     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":384
 *     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)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __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":385
 * 
 *     mvect[0] = int((v0 / v3 + 1) / 2 * terrain.width)
 *     mvect[1] = int((v1 / v3 + 1) / 2 * terrain.height)             # <<<<<<<<<<<<<<
 * 
 * cdef void _viewport_to_modelview(int *vvect, float *mvect): #px/
 */
  if (unlikely(__pyx_v_v3 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __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));

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

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("_glarea._modelview_to_viewport", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":387
 *     mvect[1] = int((v1 / v3 + 1) / 2 * terrain.height)
 * 
 * cdef void _viewport_to_modelview(int *vvect, float *mvect): #px/             # <<<<<<<<<<<<<<
 * #def _viewport_to_modelview(vvect, mvect):
 *     cdef vec4 *MT #px+
 */

static void __pyx_f_7_glarea__viewport_to_modelview(int *__pyx_v_vvect, float *__pyx_v_mvect) {
  __pyx_t_7_gldraw_vec4 *__pyx_v_MT;
  __pyx_t_7_gldraw_vec4 *__pyx_v_P;
  float __pyx_v_u0;
  float __pyx_v_u1;
  float __pyx_v_u2;
  float __pyx_v_u3;
  float __pyx_v_v0;
  float __pyx_v_v1;
  float __pyx_v_v2;
  __Pyx_RefNannyDeclarations
  float __pyx_t_1;
  float __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_viewport_to_modelview", 0);

  /* "_glarea.pyx":393
 *     cdef float u0, u1, u2, u3, v0, v1, v2 #px+
 * 
 *     v0 = vvect[0] / terrain.width * 2 - 1             # <<<<<<<<<<<<<<
 *     v1 = vvect[1] / terrain.height * 2 - 1
 *     v2 = 0
 */
  if (unlikely(__pyx_v_7_glarea_terrain.width == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_v0 = (((((double)(__pyx_v_vvect[0])) / ((double)__pyx_v_7_glarea_terrain.width)) * 2.0) - 1.0);

  /* "_glarea.pyx":394
 * 
 *     v0 = vvect[0] / terrain.width * 2 - 1
 *     v1 = vvect[1] / terrain.height * 2 - 1             # <<<<<<<<<<<<<<
 *     v2 = 0
 *     #v3 = 1
 */
  if (unlikely(__pyx_v_7_glarea_terrain.height == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_v1 = (((((double)(__pyx_v_vvect[1])) / ((double)__pyx_v_7_glarea_terrain.height)) * 2.0) - 1.0);

  /* "_glarea.pyx":395
 *     v0 = vvect[0] / terrain.width * 2 - 1
 *     v1 = vvect[1] / terrain.height * 2 - 1
 *     v2 = 0             # <<<<<<<<<<<<<<
 *     #v3 = 1
 * 
 */
  __pyx_v_v2 = 0.0;

  /* "_glarea.pyx":403
 *     # 0 0 e c     0 0 0 D     0  0  cC 0
 *     # 0 0 d 0     0 0 C E     0  0  0  dD
 *     P = <vec4*>&frustum.projection_matrix[0][0] #px/             # <<<<<<<<<<<<<<
 *     #P = frustum.projection_matrix
 *     # u = P^-1 * v
 */
  __pyx_v_P = ((__pyx_t_7_gldraw_vec4 *)(&((__pyx_v_7_glarea_frustum.projection_matrix[0])[0])));

  /* "_glarea.pyx":406
 *     #P = frustum.projection_matrix
 *     # u = P^-1 * v
 *     u0 = 1 / P[0][0] * v0             # <<<<<<<<<<<<<<
 *     u1 = 1 / P[1][1] * v1
 *     u2 = 1 / P[2][3]
 */
  if (unlikely(((__pyx_v_P[0])[0]) == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_u0 = ((1.0 / ((__pyx_v_P[0])[0])) * __pyx_v_v0);

  /* "_glarea.pyx":407
 *     # u = P^-1 * v
 *     u0 = 1 / P[0][0] * v0
 *     u1 = 1 / P[1][1] * v1             # <<<<<<<<<<<<<<
 *     u2 = 1 / P[2][3]
 *     #assert u2 == -1
 */
  if (unlikely(((__pyx_v_P[1])[1]) == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_u1 = ((1.0 / ((__pyx_v_P[1])[1])) * __pyx_v_v1);

  /* "_glarea.pyx":408
 *     u0 = 1 / P[0][0] * v0
 *     u1 = 1 / P[1][1] * v1
 *     u2 = 1 / P[2][3]             # <<<<<<<<<<<<<<
 *     #assert u2 == -1
 *     u3 = - P[2][2] / P[3][2] / P[2][3]
 */
  if (unlikely(((__pyx_v_P[2])[3]) == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_u2 = (1.0 / ((__pyx_v_P[2])[3]));

  /* "_glarea.pyx":410
 *     u2 = 1 / P[2][3]
 *     #assert u2 == -1
 *     u3 = - P[2][2] / P[3][2] / P[2][3]             # <<<<<<<<<<<<<<
 * 
 *     # MT * MT^-1 = I
 */
  __pyx_t_1 = (-((__pyx_v_P[2])[2]));
  if (unlikely(((__pyx_v_P[3])[2]) == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = (__pyx_t_1 / ((__pyx_v_P[3])[2]));
  if (unlikely(((__pyx_v_P[2])[3]) == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_u3 = (__pyx_t_2 / ((__pyx_v_P[2])[3]));

  /* "_glarea.pyx":417
 *     # f g h 0     c e h 0     0 0 1 0    W = -hz
 *     # 0 0 z 1     U V W 1     0 0 0 1
 *     MT = <vec4*>&frustum.modelview_matrix[0][0] #px/             # <<<<<<<<<<<<<<
 *     #MT = frustum.modelview_matrix
 *     # v = M^-1 * u
 */
  __pyx_v_MT = ((__pyx_t_7_gldraw_vec4 *)(&((__pyx_v_7_glarea_frustum.modelview_matrix[0])[0])));

  /* "_glarea.pyx":420
 *     #MT = frustum.modelview_matrix
 *     # v = M^-1 * u
 *     v0 = MT[0][0]*u0 + MT[0][1]*u1 + MT[0][2]*u2 - MT[0][2] * MT[3][2]*u3             # <<<<<<<<<<<<<<
 *     v1 = MT[1][0]*u0 + MT[1][1]*u1 + MT[1][2]*u2 - MT[1][2] * MT[3][2]*u3
 *     v2 = MT[2][0]*u0 + MT[2][1]*u1 + MT[2][2]*u2 - MT[2][2] * MT[3][2]*u3
 */
  __pyx_v_v0 = ((((((__pyx_v_MT[0])[0]) * __pyx_v_u0) + (((__pyx_v_MT[0])[1]) * __pyx_v_u1)) + (((__pyx_v_MT[0])[2]) * __pyx_v_u2)) - ((((__pyx_v_MT[0])[2]) * ((__pyx_v_MT[3])[2])) * __pyx_v_u3));

  /* "_glarea.pyx":421
 *     # v = M^-1 * u
 *     v0 = MT[0][0]*u0 + MT[0][1]*u1 + MT[0][2]*u2 - MT[0][2] * MT[3][2]*u3
 *     v1 = MT[1][0]*u0 + MT[1][1]*u1 + MT[1][2]*u2 - MT[1][2] * MT[3][2]*u3             # <<<<<<<<<<<<<<
 *     v2 = MT[2][0]*u0 + MT[2][1]*u1 + MT[2][2]*u2 - MT[2][2] * MT[3][2]*u3
 *     #v3 = u3
 */
  __pyx_v_v1 = ((((((__pyx_v_MT[1])[0]) * __pyx_v_u0) + (((__pyx_v_MT[1])[1]) * __pyx_v_u1)) + (((__pyx_v_MT[1])[2]) * __pyx_v_u2)) - ((((__pyx_v_MT[1])[2]) * ((__pyx_v_MT[3])[2])) * __pyx_v_u3));

  /* "_glarea.pyx":422
 *     v0 = MT[0][0]*u0 + MT[0][1]*u1 + MT[0][2]*u2 - MT[0][2] * MT[3][2]*u3
 *     v1 = MT[1][0]*u0 + MT[1][1]*u1 + MT[1][2]*u2 - MT[1][2] * MT[3][2]*u3
 *     v2 = MT[2][0]*u0 + MT[2][1]*u1 + MT[2][2]*u2 - MT[2][2] * MT[3][2]*u3             # <<<<<<<<<<<<<<
 *     #v3 = u3
 * 
 */
  __pyx_v_v2 = ((((((__pyx_v_MT[2])[0]) * __pyx_v_u0) + (((__pyx_v_MT[2])[1]) * __pyx_v_u1)) + (((__pyx_v_MT[2])[2]) * __pyx_v_u2)) - ((((__pyx_v_MT[2])[2]) * ((__pyx_v_MT[3])[2])) * __pyx_v_u3));

  /* "_glarea.pyx":425
 *     #v3 = u3
 * 
 *     mvect[0] = v0 / u3             # <<<<<<<<<<<<<<
 *     mvect[1] = v1 / u3
 *     mvect[2] = v2 / u3
 */
  if (unlikely(__pyx_v_u3 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  (__pyx_v_mvect[0]) = (__pyx_v_v0 / __pyx_v_u3);

  /* "_glarea.pyx":426
 * 
 *     mvect[0] = v0 / u3
 *     mvect[1] = v1 / u3             # <<<<<<<<<<<<<<
 *     mvect[2] = v2 / u3
 * 
 */
  if (unlikely(__pyx_v_u3 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  (__pyx_v_mvect[1]) = (__pyx_v_v1 / __pyx_v_u3);

  /* "_glarea.pyx":427
 *     mvect[0] = v0 / u3
 *     mvect[1] = v1 / u3
 *     mvect[2] = v2 / u3             # <<<<<<<<<<<<<<
 * 
 * def get_cursor_angle(xi, yi, d):
 */
  if (unlikely(__pyx_v_u3 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  (__pyx_v_mvect[2]) = (__pyx_v_v2 / __pyx_v_u3);

  /* "_glarea.pyx":387
 *     mvect[1] = int((v1 / v3 + 1) / 2 * terrain.height)
 * 
 * cdef void _viewport_to_modelview(int *vvect, float *mvect): #px/             # <<<<<<<<<<<<<<
 * #def _viewport_to_modelview(vvect, mvect):
 *     cdef vec4 *MT #px+
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("_glarea._viewport_to_modelview", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":429
 *     mvect[2] = v2 / u3
 * 
 * def get_cursor_angle(xi, yi, d):             # <<<<<<<<<<<<<<
 *     cdef float angle #px+
 *     cdef int i #px+
 */

/* Python wrapper */
static PyObject *__pyx_pw_7_glarea_23get_cursor_angle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7_glarea_23get_cursor_angle = {"get_cursor_angle", (PyCFunction)__pyx_pw_7_glarea_23get_cursor_angle, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7_glarea_23get_cursor_angle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_xi = 0;
  PyObject *__pyx_v_yi = 0;
  PyObject *__pyx_v_d = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_cursor_angle (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xi,&__pyx_n_s_yi,&__pyx_n_s_d,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_xi)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_cursor_angle", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_cursor_angle", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __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 = 429; __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_xi = values[0];
    __pyx_v_yi = values[1];
    __pyx_v_d = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_cursor_angle", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __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_xi, __pyx_v_yi, __pyx_v_d);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7_glarea_22get_cursor_angle(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xi, PyObject *__pyx_v_yi, PyObject *__pyx_v_d) {
  float __pyx_v_angle;
  int __pyx_v_i;
  float __pyx_v_x;
  float __pyx_v_y;
  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;
  float __pyx_t_5;
  double __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_cursor_angle", 0);

  /* "_glarea.pyx":433
 *     cdef int i #px+
 *     cdef float x, y #px+
 *     selection_debug_points.viewport1[0] = xi             # <<<<<<<<<<<<<<
 *     selection_debug_points.viewport1[1] = yi
 *     _viewport_to_modelview(selection_debug_points.viewport1, selection_debug_points.modelview1)
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_xi); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  (__pyx_v_7_glarea_selection_debug_points.viewport1[0]) = __pyx_t_1;

  /* "_glarea.pyx":434
 *     cdef float x, y #px+
 *     selection_debug_points.viewport1[0] = xi
 *     selection_debug_points.viewport1[1] = yi             # <<<<<<<<<<<<<<
 *     _viewport_to_modelview(selection_debug_points.viewport1, selection_debug_points.modelview1)
 *     for i in range(3):
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_yi); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  (__pyx_v_7_glarea_selection_debug_points.viewport1[1]) = __pyx_t_1;

  /* "_glarea.pyx":435
 *     selection_debug_points.viewport1[0] = xi
 *     selection_debug_points.viewport1[1] = yi
 *     _viewport_to_modelview(selection_debug_points.viewport1, selection_debug_points.modelview1)             # <<<<<<<<<<<<<<
 *     for i in range(3):
 *         selection_debug_points.modelview2[i] = d[i] + selection_debug_points.modelview1[i]
 */
  __pyx_f_7_glarea__viewport_to_modelview(__pyx_v_7_glarea_selection_debug_points.viewport1, __pyx_v_7_glarea_selection_debug_points.modelview1);

  /* "_glarea.pyx":436
 *     selection_debug_points.viewport1[1] = yi
 *     _viewport_to_modelview(selection_debug_points.viewport1, selection_debug_points.modelview1)
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         selection_debug_points.modelview2[i] = d[i] + selection_debug_points.modelview1[i]
 *     _modelview_to_viewport(selection_debug_points.modelview2, selection_debug_points.viewport2)
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "_glarea.pyx":437
 *     _viewport_to_modelview(selection_debug_points.viewport1, selection_debug_points.modelview1)
 *     for i in range(3):
 *         selection_debug_points.modelview2[i] = d[i] + selection_debug_points.modelview1[i]             # <<<<<<<<<<<<<<
 *     _modelview_to_viewport(selection_debug_points.modelview2, selection_debug_points.viewport2)
 *     x = selection_debug_points.viewport1[0] - selection_debug_points.viewport2[0]
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_d, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_7_glarea_selection_debug_points.modelview1[__pyx_v_i])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __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_3); __pyx_t_3 = 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 = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    (__pyx_v_7_glarea_selection_debug_points.modelview2[__pyx_v_i]) = __pyx_t_5;
  }

  /* "_glarea.pyx":438
 *     for i in range(3):
 *         selection_debug_points.modelview2[i] = d[i] + selection_debug_points.modelview1[i]
 *     _modelview_to_viewport(selection_debug_points.modelview2, 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_7_glarea_selection_debug_points.modelview2, __pyx_v_7_glarea_selection_debug_points.viewport2);

  /* "_glarea.pyx":439
 *         selection_debug_points.modelview2[i] = d[i] + selection_debug_points.modelview1[i]
 *     _modelview_to_viewport(selection_debug_points.modelview2, 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":440
 *     _modelview_to_viewport(selection_debug_points.modelview2, 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":441
 *     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_6 = (atan2(__pyx_v_x, __pyx_v_y) * 180.0);
  if (unlikely(M_PI == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_angle = (__pyx_t_6 / M_PI);

  /* "_glarea.pyx":442
 *     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_4 = PyFloat_FromDouble(__pyx_v_angle); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "_glarea.pyx":429
 *     mvect[2] = v2 / u3
 * 
 * def get_cursor_angle(xi, yi, d):             # <<<<<<<<<<<<<<
 *     cdef float angle #px+
 *     cdef int i #px+
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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":447
 * ### shader functions
 * 
 * cdef void _gl_print_shader_log(GLuint shader): #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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_print_shader_log", 0);

  /* "_glarea.pyx":452
 *     cdef GLsizei length #px+
 *     cdef char log[1024] #px+
 *     glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_len) #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":454
 *     glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_len) #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) != 0);
  if (__pyx_t_1) {

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

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

    /* "_glarea.pyx":458
 *         glGetShaderInfoLog(shader, 1023, &length, log) #px/
 *         #log = glGetShaderInfoLog(shader)
 *         print(log.decode('utf-8').rstrip())             # <<<<<<<<<<<<<<
 *         print('====')
 *     else:
 */
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_log, 0, strlen(__pyx_v_log), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__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 = 458; __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_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __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_2); __pyx_t_2 = 0;

    /* "_glarea.pyx":459
 *         #log = glGetShaderInfoLog(shader)
 *         print(log.decode('utf-8').rstrip())
 *         print('====')             # <<<<<<<<<<<<<<
 *     else:
 *         print('==== Error compiling shader (no log)')
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __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":461
 *         print('====')
 *     else:
 *         print('==== Error compiling shader (no log)')             # <<<<<<<<<<<<<<
 * 
 * cdef void _gl_print_program_log(GLuint program): #px/
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__5, NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

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

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("_glarea._gl_print_shader_log", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":463
 *         print('==== Error compiling shader (no log)')
 * 
 * cdef void _gl_print_program_log(GLuint program): #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;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_print_program_log", 0);

  /* "_glarea.pyx":468
 *     cdef GLsizei length #px+
 *     cdef char log[1024] #px+
 *     glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_len) #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":470
 *     glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_len) #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) != 0);
  if (__pyx_t_1) {

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

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

    /* "_glarea.pyx":474
 *         glGetProgramInfoLog(program, 1023, &length, log) #px/
 *         #log = glGetProgramInfoLog(program)
 *         print(log.decode('utf-8').rstrip())             # <<<<<<<<<<<<<<
 *         print('====')
 *     else:
 */
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_log, 0, strlen(__pyx_v_log), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__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 = 474; __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_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __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_2); __pyx_t_2 = 0;

    /* "_glarea.pyx":475
 *         #log = glGetProgramInfoLog(program)
 *         print(log.decode('utf-8').rstrip())
 *         print('====')             # <<<<<<<<<<<<<<
 *     else:
 *         print('==== Error linking shader program (no log)')
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __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":477
 *         print('====')
 *     else:
 *         print('==== Error linking shader program (no log)')             # <<<<<<<<<<<<<<
 * 
 * cdef GLuint _gl_create_compiled_shader(GLenum shadertype, bytes source): #px/
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

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

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("_glarea._gl_print_program_log", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":479
 *         print('==== Error linking shader program (no log)')
 * 
 * cdef GLuint _gl_create_compiled_shader(GLenum shadertype, bytes source): #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":485
 *     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":486
 * 
 *     shader = glCreateShader(shadertype)
 *     if shader == 0:             # <<<<<<<<<<<<<<
 *         print('Failed to create shader')
 *         return 0
 */
  __pyx_t_1 = ((__pyx_v_shader == 0) != 0);
  if (__pyx_t_1) {

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

    /* "_glarea.pyx":488
 *     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;
  }

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

  /* "_glarea.pyx":490
 *         return 0
 *     pchar = <const_GLchar_ptr><char*>source #px+
 *     glShaderSource(shader, 1, &pchar, NULL) #px/             # <<<<<<<<<<<<<<
 *     #glShaderSource(shader, source.decode('utf-8')) # PyOpenGL needs str currently
 *     glCompileShader(shader)
 */
  glShaderSource(__pyx_v_shader, 1, (&__pyx_v_pchar), NULL);

  /* "_glarea.pyx":492
 *     glShaderSource(shader, 1, &pchar, NULL) #px/
 *     #glShaderSource(shader, source.decode('utf-8')) # PyOpenGL needs str currently
 *     glCompileShader(shader)             # <<<<<<<<<<<<<<
 *     glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) #px/
 *     #compile_status = glGetShaderiv(shader, GL_COMPILE_STATUS)
 */
  glCompileShader(__pyx_v_shader);

  /* "_glarea.pyx":493
 *     #glShaderSource(shader, source.decode('utf-8')) # PyOpenGL needs str currently
 *     glCompileShader(shader)
 *     glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) #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":495
 *     glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) #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 != 0)) != 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":496
 *     #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":497
 *     if not compile_status:
 *         _gl_print_shader_log(shader)
 *         return 0             # <<<<<<<<<<<<<<
 *     return shader
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "_glarea.pyx":498
 *         _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;

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

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_WriteUnraisable("_glarea._gl_create_compiled_shader", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea.pyx":500
 *     return shader
 * 
 * cdef void _gl_print_program_info(GLuint program): #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;
  __pyx_t_2gl_GLenum __pyx_t_12;
  long __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_print_program_info", 0);

  /* "_glarea.pyx":509
 *     cdef char aname[1024] #px+
 * 
 *     print('shader program info', program)             # <<<<<<<<<<<<<<
 *     glValidateProgram(program)
 *     program_info = {}
 */
  __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_program); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __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 = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_kp_u_shader_program_info);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_shader_program_info);
  __Pyx_GIVEREF(__pyx_kp_u_shader_program_info);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

  /* "_glarea.pyx":511
 *     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 = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_program_info = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":512
 *     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 = __Pyx_PyInt_From_int(GL_DELETE_STATUS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __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 = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_kp_u_delete_status);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_delete_status);
  __Pyx_GIVEREF(__pyx_kp_u_delete_status);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":513
 *     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 = __Pyx_PyInt_From_int(GL_LINK_STATUS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __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 = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_kp_u_link_status);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_link_status);
  __Pyx_GIVEREF(__pyx_kp_u_link_status);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":514
 *     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 = __Pyx_PyInt_From_int(GL_VALIDATE_STATUS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __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 = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_kp_u_validate_status);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_validate_status);
  __Pyx_GIVEREF(__pyx_kp_u_validate_status);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":515
 *                        ('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 = __Pyx_PyInt_From_int(GL_INFO_LOG_LENGTH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __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 = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_u_info_log_length);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_info_log_length);
  __Pyx_GIVEREF(__pyx_kp_u_info_log_length);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":516
 *                        ('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 = __Pyx_PyInt_From_int(GL_ATTACHED_SHADERS); 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_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_kp_u_attached_shaders);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_u_attached_shaders);
  __Pyx_GIVEREF(__pyx_kp_u_attached_shaders);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":517
 *                        ('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 = __Pyx_PyInt_From_int(GL_ACTIVE_ATTRIBUTES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __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 = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_kp_u_active_attributes);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_active_attributes);
  __Pyx_GIVEREF(__pyx_kp_u_active_attributes);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":518
 *                        ('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 = __Pyx_PyInt_From_int(GL_ACTIVE_ATTRIBUTE_MAX_LENGTH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __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 = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_u_active_attribute_max_length);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u_active_attribute_max_length);
  __Pyx_GIVEREF(__pyx_kp_u_active_attribute_max_length);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":519
 *                        ('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 = __Pyx_PyInt_From_int(GL_ACTIVE_UNIFORMS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __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 = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_kp_u_active_uniforms);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_kp_u_active_uniforms);
  __Pyx_GIVEREF(__pyx_kp_u_active_uniforms);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":520
 *                        ('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/
 *         #param = glGetProgramiv(program, pname)
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(GL_ACTIVE_UNIFORM_MAX_LENGTH); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __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 = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_INCREF(__pyx_kp_u_active_uniform_max_length);
  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_kp_u_active_uniform_max_length);
  __Pyx_GIVEREF(__pyx_kp_u_active_uniform_max_length);
  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea.pyx":512
 *     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 = PyTuple_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_1, 7, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_1, 8, __pyx_t_10);
  __Pyx_GIVEREF(__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 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_11 >= 9) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyTuple_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 = 512; __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 = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if (likely(__pyx_t_1 != Py_None)) {
      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 = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyTuple_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 = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_XDECREF_SET(__pyx_v_msg, __pyx_t_9);
    __pyx_t_9 = 0;
    __Pyx_XDECREF_SET(__pyx_v_pname, __pyx_t_8);
    __pyx_t_8 = 0;

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

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

    /* "_glarea.pyx":524
 *         #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 = __Pyx_PyInt_From_int(__pyx_v_param); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __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 = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_kp_u__10);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_u__10);
    __Pyx_GIVEREF(__pyx_kp_u__10);
    __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 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea.pyx":512
 *     glValidateProgram(program)
 *     program_info = {}
 *     for msg, pname in [('delete status', GL_DELETE_STATUS),             # <<<<<<<<<<<<<<
 *                        ('link status', GL_LINK_STATUS),
 *                        ('validate status', GL_VALIDATE_STATUS),
 */
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "_glarea.pyx":525
 *         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 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "_glarea.pyx":526
 *         print(' ', msg, param)
 *     print('active attributes:')
 *     for i in range(program_info[GL_ACTIVE_ATTRIBUTES]):             # <<<<<<<<<<<<<<
 *         glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) #px/
 *         #aname, asize, atype = glGetActiveAttrib(program, i); alength = len(aname)
 */
  __pyx_t_10 = __Pyx_PyInt_From_int(GL_ACTIVE_ATTRIBUTES); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_program_info, __pyx_t_10); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_13 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "_glarea.pyx":527
 *     print('active attributes:')
 *     for i in range(program_info[GL_ACTIVE_ATTRIBUTES]):
 *         glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) #px/             # <<<<<<<<<<<<<<
 *         #aname, asize, atype = glGetActiveAttrib(program, i); alength = len(aname)
 *         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":529
 *         glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) #px/
 *         #aname, asize, atype = glGetActiveAttrib(program, i); alength = len(aname)
 *         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":530
 *         #aname, asize, atype = glGetActiveAttrib(program, i); alength = len(aname)
 *         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 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_length_size_type_location, __pyx_n_s_format); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyBytes_FromString(__pyx_v_aname); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_alength); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_asize); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_atype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_location); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_2 = PyTuple_New(6+__pyx_t_11); 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);
    if (__pyx_t_3) {
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    }
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_11, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_11, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_11, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 3+__pyx_t_11, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_2, 4+__pyx_t_11, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 5+__pyx_t_11, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_8 = 0;
    __pyx_t_9 = 0;
    __pyx_t_7 = 0;
    __pyx_t_6 = 0;
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "_glarea.pyx":531
 *         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_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_glarea.pyx":532
 *         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/
 *         #aname, asize, atype = glGetActiveUniform(program, i); alength = len(aname)
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(GL_ACTIVE_UNIFORMS); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_program_info, __pyx_t_1); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_13 = __Pyx_PyInt_As_long(__pyx_t_10); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "_glarea.pyx":533
 *     print('active uniforms:')
 *     for i in range(program_info[GL_ACTIVE_UNIFORMS]):
 *         glGetActiveUniform(program, i, 1023, &alength, &asize, &atype, aname) #px/             # <<<<<<<<<<<<<<
 *         #aname, asize, atype = glGetActiveUniform(program, i); alength = len(aname)
 *         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":535
 *         glGetActiveUniform(program, i, 1023, &alength, &asize, &atype, aname) #px/
 *         #aname, asize, atype = glGetActiveUniform(program, i); alength = len(aname)
 *         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":536
 *         #aname, asize, atype = glGetActiveUniform(program, i); alength = len(aname)
 *         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, int attrib_location, list attributes): #px/
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_length_size_type_location, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_aname); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_alength); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_asize); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyInt_From_unsigned_int(__pyx_v_atype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_location); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = NULL;
    __pyx_t_11 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_11 = 1;
      }
    }
    __pyx_t_3 = PyTuple_New(6+__pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__pyx_t_8) {
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
    }
    PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_11, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_11, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_11, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_11, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_3, 4+__pyx_t_11, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_3, 5+__pyx_t_11, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_9 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__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 = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  }

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

  /* function exit code */
  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, 0);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_program_info);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XDECREF(__pyx_v_pname);
  __Pyx_RefNannyFinishContext();
}

/* "_glarea.pyx":538
 *         print('  {}, {}: length={} size={} type={} location={}'.format(i, aname, alength, asize, atype, location))
 * 
 * cdef GLuint _gl_create_program(bytes vertex_source, bytes fragment_source, int attrib_location, list attributes): #px/             # <<<<<<<<<<<<<<
 * #def _gl_create_program(vertex_source, fragment_source, attrib_location, 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, int __pyx_v_attrib_location, 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;
  __pyx_t_2gl_GLuint __pyx_t_8;
  __pyx_t_2gl_GLchar *__pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_gl_create_program", 0);

  /* "_glarea.pyx":540
 * cdef GLuint _gl_create_program(bytes vertex_source, bytes fragment_source, int attrib_location, list attributes): #px/
 * #def _gl_create_program(vertex_source, fragment_source, attrib_location, 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":544
 *     cdef GLint link_status #px+
 * 
 *     if DEBUG_NOSHADER:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG_NOSHADER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __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 = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

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

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

  /* "_glarea.pyx":548
 * 
 *     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_GetModuleGlobalName(__pyx_n_s_DEBUG_NOVSHADER); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __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 = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "_glarea.pyx":549
 *     program = glCreateProgram()
 *     if not DEBUG_NOVSHADER:
 *         debug('  creating vertex shader')             # <<<<<<<<<<<<<<
 *         vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *         if vertex_shader:
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __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":550
 *     if not DEBUG_NOVSHADER:
 *         debug('  creating vertex shader')
 *         vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)             # <<<<<<<<<<<<<<
 *         if vertex_shader:
 *             glAttachShader(program, vertex_shader)
 */
    __pyx_v_vertex_shader = __pyx_f_7_glarea__gl_create_compiled_shader(GL_VERTEX_SHADER, __pyx_v_vertex_source);

    /* "_glarea.pyx":551
 *         debug('  creating vertex shader')
 *         vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *         if vertex_shader:             # <<<<<<<<<<<<<<
 *             glAttachShader(program, vertex_shader)
 *         else:
 */
    __pyx_t_3 = (__pyx_v_vertex_shader != 0);
    if (__pyx_t_3) {

      /* "_glarea.pyx":552
 *         vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *         if vertex_shader:
 *             glAttachShader(program, vertex_shader)             # <<<<<<<<<<<<<<
 *         else:
 *             print('error: no vertex shader')
 */
      glAttachShader(__pyx_v_program, __pyx_v_vertex_shader);
      goto __pyx_L5;
    }
    /*else*/ {

      /* "_glarea.pyx":554
 *             glAttachShader(program, vertex_shader)
 *         else:
 *             print('error: no vertex shader')             # <<<<<<<<<<<<<<
 *     if not DEBUG_NOFSHADER:
 *         debug('  creating fragment shader')
 */
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "_glarea.pyx":555
 *         else:
 *             print('error: no 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_GetModuleGlobalName(__pyx_n_s_DEBUG_NOFSHADER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __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 = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = ((!__pyx_t_3) != 0);
  if (__pyx_t_2) {

    /* "_glarea.pyx":556
 *             print('error: no vertex shader')
 *     if not DEBUG_NOFSHADER:
 *         debug('  creating fragment shader')             # <<<<<<<<<<<<<<
 *         fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *         if fragment_shader:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_debug); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __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":557
 *     if not DEBUG_NOFSHADER:
 *         debug('  creating fragment shader')
 *         fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)             # <<<<<<<<<<<<<<
 *         if fragment_shader:
 *             glAttachShader(program, fragment_shader)
 */
    __pyx_v_fragment_shader = __pyx_f_7_glarea__gl_create_compiled_shader(GL_FRAGMENT_SHADER, __pyx_v_fragment_source);

    /* "_glarea.pyx":558
 *         debug('  creating fragment shader')
 *         fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *         if fragment_shader:             # <<<<<<<<<<<<<<
 *             glAttachShader(program, fragment_shader)
 *         else:
 */
    __pyx_t_2 = (__pyx_v_fragment_shader != 0);
    if (__pyx_t_2) {

      /* "_glarea.pyx":559
 *         fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *         if fragment_shader:
 *             glAttachShader(program, fragment_shader)             # <<<<<<<<<<<<<<
 *         else:
 *             print('error: no fragment shader')
 */
      glAttachShader(__pyx_v_program, __pyx_v_fragment_shader);
      goto __pyx_L7;
    }
    /*else*/ {

      /* "_glarea.pyx":561
 *             glAttachShader(program, fragment_shader)
 *         else:
 *             print('error: no fragment shader')             # <<<<<<<<<<<<<<
 *     for index, name in enumerate(attributes):
 *         if name is not None:
 */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "_glarea.pyx":562
 *         else:
 *             print('error: no fragment shader')
 *     for index, name in enumerate(attributes):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             glBindAttribLocation(program, attrib_location+index, name)
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_1 = __pyx_int_0;
  __pyx_t_4 = __pyx_v_attributes; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_1);
    __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "_glarea.pyx":563
 *             print('error: no fragment shader')
 *     for index, name in enumerate(attributes):
 *         if name is not None:             # <<<<<<<<<<<<<<
 *             glBindAttribLocation(program, attrib_location+index, name)
 *     glLinkProgram(program)
 */
    __pyx_t_2 = (__pyx_v_name != Py_None);
    __pyx_t_3 = (__pyx_t_2 != 0);
    if (__pyx_t_3) {

      /* "_glarea.pyx":564
 *     for index, name in enumerate(attributes):
 *         if name is not None:
 *             glBindAttribLocation(program, attrib_location+index, name)             # <<<<<<<<<<<<<<
 *     glLinkProgram(program)
 *     glGetProgramiv(program, GL_LINK_STATUS, &link_status) #px/
 */
      __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_attrib_location); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyNumber_Add(__pyx_t_6, __pyx_v_index); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_8 = __Pyx_PyInt_As_unsigned_int(__pyx_t_7); if (unlikely((__pyx_t_8 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_v_name); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      glBindAttribLocation(__pyx_v_program, __pyx_t_8, __pyx_t_9);
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "_glarea.pyx":562
 *         else:
 *             print('error: no fragment shader')
 *     for index, name in enumerate(attributes):             # <<<<<<<<<<<<<<
 *         if name is not None:
 *             glBindAttribLocation(program, attrib_location+index, name)
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_glarea.pyx":565
 *         if name is not None:
 *             glBindAttribLocation(program, attrib_location+index, name)
 *     glLinkProgram(program)             # <<<<<<<<<<<<<<
 *     glGetProgramiv(program, GL_LINK_STATUS, &link_status) #px/
 *     #link_status = glGetProgramiv(program, GL_LINK_STATUS)
 */
  glLinkProgram(__pyx_v_program);

  /* "_glarea.pyx":566
 *             glBindAttribLocation(program, attrib_location+index, name)
 *     glLinkProgram(program)
 *     glGetProgramiv(program, GL_LINK_STATUS, &link_status) #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":568
 *     glGetProgramiv(program, GL_LINK_STATUS, &link_status) #px/
 *     #link_status = glGetProgramiv(program, GL_LINK_STATUS)
 *     if not link_status:             # <<<<<<<<<<<<<<
 *         _gl_print_program_log(program)
 *         return 0
 */
  __pyx_t_3 = ((!(__pyx_v_link_status != 0)) != 0);
  if (__pyx_t_3) {

    /* "_glarea.pyx":569
 *     #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":570
 *     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;
  }

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

    /* "_glarea.pyx":572
 *         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_L12;
  }
  __pyx_L12:;

  /* "_glarea.pyx":573
 *     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":574
 *         _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":575
 *     glDetachShader(program, vertex_shader)
 *     glDetachShader(program, fragment_shader)
 *     glDeleteShader(vertex_shader)             # <<<<<<<<<<<<<<
 *     glDeleteShader(fragment_shader)
 *     return program
 */
  glDeleteShader(__pyx_v_vertex_shader);

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

  /* "_glarea.pyx":577
 *     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;

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

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

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

/* 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 = {"gl_create_render_program", (PyCFunction)__pyx_pw_7_glarea_25gl_create_render_program, METH_VARARGS|METH_KEYWORDS, 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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 = 579; __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 = 579; __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 = 579; __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 = 579; __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 = 579; __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);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_create_render_program", 0);

  /* "_glarea.pyx":582
 * #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) != 0);
  if (__pyx_t_1) {

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

  /* "_glarea.pyx":584
 *     if program.prog_render > 0:
 *         glDeleteProgram(program.prog_render)
 *     attributes = [             # <<<<<<<<<<<<<<
 *                   b'vertex_attr',
 *                   b'normal_attr',
 */
  __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_b_vertex_attr);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_b_vertex_attr);
  __Pyx_GIVEREF(__pyx_n_b_vertex_attr);
  __Pyx_INCREF(__pyx_n_b_normal_attr);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_b_normal_attr);
  __Pyx_GIVEREF(__pyx_n_b_normal_attr);
  __Pyx_INCREF(__pyx_n_b_color_attr);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_b_color_attr);
  __Pyx_GIVEREF(__pyx_n_b_color_attr);
  __Pyx_INCREF(__pyx_n_b_texcoord_attr);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_b_texcoord_attr);
  __Pyx_GIVEREF(__pyx_n_b_texcoord_attr);
  __Pyx_INCREF(__pyx_n_b_barycentric_attr);
  PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_b_barycentric_attr);
  __Pyx_GIVEREF(__pyx_n_b_barycentric_attr);
  __pyx_v_attributes = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_glarea.pyx":591
 *                   b'barycentric_attr',
 *                  ]
 *     program.prog_render = _gl_create_program(vertex_source, fragment_source, ATTRIB_LOCATION, 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_e_7_gldraw_ATTRIB_LOCATION, __pyx_v_attributes);

  /* "_glarea.pyx":592
 *                  ]
 *     program.prog_render = _gl_create_program(vertex_source, fragment_source, ATTRIB_LOCATION, 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) != 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":593
 *     program.prog_render = _gl_create_program(vertex_source, fragment_source, ATTRIB_LOCATION, 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":594
 *     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":595
 *         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":596
 *         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":597
 *         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":598
 *         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":599
 *         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:;

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

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

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

/* 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 = {"gl_create_hud_program", (PyCFunction)__pyx_pw_7_glarea_27gl_create_hud_program, METH_VARARGS|METH_KEYWORDS, 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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 = 601; __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 = 601; __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 = 601; __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 = 601; __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 = 601; __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);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_create_hud_program", 0);

  /* "_glarea.pyx":604
 * #def gl_create_hud_program(vertex_source, fragment_source):
 *     cdef GLint location #px+
 *     if program.prog_hud > 0:             # <<<<<<<<<<<<<<
 *         glDeleteProgram(program.prog_hud)
 *     attributes = [b'vertex_attr', None, b'color_attr']
 */
  __pyx_t_1 = ((__pyx_v_7_glarea_program.prog_hud > 0) != 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":605
 *     cdef GLint location #px+
 *     if program.prog_hud > 0:
 *         glDeleteProgram(program.prog_hud)             # <<<<<<<<<<<<<<
 *     attributes = [b'vertex_attr', None, b'color_attr']
 *     program.prog_hud = _gl_create_program(vertex_source, fragment_source, ATTRIB_LOCATION, attributes)
 */
    glDeleteProgram(__pyx_v_7_glarea_program.prog_hud);
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "_glarea.pyx":606
 *     if program.prog_hud > 0:
 *         glDeleteProgram(program.prog_hud)
 *     attributes = [b'vertex_attr', None, b'color_attr']             # <<<<<<<<<<<<<<
 *     program.prog_hud = _gl_create_program(vertex_source, fragment_source, ATTRIB_LOCATION, attributes)
 *     if program.prog_hud > 0:
 */
  __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_b_vertex_attr);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_b_vertex_attr);
  __Pyx_GIVEREF(__pyx_n_b_vertex_attr);
  __Pyx_INCREF(Py_None);
  PyList_SET_ITEM(__pyx_t_2, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_INCREF(__pyx_n_b_color_attr);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_b_color_attr);
  __Pyx_GIVEREF(__pyx_n_b_color_attr);
  __pyx_v_attributes = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_glarea.pyx":607
 *         glDeleteProgram(program.prog_hud)
 *     attributes = [b'vertex_attr', None, b'color_attr']
 *     program.prog_hud = _gl_create_program(vertex_source, fragment_source, ATTRIB_LOCATION, 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_e_7_gldraw_ATTRIB_LOCATION, __pyx_v_attributes);

  /* "_glarea.pyx":608
 *     attributes = [b'vertex_attr', None, b'color_attr']
 *     program.prog_hud = _gl_create_program(vertex_source, fragment_source, ATTRIB_LOCATION, attributes)
 *     if program.prog_hud > 0:             # <<<<<<<<<<<<<<
 *         glUseProgram(program.prog_hud)
 * 
 */
  __pyx_t_1 = ((__pyx_v_7_glarea_program.prog_hud > 0) != 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":609
 *     program.prog_hud = _gl_create_program(vertex_source, fragment_source, ATTRIB_LOCATION, 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:;

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

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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;
}

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

/* 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 = {"gl_create_pick_program", (PyCFunction)__pyx_pw_7_glarea_29gl_create_pick_program, METH_VARARGS|METH_KEYWORDS, 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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 = 611; __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 = 611; __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 = 611; __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 = 611; __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 = 611; __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);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_create_pick_program", 0);

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

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

  /* "_glarea.pyx":615
 *     if program.prog_pick > 0:
 *         glDeleteProgram(program.prog_pick)
 *     attributes = [b'vertex_attr', b'color_attr']             # <<<<<<<<<<<<<<
 *     program.prog_pick = _gl_create_program(vertex_source, fragment_source, PICKATTRIB_LOCATION, attributes)
 *     if program.prog_pick > 0:
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_b_vertex_attr);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_b_vertex_attr);
  __Pyx_GIVEREF(__pyx_n_b_vertex_attr);
  __Pyx_INCREF(__pyx_n_b_color_attr);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_b_color_attr);
  __Pyx_GIVEREF(__pyx_n_b_color_attr);
  __pyx_v_attributes = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "_glarea.pyx":616
 *         glDeleteProgram(program.prog_pick)
 *     attributes = [b'vertex_attr', b'color_attr']
 *     program.prog_pick = _gl_create_program(vertex_source, fragment_source, PICKATTRIB_LOCATION, 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_e_7_gldraw_PICKATTRIB_LOCATION, __pyx_v_attributes);

  /* "_glarea.pyx":617
 *     attributes = [b'vertex_attr', b'color_attr']
 *     program.prog_pick = _gl_create_program(vertex_source, fragment_source, PICKATTRIB_LOCATION, 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) != 0);
  if (__pyx_t_1) {

    /* "_glarea.pyx":618
 *     program.prog_pick = _gl_create_program(vertex_source, fragment_source, PICKATTRIB_LOCATION, 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":619
 *     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":620
 *         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":621
 *         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:;

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

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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[] = {
  {"gl_pick_polygons", (PyCFunction)__pyx_pw_7_glarea_21gl_pick_polygons, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "_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_DEBUG, __pyx_k_DEBUG, sizeof(__pyx_k_DEBUG), 0, 0, 1, 1},
  {&__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_kp_u_Error_compiling_shader, __pyx_k_Error_compiling_shader, sizeof(__pyx_k_Error_compiling_shader), 0, 1, 0, 0},
  {&__pyx_kp_u_Error_compiling_shader_no_log, __pyx_k_Error_compiling_shader_no_log, sizeof(__pyx_k_Error_compiling_shader_no_log), 0, 1, 0, 0},
  {&__pyx_kp_u_Error_linking_shader_program, __pyx_k_Error_linking_shader_program, sizeof(__pyx_k_Error_linking_shader_program), 0, 1, 0, 0},
  {&__pyx_kp_u_Error_linking_shader_program_no, __pyx_k_Error_linking_shader_program_no, sizeof(__pyx_k_Error_linking_shader_program_no), 0, 1, 0, 0},
  {&__pyx_kp_u_Failed_to_create_shader, __pyx_k_Failed_to_create_shader, sizeof(__pyx_k_Failed_to_create_shader), 0, 1, 0, 0},
  {&__pyx_n_u_GL, __pyx_k_GL, sizeof(__pyx_k_GL), 0, 1, 0, 1},
  {&__pyx_kp_u_GL_GLES, __pyx_k_GL_GLES, sizeof(__pyx_k_GL_GLES), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_MAX_VERTEX_ATTRIBS, __pyx_k_GL_MAX_VERTEX_ATTRIBS, sizeof(__pyx_k_GL_MAX_VERTEX_ATTRIBS), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_MULTISAMPLE, __pyx_k_GL_MULTISAMPLE, sizeof(__pyx_k_GL_MULTISAMPLE), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_Renderer, __pyx_k_GL_Renderer, sizeof(__pyx_k_GL_Renderer), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_SAMPLES, __pyx_k_GL_SAMPLES, sizeof(__pyx_k_GL_SAMPLES), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_SAMPLE_ALPHA_TO_COVERAGE, __pyx_k_GL_SAMPLE_ALPHA_TO_COVERAGE, sizeof(__pyx_k_GL_SAMPLE_ALPHA_TO_COVERAGE), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_SAMPLE_BUFFERS, __pyx_k_GL_SAMPLE_BUFFERS, sizeof(__pyx_k_GL_SAMPLE_BUFFERS), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_SAMPLE_COVERAGE, __pyx_k_GL_SAMPLE_COVERAGE, sizeof(__pyx_k_GL_SAMPLE_COVERAGE), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_SAMPLE_COVERAGE_INVERT, __pyx_k_GL_SAMPLE_COVERAGE_INVERT, sizeof(__pyx_k_GL_SAMPLE_COVERAGE_INVERT), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_SAMPLE_COVERAGE_VALUE, __pyx_k_GL_SAMPLE_COVERAGE_VALUE, sizeof(__pyx_k_GL_SAMPLE_COVERAGE_VALUE), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_Shading_Language_Version, __pyx_k_GL_Shading_Language_Version, sizeof(__pyx_k_GL_Shading_Language_Version), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_Strings, __pyx_k_GL_Strings, sizeof(__pyx_k_GL_Strings), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_Vendor, __pyx_k_GL_Vendor, sizeof(__pyx_k_GL_Vendor), 0, 1, 0, 0},
  {&__pyx_kp_u_GL_Version, __pyx_k_GL_Version, sizeof(__pyx_k_GL_Version), 0, 1, 0, 0},
  {&__pyx_kp_u_Importing_module, __pyx_k_Importing_module, sizeof(__pyx_k_Importing_module), 0, 1, 0, 0},
  {&__pyx_kp_u__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 1, 0, 0},
  {&__pyx_kp_u__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 1, 0, 0},
  {&__pyx_kp_u_active_attribute_max_length, __pyx_k_active_attribute_max_length, sizeof(__pyx_k_active_attribute_max_length), 0, 1, 0, 0},
  {&__pyx_kp_u_active_attributes, __pyx_k_active_attributes, sizeof(__pyx_k_active_attributes), 0, 1, 0, 0},
  {&__pyx_kp_u_active_attributes_2, __pyx_k_active_attributes_2, sizeof(__pyx_k_active_attributes_2), 0, 1, 0, 0},
  {&__pyx_kp_u_active_uniform_max_length, __pyx_k_active_uniform_max_length, sizeof(__pyx_k_active_uniform_max_length), 0, 1, 0, 0},
  {&__pyx_kp_u_active_uniforms, __pyx_k_active_uniforms, sizeof(__pyx_k_active_uniforms), 0, 1, 0, 0},
  {&__pyx_kp_u_active_uniforms_2, __pyx_k_active_uniforms_2, sizeof(__pyx_k_active_uniforms_2), 0, 1, 0, 0},
  {&__pyx_n_s_angle, __pyx_k_angle, sizeof(__pyx_k_angle), 0, 0, 1, 1},
  {&__pyx_kp_u_attached_shaders, __pyx_k_attached_shaders, sizeof(__pyx_k_attached_shaders), 0, 1, 0, 0},
  {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1},
  {&__pyx_n_b_barycentric_attr, __pyx_k_barycentric_attr, sizeof(__pyx_k_barycentric_attr), 0, 0, 0, 1},
  {&__pyx_n_s_blue, __pyx_k_blue, sizeof(__pyx_k_blue), 0, 0, 1, 1},
  {&__pyx_n_s_bounding_sphere_radius, __pyx_k_bounding_sphere_radius, sizeof(__pyx_k_bounding_sphere_radius), 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_compiled, __pyx_k_compiled, sizeof(__pyx_k_compiled), 0, 0, 1, 1},
  {&__pyx_kp_u_compiled_2, __pyx_k_compiled_2, sizeof(__pyx_k_compiled_2), 0, 1, 0, 0},
  {&__pyx_kp_u_creating_fragment_shader, __pyx_k_creating_fragment_shader, sizeof(__pyx_k_creating_fragment_shader), 0, 1, 0, 0},
  {&__pyx_kp_u_creating_vertex_shader, __pyx_k_creating_vertex_shader, sizeof(__pyx_k_creating_vertex_shader), 0, 1, 0, 0},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  {&__pyx_kp_u_delete_status, __pyx_k_delete_status, sizeof(__pyx_k_delete_status), 0, 1, 0, 0},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_kp_u_error_no_fragment_shader, __pyx_k_error_no_fragment_shader, sizeof(__pyx_k_error_no_fragment_shader), 0, 1, 0, 0},
  {&__pyx_kp_u_error_no_vertex_shader, __pyx_k_error_no_vertex_shader, sizeof(__pyx_k_error_no_vertex_shader), 0, 1, 0, 0},
  {&__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_kp_u_from_package, __pyx_k_from_package, sizeof(__pyx_k_from_package), 0, 1, 0, 0},
  {&__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_create_hud_program, __pyx_k_gl_create_hud_program, sizeof(__pyx_k_gl_create_hud_program), 0, 0, 1, 1},
  {&__pyx_n_s_gl_create_pick_program, __pyx_k_gl_create_pick_program, sizeof(__pyx_k_gl_create_pick_program), 0, 0, 1, 1},
  {&__pyx_n_s_gl_create_render_program, __pyx_k_gl_create_render_program, sizeof(__pyx_k_gl_create_render_program), 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_render_select_debug, __pyx_k_gl_render_select_debug, sizeof(__pyx_k_gl_render_select_debug), 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_glarea, __pyx_k_glarea, sizeof(__pyx_k_glarea), 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_kp_s_tmp, __pyx_k_tmp, sizeof(__pyx_k_tmp), 0, 0, 1, 0},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_kp_u_info_log_length, __pyx_k_info_log_length, sizeof(__pyx_k_info_log_length), 0, 1, 0, 0},
  {&__pyx_n_s_init_module, __pyx_k_init_module, sizeof(__pyx_k_init_module), 0, 0, 1, 1},
  {&__pyx_kp_u_length_size_type_location, __pyx_k_length_size_type_location, sizeof(__pyx_k_length_size_type_location), 0, 1, 0, 0},
  {&__pyx_kp_u_link_status, __pyx_k_link_status, sizeof(__pyx_k_link_status), 0, 1, 0, 0},
  {&__pyx_n_s_location, __pyx_k_location, sizeof(__pyx_k_location), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_multisample, __pyx_k_multisample, sizeof(__pyx_k_multisample), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 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_package, __pyx_k_package, sizeof(__pyx_k_package), 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_background_color, __pyx_k_set_background_color, sizeof(__pyx_k_set_background_color), 0, 0, 1, 1},
  {&__pyx_n_s_set_frustum, __pyx_k_set_frustum, sizeof(__pyx_k_set_frustum), 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_kp_u_shader_program_info, __pyx_k_shader_program_info, sizeof(__pyx_k_shader_program_info), 0, 1, 0, 0},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_b_texcoord_attr, __pyx_k_texcoord_attr, sizeof(__pyx_k_texcoord_attr), 0, 0, 0, 1},
  {&__pyx_kp_u_validate_status, __pyx_k_validate_status, sizeof(__pyx_k_validate_status), 0, 1, 0, 0},
  {&__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_xi, __pyx_k_xi, sizeof(__pyx_k_xi), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_yi, __pyx_k_yi, sizeof(__pyx_k_yi), 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_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __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":245
 * def gl_init():
 *     if DEBUG_MSG:
 *         print('GL Strings:')             # <<<<<<<<<<<<<<
 *         _gl_print_string('  GL Vendor:', GL_VENDOR)
 *         _gl_print_string('  GL Renderer:', GL_RENDERER)
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_GL_Strings); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

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

  /* "_glarea.pyx":459
 *         #log = glGetShaderInfoLog(shader)
 *         print(log.decode('utf-8').rstrip())
 *         print('====')             # <<<<<<<<<<<<<<
 *     else:
 *         print('==== Error compiling shader (no log)')
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u__3); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

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

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

  /* "_glarea.pyx":475
 *         #log = glGetProgramInfoLog(program)
 *         print(log.decode('utf-8').rstrip())
 *         print('====')             # <<<<<<<<<<<<<<
 *     else:
 *         print('==== Error linking shader program (no log)')
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u__3); if (unlikely(!__pyx_tuple__7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

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

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

  /* "_glarea.pyx":525
 *         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_tuple__11 = PyTuple_Pack(1, __pyx_kp_u_active_attributes_2); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "_glarea.pyx":531
 *         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_tuple__12 = PyTuple_Pack(1, __pyx_kp_u_active_uniforms_2); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "_glarea.pyx":549
 *     program = glCreateProgram()
 *     if not DEBUG_NOVSHADER:
 *         debug('  creating vertex shader')             # <<<<<<<<<<<<<<
 *         vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *         if vertex_shader:
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_creating_vertex_shader); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "_glarea.pyx":554
 *             glAttachShader(program, vertex_shader)
 *         else:
 *             print('error: no vertex shader')             # <<<<<<<<<<<<<<
 *     if not DEBUG_NOFSHADER:
 *         debug('  creating fragment shader')
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_u_error_no_vertex_shader); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "_glarea.pyx":556
 *             print('error: no vertex shader')
 *     if not DEBUG_NOFSHADER:
 *         debug('  creating fragment shader')             # <<<<<<<<<<<<<<
 *         fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *         if fragment_shader:
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_u_creating_fragment_shader); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "_glarea.pyx":561
 *             glAttachShader(program, fragment_shader)
 *         else:
 *             print('error: no fragment shader')             # <<<<<<<<<<<<<<
 *     for index, name in enumerate(attributes):
 *         if name is not None:
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_u_error_no_fragment_shader); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "_glarea.pyx":50
 *     debug('  from package:', __package__)
 *     debug('  compiled:', __compiled)
 *     debug('  GL/GLES:', SOURCEGLVERSION)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__17 = PyTuple_Pack(2, __pyx_kp_u_GL_GLES, __pyx_n_u_GL); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "_glarea.pyx":103
 * ### module state
 * 
 * def init_module():             # <<<<<<<<<<<<<<
 *     terrain.red = 0.0
 *     terrain.green = 0.0
 */
  __pyx_codeobj__18 = (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_tmp, __pyx_n_s_init_module, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":192
 *     frustum.picking_matrix[1][1] = 1.
 * 
 * def set_frustum(bounding_sphere_radius, zoom):             # <<<<<<<<<<<<<<
 *     if bounding_sphere_radius > 0:
 *         frustum.bounding_sphere_radius = bounding_sphere_radius
 */
  __pyx_tuple__19 = PyTuple_Pack(2, __pyx_n_s_bounding_sphere_radius, __pyx_n_s_zoom); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_frustum, 192, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":199
 *     _update_projection_matrix()
 * 
 * def set_background_color(red, green, blue):             # <<<<<<<<<<<<<<
 *     terrain.red = red
 *     terrain.green = green
 */
  __pyx_tuple__21 = PyTuple_Pack(3, __pyx_n_s_red, __pyx_n_s_green, __pyx_n_s_blue); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);
  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_background_color, 199, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":204
 *     terrain.blue = blue
 * 
 * def set_antialiasing(multisample):             # <<<<<<<<<<<<<<
 *     frustum.multisample = multisample
 * 
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_multisample); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);
  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_antialiasing, 204, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":207
 *     frustum.multisample = multisample
 * 
 * def set_rotation_xy(x, y):             # <<<<<<<<<<<<<<
 *     x %= 360
 *     # pylint: disable=C0321
 */
  __pyx_tuple__25 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_y); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);
  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_rotation_xy, 207, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":243
 *     print(msg, i)
 * 
 * def gl_init():             # <<<<<<<<<<<<<<
 *     if DEBUG_MSG:
 *         print('GL Strings:')
 */
  __pyx_codeobj__27 = (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_tmp, __pyx_n_s_gl_init, 243, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":270
 *     gl_init_buffers()
 * 
 * def gl_exit():             # <<<<<<<<<<<<<<
 *     gl_delete_buffers()
 *     cdef GLuint prog #px+
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_prog); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);
  __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_gl_exit, 270, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":280
 *     program.prog_pick = 0
 * 
 * def gl_resize(width, height):             # <<<<<<<<<<<<<<
 *     terrain.width = width
 *     terrain.height = height
 */
  __pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_width, __pyx_n_s_height); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);
  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_gl_resize, 280, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":293
 *     #glUniformMatrix4fv(location, 1, GL_FALSE, matrix)
 * 
 * def gl_render():             # <<<<<<<<<<<<<<
 *     if DEBUG_PICK:
 *         _set_picking_matrix_identity()
 */
  __pyx_codeobj__32 = (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_tmp, __pyx_n_s_gl_render, 293, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":313
 *         gl_draw_cube_debug()
 * 
 * def gl_render_select_debug():             # <<<<<<<<<<<<<<
 *     cdef GLfloat selectdata[12] #px/
 *     #selectdata = [0.] * 12
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_selectdata); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);
  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_gl_render_select_debug, 313, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":429
 *     mvect[2] = v2 / u3
 * 
 * def get_cursor_angle(xi, yi, d):             # <<<<<<<<<<<<<<
 *     cdef float angle #px+
 *     cdef int i #px+
 */
  __pyx_tuple__35 = PyTuple_Pack(7, __pyx_n_s_xi, __pyx_n_s_yi, __pyx_n_s_d, __pyx_n_s_angle, __pyx_n_s_i, __pyx_n_s_x, __pyx_n_s_y); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);
  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_get_cursor_angle, 429, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":579
 *     return program
 * 
 * def gl_create_render_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #def gl_create_render_program(vertex_source, fragment_source):
 *     cdef GLint location #px+
 */
  __pyx_tuple__37 = PyTuple_Pack(4, __pyx_n_s_vertex_source, __pyx_n_s_fragment_source, __pyx_n_s_location, __pyx_n_s_attributes); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);
  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_gl_create_render_program, 579, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":601
 *         gl_init_object_location(location)
 * 
 * def gl_create_hud_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #def gl_create_hud_program(vertex_source, fragment_source):
 *     cdef GLint location #px+
 */
  __pyx_tuple__39 = PyTuple_Pack(4, __pyx_n_s_vertex_source, __pyx_n_s_fragment_source, __pyx_n_s_location, __pyx_n_s_attributes); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);
  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_gl_create_hud_program, 601, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":611
 *         glUseProgram(program.prog_hud)
 * 
 * def gl_create_pick_program(bytes vertex_source, bytes fragment_source): #px/             # <<<<<<<<<<<<<<
 * #def gl_create_pick_program(vertex_source, fragment_source):
 *     if program.prog_pick > 0:
 */
  __pyx_tuple__41 = PyTuple_Pack(3, __pyx_n_s_vertex_source, __pyx_n_s_fragment_source, __pyx_n_s_attributes); if (unlikely(!__pyx_tuple__41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);
  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_gl_create_pick_program, 611, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __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_float_180_0 = PyFloat_FromDouble(180.0); if (unlikely(!__pyx_float_180_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_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__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_360 = PyInt_FromLong(360); if (unlikely(!__pyx_int_360)) {__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;}
  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;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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("_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;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__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 (PyObject_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 PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main__glarea) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__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
  /*--- 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, "matrix_set_identity", (void (**)(void))&__pyx_f_7_gldraw_matrix_set_identity, "PyObject *(__pyx_t_7_gldraw_vec4 *)") < 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", (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":25
 * # This line makes cython happy
 * global __name__, __package__    # pylint: disable=W0604
 * __compiled = True #px/             # <<<<<<<<<<<<<<
 * #__compiled = False
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_compiled, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "_glarea.pyx":41
 * # pylint: enable=W0614,W0401
 * 
 * from .debug import debug, DEBUG, DEBUG_DRAW, DEBUG_PICK, DEBUG_MSG, DEBUG_NOVSHADER, DEBUG_NOFSHADER, DEBUG_NOSHADER             # <<<<<<<<<<<<<<
 * 
 * DEF SOURCEGLVERSION = 'GL' #px/
 */
  __pyx_t_2 = PyList_New(8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_debug);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_debug);
  __Pyx_GIVEREF(__pyx_n_s_debug);
  __Pyx_INCREF(__pyx_n_s_DEBUG);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_DEBUG);
  __Pyx_GIVEREF(__pyx_n_s_DEBUG);
  __Pyx_INCREF(__pyx_n_s_DEBUG_DRAW);
  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_DEBUG_DRAW);
  __Pyx_GIVEREF(__pyx_n_s_DEBUG_DRAW);
  __Pyx_INCREF(__pyx_n_s_DEBUG_PICK);
  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_DEBUG_PICK);
  __Pyx_GIVEREF(__pyx_n_s_DEBUG_PICK);
  __Pyx_INCREF(__pyx_n_s_DEBUG_MSG);
  PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_DEBUG_MSG);
  __Pyx_GIVEREF(__pyx_n_s_DEBUG_MSG);
  __Pyx_INCREF(__pyx_n_s_DEBUG_NOVSHADER);
  PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_DEBUG_NOVSHADER);
  __Pyx_GIVEREF(__pyx_n_s_DEBUG_NOVSHADER);
  __Pyx_INCREF(__pyx_n_s_DEBUG_NOFSHADER);
  PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_DEBUG_NOFSHADER);
  __Pyx_GIVEREF(__pyx_n_s_DEBUG_NOFSHADER);
  __Pyx_INCREF(__pyx_n_s_DEBUG_NOSHADER);
  PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_s_DEBUG_NOSHADER);
  __Pyx_GIVEREF(__pyx_n_s_DEBUG_NOSHADER);
  __pyx_t_3 = __Pyx_Import(__pyx_n_s_debug, __pyx_t_2, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_debug, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_DEBUG); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_DEBUG_DRAW); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG_DRAW, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_DEBUG_PICK); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG_PICK, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_DEBUG_MSG); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG_MSG, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_DEBUG_NOVSHADER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG_NOVSHADER, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_DEBUG_NOFSHADER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG_NOFSHADER, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_DEBUG_NOSHADER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEBUG_NOSHADER, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __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":46
 * #SOURCEGLVERSION = 'GL'
 * 
 * if DEBUG:             # <<<<<<<<<<<<<<
 *     debug('Importing module:', __name__)
 *     debug('  from package:', __package__)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEBUG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "_glarea.pyx":47
 * 
 * if DEBUG:
 *     debug('Importing module:', __name__)             # <<<<<<<<<<<<<<
 *     debug('  from package:', __package__)
 *     debug('  compiled:', __compiled)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_debug); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_name); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_7 = 1;
      }
    }
    __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_Importing_module);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_u_Importing_module);
    __Pyx_GIVEREF(__pyx_kp_u_Importing_module);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "_glarea.pyx":48
 * if DEBUG:
 *     debug('Importing module:', __name__)
 *     debug('  from package:', __package__)             # <<<<<<<<<<<<<<
 *     debug('  compiled:', __compiled)
 *     debug('  GL/GLES:', SOURCEGLVERSION)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__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);
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_package); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_7 = 1;
      }
    }
    __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_5) {
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_from_package);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_kp_u_from_package);
    __Pyx_GIVEREF(__pyx_kp_u_from_package);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); 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(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "_glarea.pyx":49
 *     debug('Importing module:', __name__)
 *     debug('  from package:', __package__)
 *     debug('  compiled:', __compiled)             # <<<<<<<<<<<<<<
 *     debug('  GL/GLES:', SOURCEGLVERSION)
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_debug); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_compiled); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_7 = 1;
      }
    }
    __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_8) {
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_u_compiled_2);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_kp_u_compiled_2);
    __Pyx_GIVEREF(__pyx_kp_u_compiled_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "_glarea.pyx":50
 *     debug('  from package:', __package__)
 *     debug('  compiled:', __compiled)
 *     debug('  GL/GLES:', SOURCEGLVERSION)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __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;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "_glarea.pyx":103
 * ### 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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_module, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":192
 *     frustum.picking_matrix[1][1] = 1.
 * 
 * def set_frustum(bounding_sphere_radius, zoom):             # <<<<<<<<<<<<<<
 *     if bounding_sphere_radius > 0:
 *         frustum.bounding_sphere_radius = bounding_sphere_radius
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7_glarea_3set_frustum, NULL, __pyx_n_s_glarea); 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);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_frustum, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":199
 *     _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 = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_background_color, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":204
 *     terrain.blue = blue
 * 
 * def set_antialiasing(multisample):             # <<<<<<<<<<<<<<
 *     frustum.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 = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_antialiasing, __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":207
 *     frustum.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 = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_rotation_xy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":243
 *     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 = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gl_init, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":270
 *     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 = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gl_exit, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":280
 *     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 = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gl_resize, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":293
 *     #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 = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gl_render, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":313
 *         gl_draw_cube_debug()
 * 
 * def gl_render_select_debug():             # <<<<<<<<<<<<<<
 *     cdef GLfloat selectdata[12] #px/
 *     #selectdata = [0.] * 12
 */
  __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 = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gl_render_select_debug, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":429
 *     mvect[2] = v2 / u3
 * 
 * def get_cursor_angle(xi, yi, d):             # <<<<<<<<<<<<<<
 *     cdef float angle #px+
 *     cdef int i #px+
 */
  __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 = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_cursor_angle, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":579
 *     return program
 * 
 * def gl_create_render_program(bytes vertex_source, bytes fragment_source): #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 = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gl_create_render_program, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":601
 *         gl_init_object_location(location)
 * 
 * def gl_create_hud_program(bytes vertex_source, bytes fragment_source): #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 = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gl_create_hud_program, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea.pyx":611
 *         glUseProgram(program.prog_hud)
 * 
 * def gl_create_pick_program(bytes vertex_source, bytes fragment_source): #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 = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gl_create_pick_program, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __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
 * 
 */
  __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(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /*--- Wrapped vars code ---*/

  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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  if (__pyx_m) {
    if (__pyx_d) {
      __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

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

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,
                                  int full_traceback) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #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 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,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" 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,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

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;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (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 = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || 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)) {
    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);
    }
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject* args = PyTuple_Pack(1, arg);
    return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

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%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
}
static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (likely(Py_TYPE(obj) == type)) return 1;
        #if PY_MAJOR_VERSION == 2
        else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(PyObject_TypeCheck(obj, type))) return 1;
    }
    __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
    return 0;
}

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

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, (size_t)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,
        0,
        0,
        0,
        0,
        __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,
        __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;
    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_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    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_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                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);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            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
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)       \
    {                                                                     \
        func_type value = func_value;                                     \
        if (sizeof(target_type) < sizeof(func_type)) {                    \
            if (unlikely(value != (func_type) (target_type) value)) {     \
                func_type zero = 0;                                       \
                if (is_unsigned && unlikely(value < zero))                \
                    goto raise_neg_overflow;                              \
                else                                                      \
                    goto raise_overflow;                                  \
            }                                                             \
        }                                                                 \
        return (target_type) value;                                       \
    }

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
            } else if (sizeof(int) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(int) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) {
    const unsigned char neg_one = (unsigned char) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned char) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(unsigned char) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(unsigned char) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned char) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned char),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
    const unsigned int neg_one = (unsigned int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(unsigned int) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(unsigned int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
    const unsigned int neg_one = (unsigned int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(unsigned int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(unsigned int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(unsigned int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, long, PyLong_AsLong(x))
            } else if (sizeof(unsigned int) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(unsigned int, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            unsigned int val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (unsigned int) -1;
        }
    } else {
        unsigned int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned int) -1;
        val = __Pyx_PyInt_As_unsigned_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned int");
    return (unsigned int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned int");
    return (unsigned int) -1;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(long) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(long) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
            } else if (sizeof(long) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

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);
        return PyErr_WarnEx(NULL, message, 1);
    }
    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,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             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 %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             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_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
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_LENGTH(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else
        return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
    } else
#endif
#if !CYTHON_COMPILING_IN_PYPY
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
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_MAJOR_VERSION < 3
  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_MAJOR_VERSION < 3
  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_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (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;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b)))
      return PyInt_AS_LONG(b);
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
     #if CYTHON_USE_PYLONG_INTERNALS
       switch (Py_SIZE(b)) {
       case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
       case  0: return 0;
       case  1: return ((PyLongObject*)b)->ob_digit[0];
       }
     #endif
    #endif
    return PyLong_AsSsize_t(b);
  }
  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) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
