/* Generated by Cython 0.25.2 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_25_2"
#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 HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
    #define HAVE_LONG_LONG
  #endif
#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_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #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
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_FASTCALL
  #define METH_FASTCALL 0x80
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
                                              Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 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_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #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)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #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_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #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]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#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)
#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))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#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 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#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)
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#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
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#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
#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
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif 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

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

#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

#define __PYX_HAVE___glarea_es2
#define __PYX_HAVE_API___glarea_es2
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stddef.h>
#include <stdint.h>
#include "GLES2/gl2.h"
#include <stdio.h>
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const 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_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#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)))  )
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER) && defined (_M_X64)
    #define __Pyx_sst_abs(value) _abs64(value)
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
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_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(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_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(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_ASSUME_SAFE_MACROS
#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
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(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*) "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 PyObject *__pyx_empty_unicode;
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[] = {
  "build/temp.linux-x86_64-3.5/pybiklib/ext/_glarea_es2.pyx",
};

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

/* "_gldraw_es2.pxd":4
 * 
 * from gl_es2 cimport *    #line 34
 * cdef enum: #    #line 67             # <<<<<<<<<<<<<<
 *     MAX_TRANSFORMATIONS = 60    #line 71
 *     MAX_BLOCKS = 1312    #line 72
 */
enum  {
  __pyx_e_11_gldraw_es2_MAX_TRANSFORMATIONS = 60,
  __pyx_e_11_gldraw_es2_MAX_BLOCKS = 0x520,
  __pyx_e_11_gldraw_es2_MAX_FACES = 20,
  __pyx_e_11_gldraw_es2_ATTRIB_LOCATION = 0,
  __pyx_e_11_gldraw_es2_PICKATTRIB_LOCATION = 5,
  __pyx_e_11_gldraw_es2_ATTRIB_CNT = 7
};

/* "_gldraw_es2.pxd":11
 *     PICKATTRIB_LOCATION = 5    #line 75
 *     ATTRIB_CNT = 7    #line 76
 * ctypedef float vec4[4]    #line 79             # <<<<<<<<<<<<<<
 * ctypedef vec4 mat4[4]    #line 80
 * cdef void matrix_set_identity(mat4 &matrix) nogil    #line 87
 */
typedef float __pyx_t_11_gldraw_es2_vec4[4];

/* "_gldraw_es2.pxd":12
 *     ATTRIB_CNT = 7    #line 76
 * ctypedef float vec4[4]    #line 79
 * ctypedef vec4 mat4[4]    #line 80             # <<<<<<<<<<<<<<
 * cdef void matrix_set_identity(mat4 &matrix) nogil    #line 87
 * cdef void init_gldraw()    #line 137
 */
typedef __pyx_t_11_gldraw_es2_vec4 __pyx_t_11_gldraw_es2_mat4[4];
struct __pyx_t_11_glarea_es2_AtlasData;
struct __pyx_t_11_glarea_es2_RenderData;
struct __pyx_t_11_glarea_es2_UIData;

/* "_glarea_es2.pyx":55
 * #puts = print
 * 
 * cdef enum: # #px/             # <<<<<<<<<<<<<<
 * #if True:
 *     DEBUG_MSGGL = 0x02
 */
enum  {
  __pyx_e_11_glarea_es2_DEBUG_MSGGL = 0x02,
  __pyx_e_11_glarea_es2_DEBUG_MSGEXT = 0x08,
  __pyx_e_11_glarea_es2_DEBUG_DRAW = 0x10,
  __pyx_e_11_glarea_es2_DEBUG_PICK = 0x20
};

/* "_glarea_es2.pyx":72
 * 
 * 
 * cdef struct AtlasData: #px/             # <<<<<<<<<<<<<<
 * #class AtlasData: pass
 *     int x, w, h #px+
 */
struct __pyx_t_11_glarea_es2_AtlasData {
  int x;
  int w;
  int h;
  char *data;
};

/* "_glarea_es2.pyx":77
 *     char *data #px+
 * 
 * cdef struct RenderData: #px/             # <<<<<<<<<<<<<<
 * #class renderdata:
 *     float bg_red #px+
 */
struct __pyx_t_11_glarea_es2_RenderData {
  float bg_red;
  float bg_green;
  float bg_blue;
  int y;
  int width;
  int height;
  int pick_x;
  int pick_y;
  int multisample;
  __pyx_t_11_gldraw_es2_mat4 modelview_matrix;
  __pyx_t_11_gldraw_es2_mat4 projection_matrix;
  __pyx_t_11_gldraw_es2_mat4 picking_matrix;
  GLuint prog_render;
  GLuint projection_location;
  GLuint modelview_location;
  GLuint prog_hud;
  GLuint prog_pick;
  GLuint picking_location;
  GLuint projection_pick_location;
  GLuint modelview_pick_location;
  int shader_changed;
  char *shader_vertsrc;
  char *shader_fragsrc;
  char *hud_vertsrc;
  char *hud_fragsrc;
  char *pick_vertsrc;
  char *pick_fragsrc;
  struct __pyx_t_11_glarea_es2_AtlasData atlasdata[__pyx_e_11_gldraw_es2_MAX_FACES];
  int atlaslen;
  float debug_modelview1[3];
  float debug_modelview2[3];
  int debug_viewport1[2];
  int debug_viewport2[2];
};

/* "_glarea_es2.pyx":128
 * 
 * 
 * cdef struct UIData: #px/             # <<<<<<<<<<<<<<
 * #class uidata:
 *     bint synced #px+
 */
struct __pyx_t_11_glarea_es2_UIData {
  int synced;
  int background_changed;
  float bg_red;
  float bg_green;
  float bg_blue;
  int viewport_changed;
  int rotation_changed;
  float rotationxhalf;
  float rotationyhalf;
  int rotation_quat_changed;
  __pyx_t_11_gldraw_es2_vec4 rotation_quat;
  int pick_x;
  int pick_y;
  int frustum_changed;
  float fovy_radius;
  float fovy_radius_zoom;
  double bounding_sphere_radius;
  int multisample_changed;
  char *hud_vertsrc;
  char *hud_fragsrc;
  char *pick_vertsrc;
  char *pick_fragsrc;
  int shaders_changed;
  char *shader_vertsrc;
  char *shader_fragsrc;
  struct __pyx_t_11_glarea_es2_AtlasData atlasdata[__pyx_e_11_gldraw_es2_MAX_FACES];
  int atlaslen;
  int data_changed;
  int vertexdatalen;
  char *vertexdata;
  long vertexpointers[(__pyx_e_11_gldraw_es2_ATTRIB_CNT - 1)];
  int nblocks;
  short cnts_block[__pyx_e_11_gldraw_es2_MAX_BLOCKS];
  int idx_debug;
  int cnt_debug;
  int cnt_pick;
  int transformations_count;
  __pyx_t_11_gldraw_es2_mat4 transformations[__pyx_e_11_gldraw_es2_MAX_TRANSFORMATIONS];
  int transformation_changed;
  short transformation_blocks[__pyx_e_11_gldraw_es2_MAX_BLOCKS];
  int animation_changed;
  int animation_blocks_count;
  short animation_blocks[__pyx_e_11_gldraw_es2_MAX_BLOCKS];
  float angle;
  float rotation_x;
  float rotation_y;
  float rotation_z;
};

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#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)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
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

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = PyThreadState_GET();
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

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

/* GetModuleGlobalName.proto */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

/* PyObjectCall.proto */
#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

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_RemainderObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceRemainder(op1, op2) : PyNumber_Remainder(op1, op2))
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace);
#else
#define __Pyx_PyFloat_TrueDivideObjC(op1, op2, floatval, inplace)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

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

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

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyObjectCallNoArg.proto */
#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

/* GetItemInt.proto */
#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);

/* pyobject_as_double.proto */
static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj)\
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
 likely(PyInt_CheckExact(obj)) ?\
 PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
#else
#define __Pyx_PyObject_AsDouble(obj)\
((likely(PyFloat_CheckExact(obj))) ?\
 PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
#endif

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

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

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __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);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_GLint(GLint value);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

/* PyIdentifierFromString.proto */
#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

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

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

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


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

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

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

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

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

/* Module declarations from 'gl_es2' */

/* Module declarations from '_gldraw_es2' */
static void (*__pyx_f_11_gldraw_es2_matrix_set_identity)(__pyx_t_11_gldraw_es2_vec4 *); /*proto*/
static void (*__pyx_f_11_gldraw_es2_init_gldraw)(void); /*proto*/
static void (*__pyx_f_11_gldraw_es2_sync_block_transformations)(short *); /*proto*/
static void (*__pyx_f_11_gldraw_es2_sync_animation_start)(int, short *); /*proto*/
static void (*__pyx_f_11_gldraw_es2_sync_animation_next)(float, float, float, float); /*proto*/
static void (*__pyx_f_11_gldraw_es2_gl_draw_cube)(void); /*proto*/
static void (*__pyx_f_11_gldraw_es2_gl_pick_cube)(void); /*proto*/
static void (*__pyx_f_11_gldraw_es2_gl_init_buffers)(void); /*proto*/
static void (*__pyx_f_11_gldraw_es2_gl_delete_buffers)(void); /*proto*/
static void (*__pyx_f_11_gldraw_es2_sync_blocks)(int, short *, int, int, int); /*proto*/
static void (*__pyx_f_11_gldraw_es2_sync_vertexdata)(int, char *, long *); /*proto*/
static void (*__pyx_f_11_gldraw_es2_sync_transformations)(int, __pyx_t_11_gldraw_es2_mat4 *); /*proto*/
static void (*__pyx_f_11_gldraw_es2_gl_enable_data)(void); /*proto*/
static void (*__pyx_f_11_gldraw_es2_gl_disable_data)(void); /*proto*/
static void (*__pyx_f_11_gldraw_es2_gl_draw_cube_debug)(void); /*proto*/
static void (*__pyx_f_11_gldraw_es2_gl_draw_select_debug)(GLfloat *, GLsizeiptr, GLuint); /*proto*/
static void (*__pyx_f_11_gldraw_es2_gl_init_object_location)(GLuint); /*proto*/

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

/* Module declarations from '_glarea_es2' */
static long __pyx_v_11_glarea_es2_debug;
static struct __pyx_t_11_glarea_es2_RenderData __pyx_v_11_glarea_es2_renderdata;
static struct __pyx_t_11_glarea_es2_UIData __pyx_v_11_glarea_es2_uidata;
static void __pyx_f_11_glarea_es2_gl_create_render_program(void); /*proto*/
static void __pyx_f_11_glarea_es2_quat_set_identity(float *); /*proto*/
static void __pyx_f_11_glarea_es2_quat_mult(float *, float *, float *); /*proto*/
static void __pyx_f_11_glarea_es2_quat_to_matrix(__pyx_t_11_gldraw_es2_vec4 *, float *); /*proto*/
static void __pyx_f_11_glarea_es2_quat_from_angle_axis(float *, float, float, float, float); /*proto*/
static void __pyx_f_11_glarea_es2__sync_modelview_matrix_translation(void); /*proto*/
static void __pyx_f_11_glarea_es2__sync_modelview_matrix_rotation(void); /*proto*/
static void __pyx_f_11_glarea_es2__sync_projection_matrix(void); /*proto*/
static void __pyx_f_11_glarea_es2__set_picking_matrix(int, int); /*proto*/
static void __pyx_f_11_glarea_es2__set_picking_matrix_identity(void); /*proto*/
static PyObject *__pyx_f_11_glarea_es2_set_animation_start(PyObject *, float, float, float, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_11_glarea_es2_set_atlas_data(int, PyObject *, int, int, int, int __pyx_skip_dispatch); /*proto*/
static void __pyx_f_11_glarea_es2__gl_print_string(char *, GLenum); /*proto*/
static void __pyx_f_11_glarea_es2__gl_print_float(char *, GLenum); /*proto*/
static void __pyx_f_11_glarea_es2__gl_print_integer(char *, GLenum); /*proto*/
static void __pyx_f_11_glarea_es2__gl_print_bool(char *, GLenum); /*proto*/
static void __pyx_f_11_glarea_es2__gl_set_matrix(GLint, __pyx_t_11_gldraw_es2_vec4 *); /*proto*/
static void __pyx_f_11_glarea_es2__gl_render_pick(void); /*proto*/
static void __pyx_f_11_glarea_es2__modelview_to_viewport(float *, int *); /*proto*/
static void __pyx_f_11_glarea_es2__viewport_to_modelview(int *, float *); /*proto*/
static void __pyx_f_11_glarea_es2__gl_print_shader_log(GLuint); /*proto*/
static void __pyx_f_11_glarea_es2__gl_print_program_log(GLuint); /*proto*/
static GLuint __pyx_f_11_glarea_es2__gl_create_compiled_shader(GLenum, char *); /*proto*/
static GLint __pyx_f_11_glarea_es2__get_program_iv(GLuint, GLenum); /*proto*/
static GLint __pyx_f_11_glarea_es2__gl_print_program_info(GLuint); /*proto*/
static void __pyx_f_11_glarea_es2__gl_program_add_shaders(GLuint, char *, char *); /*proto*/
static void __pyx_f_11_glarea_es2_gl_create_hud_program(void); /*proto*/
static void __pyx_f_11_glarea_es2_gl_create_pick_program(void); /*proto*/
#define __Pyx_MODULE_NAME "_glarea_es2"
int __pyx_module_is_main__glarea_es2 = 0;

/* Implementation of '_glarea_es2' */
static PyObject *__pyx_builtin_print;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_range;
static const char __pyx_k_b[] = "b";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_h[] = "h";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_j[] = "j";
static const char __pyx_k_t[] = "t";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
static const char __pyx_k__4[] = "\n";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_nxy[] = "nxy";
static const char __pyx_k_red[] = "red";
static const char __pyx_k_blue[] = "blue";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_quat[] = "quat";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_zoom[] = "zoom";
static const char __pyx_k_angle[] = "angle";
static const char __pyx_k_axisx[] = "axisx";
static const char __pyx_k_axisy[] = "axisy";
static const char __pyx_k_axisz[] = "axisz";
static const char __pyx_k_green[] = "green";
static const char __pyx_k_print[] = "print";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_blocks[] = "blocks";
static const char __pyx_k_module[] = "module";
static const char __pyx_k_pydata[] = "pydata";
static const char __pyx_k_unused[] = "unused";
static const char __pyx_k_nblocks[] = "nblocks";
static const char __pyx_k_package[] = "__package__";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_compiled[] = "  compiled:";
static const char __pyx_k_module_2[] = "__module__";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_set_data[] = "set_data";
static const char __pyx_k_uipydata[] = "uipydata";
static const char __pyx_k_OFFSCREEN[] = "  OFFSCREEN:";
static const char __pyx_k_atlasdata[] = "atlasdata";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_DEBUG_DRAW[] = "DEBUG_DRAW";
static const char __pyx_k_DEBUG_PICK[] = "DEBUG_PICK";
static const char __pyx_k_cnts_block[] = "cnts_block";
static const char __pyx_k_compiled_2[] = "__compiled";
static const char __pyx_k_fovy_angle[] = "fovy_angle";
static const char __pyx_k_glarea_es2[] = "_glarea_es2";
static const char __pyx_k_shader_src[] = "shader_src";
static const char __pyx_k_startswith[] = "startswith";
static const char __pyx_k_syncpydata[] = "syncpydata";
static const char __pyx_k_vertexdata[] = "vertexdata";
static const char __pyx_k_vertexinfo[] = "vertexinfo";
static const char __pyx_k_DEBUG_MSGGL[] = "DEBUG_MSGGL";
static const char __pyx_k_GL_type_es2[] = "  GL-type: es2";
static const char __pyx_k_init_engine[] = "init_engine";
static const char __pyx_k_init_module[] = "init module:";
static const char __pyx_k_multisample[] = "multisample";
static const char __pyx_k_set_frustum[] = "set_frustum";
static const char __pyx_k_set_shaders[] = "set_shaders";
static const char __pyx_k_version_100[] = "#version 100\n";
static const char __pyx_k_version_120[] = "#version 120\n";
static const char __pyx_k_DEBUG_MSGEXT[] = "DEBUG_MSGEXT";
static const char __pyx_k_fixedshaders[] = "fixedshaders";
static const char __pyx_k_from_package[] = "  from package:";
static const char __pyx_k_pydata_backed[] = "pydata_backed";
static const char __pyx_k_shader_fragsrc[] = "shader_fragsrc";
static const char __pyx_k_shader_vertsrc[] = "shader_vertsrc";
static const char __pyx_k_vertexpointers[] = "vertexpointers";
static const char __pyx_k_pydata_postsync[] = "pydata_postsync";
static const char __pyx_k_set_debug_flags[] = "set_debug_flags";
static const char __pyx_k_set_rotation_xy[] = "set_rotation_xy";
static const char __pyx_k_transformations[] = "transformations";
static const char __pyx_k_get_cursor_angle[] = "get_cursor_angle";
static const char __pyx_k_set_antialiasing[] = "set_antialiasing";
static const char __pyx_k_set_fixedshaders[] = "set_fixedshaders";
static const char __pyx_k_set_rotation_rel[] = "set_rotation_rel";
static const char __pyx_k_set_pick_position[] = "set_pick_position";
static const char __pyx_k_set_transformations[] = "set_transformations";
static const char __pyx_k_set_background_color[] = "set_background_color";
static const char __pyx_k_update_shader_version[] = "update_shader_version";
static const char __pyx_k_bounding_sphere_radius[] = "bounding_sphere_radius";
static const char __pyx_k_tmp[] = "/tmp/build/temp.linux-x86_64-3.5/pybiklib/ext/_glarea_es2.pyx";
static PyObject *__pyx_n_s_DEBUG_DRAW;
static PyObject *__pyx_n_s_DEBUG_MSGEXT;
static PyObject *__pyx_n_s_DEBUG_MSGGL;
static PyObject *__pyx_n_s_DEBUG_PICK;
static PyObject *__pyx_kp_u_GL_type_es2;
static PyObject *__pyx_kp_u_OFFSCREEN;
static PyObject *__pyx_kp_b__4;
static PyObject *__pyx_n_s_angle;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_atlasdata;
static PyObject *__pyx_n_s_axisx;
static PyObject *__pyx_n_s_axisy;
static PyObject *__pyx_n_s_axisz;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_blocks;
static PyObject *__pyx_n_s_blue;
static PyObject *__pyx_n_s_bounding_sphere_radius;
static PyObject *__pyx_n_s_cnts_block;
static PyObject *__pyx_kp_u_compiled;
static PyObject *__pyx_n_s_compiled_2;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_fixedshaders;
static PyObject *__pyx_n_u_fixedshaders;
static PyObject *__pyx_n_s_fovy_angle;
static PyObject *__pyx_kp_u_from_package;
static PyObject *__pyx_n_s_get_cursor_angle;
static PyObject *__pyx_n_s_glarea_es2;
static PyObject *__pyx_n_s_green;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_kp_s_tmp;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_init_engine;
static PyObject *__pyx_kp_u_init_module;
static PyObject *__pyx_n_s_j;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_module_2;
static PyObject *__pyx_n_s_multisample;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_nblocks;
static PyObject *__pyx_n_s_nxy;
static PyObject *__pyx_n_s_package;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_print;
static PyObject *__pyx_n_s_pydata;
static PyObject *__pyx_n_s_pydata_backed;
static PyObject *__pyx_n_s_pydata_postsync;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_quat;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_red;
static PyObject *__pyx_n_s_set_antialiasing;
static PyObject *__pyx_n_s_set_background_color;
static PyObject *__pyx_n_s_set_data;
static PyObject *__pyx_n_s_set_debug_flags;
static PyObject *__pyx_n_s_set_fixedshaders;
static PyObject *__pyx_n_s_set_frustum;
static PyObject *__pyx_n_s_set_pick_position;
static PyObject *__pyx_n_s_set_rotation_rel;
static PyObject *__pyx_n_s_set_rotation_xy;
static PyObject *__pyx_n_s_set_shaders;
static PyObject *__pyx_n_s_set_transformations;
static PyObject *__pyx_n_s_shader_fragsrc;
static PyObject *__pyx_n_u_shader_fragsrc;
static PyObject *__pyx_n_s_shader_src;
static PyObject *__pyx_n_s_shader_vertsrc;
static PyObject *__pyx_n_u_shader_vertsrc;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_startswith;
static PyObject *__pyx_n_s_syncpydata;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_transformations;
static PyObject *__pyx_n_s_uipydata;
static PyObject *__pyx_n_s_unused;
static PyObject *__pyx_n_s_update_shader_version;
static PyObject *__pyx_kp_b_version_100;
static PyObject *__pyx_kp_b_version_120;
static PyObject *__pyx_n_s_vertexdata;
static PyObject *__pyx_n_u_vertexdata;
static PyObject *__pyx_n_s_vertexinfo;
static PyObject *__pyx_n_s_vertexpointers;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_zoom;
static PyObject *__pyx_pf_11_glarea_es2_set_debug_flags(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_module); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_2init_engine(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_4set_rotation_rel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_6set_frustum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_bounding_sphere_radius, PyObject *__pyx_v_zoom); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_8set_background_color(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_red, PyObject *__pyx_v_green, PyObject *__pyx_v_blue); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_10set_antialiasing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_multisample); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_12set_rotation_xy(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_14set_transformations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_blocks); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_16set_animation_start(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_blocks, float __pyx_v_axisx, float __pyx_v_axisy, float __pyx_v_axisz); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_18set_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nblocks, PyObject *__pyx_v_vertexdata, PyObject *__pyx_v_vertexpointers, PyObject *__pyx_v_vertexinfo, PyObject *__pyx_v_transformations); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_20pydata_postsync(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_22update_shader_version(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_shader_src); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_24set_shaders(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_shader_vertsrc, PyObject *__pyx_v_shader_fragsrc); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_26set_fixedshaders(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fixedshaders); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_28set_pick_position(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_30set_atlas_data(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_i, PyObject *__pyx_v_data, int __pyx_v_x, int __pyx_v_w, int __pyx_v_h); /* proto */
static PyObject *__pyx_pf_11_glarea_es2_32get_cursor_angle(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_float_360_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_120;
static PyObject *__pyx_int_360;
static PyObject *__pyx_int_neg_120;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_codeobj__7;
static PyObject *__pyx_codeobj__9;
static PyObject *__pyx_codeobj__11;
static PyObject *__pyx_codeobj__13;
static PyObject *__pyx_codeobj__15;
static PyObject *__pyx_codeobj__17;
static PyObject *__pyx_codeobj__19;
static PyObject *__pyx_codeobj__21;
static PyObject *__pyx_codeobj__23;
static PyObject *__pyx_codeobj__24;
static PyObject *__pyx_codeobj__26;
static PyObject *__pyx_codeobj__28;
static PyObject *__pyx_codeobj__30;
static PyObject *__pyx_codeobj__32;
static PyObject *__pyx_codeobj__34;

/* "_glarea_es2.pyx":64
 * debug = 0
 * 
 * def set_debug_flags(module):             # <<<<<<<<<<<<<<
 *     global debug
 *     if module.DEBUG_MSGGL: debug |= DEBUG_MSGGL
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_1set_debug_flags(PyObject *__pyx_self, PyObject *__pyx_v_module); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_1set_debug_flags = {"set_debug_flags", (PyCFunction)__pyx_pw_11_glarea_es2_1set_debug_flags, METH_O, 0};
static PyObject *__pyx_pw_11_glarea_es2_1set_debug_flags(PyObject *__pyx_self, PyObject *__pyx_v_module) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_debug_flags (wrapper)", 0);
  __pyx_r = __pyx_pf_11_glarea_es2_set_debug_flags(__pyx_self, ((PyObject *)__pyx_v_module));

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

static PyObject *__pyx_pf_11_glarea_es2_set_debug_flags(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_module) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("set_debug_flags", 0);

  /* "_glarea_es2.pyx":66
 * def set_debug_flags(module):
 *     global debug
 *     if module.DEBUG_MSGGL: debug |= DEBUG_MSGGL             # <<<<<<<<<<<<<<
 *     if module.DEBUG_MSGEXT: debug |= DEBUG_MSGEXT
 *     if module.DEBUG_DRAW: debug |= DEBUG_DRAW
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_module, __pyx_n_s_DEBUG_MSGGL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
    __pyx_v_11_glarea_es2_debug = (__pyx_v_11_glarea_es2_debug | __pyx_e_11_glarea_es2_DEBUG_MSGGL);
  }

  /* "_glarea_es2.pyx":67
 *     global debug
 *     if module.DEBUG_MSGGL: debug |= DEBUG_MSGGL
 *     if module.DEBUG_MSGEXT: debug |= DEBUG_MSGEXT             # <<<<<<<<<<<<<<
 *     if module.DEBUG_DRAW: debug |= DEBUG_DRAW
 *     if module.DEBUG_PICK: debug |= DEBUG_PICK
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_module, __pyx_n_s_DEBUG_MSGEXT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
    __pyx_v_11_glarea_es2_debug = (__pyx_v_11_glarea_es2_debug | __pyx_e_11_glarea_es2_DEBUG_MSGEXT);
  }

  /* "_glarea_es2.pyx":68
 *     if module.DEBUG_MSGGL: debug |= DEBUG_MSGGL
 *     if module.DEBUG_MSGEXT: debug |= DEBUG_MSGEXT
 *     if module.DEBUG_DRAW: debug |= DEBUG_DRAW             # <<<<<<<<<<<<<<
 *     if module.DEBUG_PICK: debug |= DEBUG_PICK
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_module, __pyx_n_s_DEBUG_DRAW); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 68, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
    __pyx_v_11_glarea_es2_debug = (__pyx_v_11_glarea_es2_debug | __pyx_e_11_glarea_es2_DEBUG_DRAW);
  }

  /* "_glarea_es2.pyx":69
 *     if module.DEBUG_MSGEXT: debug |= DEBUG_MSGEXT
 *     if module.DEBUG_DRAW: debug |= DEBUG_DRAW
 *     if module.DEBUG_PICK: debug |= DEBUG_PICK             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_module, __pyx_n_s_DEBUG_PICK); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 69, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
    __pyx_v_11_glarea_es2_debug = (__pyx_v_11_glarea_es2_debug | __pyx_e_11_glarea_es2_DEBUG_PICK);
  }

  /* "_glarea_es2.pyx":64
 * debug = 0
 * 
 * def set_debug_flags(module):             # <<<<<<<<<<<<<<
 *     global debug
 *     if module.DEBUG_MSGGL: debug |= DEBUG_MSGGL
 */

  /* 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_es2.set_debug_flags", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":203
 * 
 * ##pxm-FUNC P nogil
 * cdef void quat_set_identity(gldraw.vec4 &quat) nogil:             # <<<<<<<<<<<<<<
 *     quat[0] = 1.
 *     quat[1] = quat[2] = quat[3] = 0.
 */

static void __pyx_f_11_glarea_es2_quat_set_identity(float *__pyx_v_quat) {

  /* "_glarea_es2.pyx":204
 * ##pxm-FUNC P nogil
 * cdef void quat_set_identity(gldraw.vec4 &quat) nogil:
 *     quat[0] = 1.             # <<<<<<<<<<<<<<
 *     quat[1] = quat[2] = quat[3] = 0.
 * 
 */
  (__pyx_v_quat[0]) = 1.;

  /* "_glarea_es2.pyx":205
 * cdef void quat_set_identity(gldraw.vec4 &quat) nogil:
 *     quat[0] = 1.
 *     quat[1] = quat[2] = quat[3] = 0.             # <<<<<<<<<<<<<<
 * 
 * # (a+bi+cj+dk)(w+xi+yj+zk)
 */
  (__pyx_v_quat[1]) = 0.;
  (__pyx_v_quat[2]) = 0.;
  (__pyx_v_quat[3]) = 0.;

  /* "_glarea_es2.pyx":203
 * 
 * ##pxm-FUNC P nogil
 * cdef void quat_set_identity(gldraw.vec4 &quat) nogil:             # <<<<<<<<<<<<<<
 *     quat[0] = 1.
 *     quat[1] = quat[2] = quat[3] = 0.
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":212
 * 
 * ##pxm-FUNC P nogil
 * cdef void quat_mult(gldraw.vec4 &dest, gldraw.vec4 &src1, gldraw.vec4 &src2) nogil:             # <<<<<<<<<<<<<<
 *     cdef float a,b,c,d #px+
 *     a = src1[0]*src2[0] - src1[1]*src2[1] - src1[2]*src2[2] - src1[3]*src2[3]
 */

static void __pyx_f_11_glarea_es2_quat_mult(float *__pyx_v_dest, float *__pyx_v_src1, float *__pyx_v_src2) {
  float __pyx_v_a;
  float __pyx_v_b;
  float __pyx_v_c;
  float __pyx_v_d;

  /* "_glarea_es2.pyx":214
 * cdef void quat_mult(gldraw.vec4 &dest, gldraw.vec4 &src1, gldraw.vec4 &src2) nogil:
 *     cdef float a,b,c,d #px+
 *     a = src1[0]*src2[0] - src1[1]*src2[1] - src1[2]*src2[2] - src1[3]*src2[3]             # <<<<<<<<<<<<<<
 *     b = src1[0]*src2[1] + src1[1]*src2[0] + src1[2]*src2[3] - src1[3]*src2[2]
 *     c = src1[0]*src2[2] - src1[1]*src2[3] + src1[2]*src2[0] + src1[3]*src2[1]
 */
  __pyx_v_a = (((((__pyx_v_src1[0]) * (__pyx_v_src2[0])) - ((__pyx_v_src1[1]) * (__pyx_v_src2[1]))) - ((__pyx_v_src1[2]) * (__pyx_v_src2[2]))) - ((__pyx_v_src1[3]) * (__pyx_v_src2[3])));

  /* "_glarea_es2.pyx":215
 *     cdef float a,b,c,d #px+
 *     a = src1[0]*src2[0] - src1[1]*src2[1] - src1[2]*src2[2] - src1[3]*src2[3]
 *     b = src1[0]*src2[1] + src1[1]*src2[0] + src1[2]*src2[3] - src1[3]*src2[2]             # <<<<<<<<<<<<<<
 *     c = src1[0]*src2[2] - src1[1]*src2[3] + src1[2]*src2[0] + src1[3]*src2[1]
 *     d = src1[0]*src2[3] + src1[1]*src2[2] - src1[2]*src2[1] + src1[3]*src2[0]
 */
  __pyx_v_b = (((((__pyx_v_src1[0]) * (__pyx_v_src2[1])) + ((__pyx_v_src1[1]) * (__pyx_v_src2[0]))) + ((__pyx_v_src1[2]) * (__pyx_v_src2[3]))) - ((__pyx_v_src1[3]) * (__pyx_v_src2[2])));

  /* "_glarea_es2.pyx":216
 *     a = src1[0]*src2[0] - src1[1]*src2[1] - src1[2]*src2[2] - src1[3]*src2[3]
 *     b = src1[0]*src2[1] + src1[1]*src2[0] + src1[2]*src2[3] - src1[3]*src2[2]
 *     c = src1[0]*src2[2] - src1[1]*src2[3] + src1[2]*src2[0] + src1[3]*src2[1]             # <<<<<<<<<<<<<<
 *     d = src1[0]*src2[3] + src1[1]*src2[2] - src1[2]*src2[1] + src1[3]*src2[0]
 *     dest[0] = a
 */
  __pyx_v_c = (((((__pyx_v_src1[0]) * (__pyx_v_src2[2])) - ((__pyx_v_src1[1]) * (__pyx_v_src2[3]))) + ((__pyx_v_src1[2]) * (__pyx_v_src2[0]))) + ((__pyx_v_src1[3]) * (__pyx_v_src2[1])));

  /* "_glarea_es2.pyx":217
 *     b = src1[0]*src2[1] + src1[1]*src2[0] + src1[2]*src2[3] - src1[3]*src2[2]
 *     c = src1[0]*src2[2] - src1[1]*src2[3] + src1[2]*src2[0] + src1[3]*src2[1]
 *     d = src1[0]*src2[3] + src1[1]*src2[2] - src1[2]*src2[1] + src1[3]*src2[0]             # <<<<<<<<<<<<<<
 *     dest[0] = a
 *     dest[1] = b
 */
  __pyx_v_d = (((((__pyx_v_src1[0]) * (__pyx_v_src2[3])) + ((__pyx_v_src1[1]) * (__pyx_v_src2[2]))) - ((__pyx_v_src1[2]) * (__pyx_v_src2[1]))) + ((__pyx_v_src1[3]) * (__pyx_v_src2[0])));

  /* "_glarea_es2.pyx":218
 *     c = src1[0]*src2[2] - src1[1]*src2[3] + src1[2]*src2[0] + src1[3]*src2[1]
 *     d = src1[0]*src2[3] + src1[1]*src2[2] - src1[2]*src2[1] + src1[3]*src2[0]
 *     dest[0] = a             # <<<<<<<<<<<<<<
 *     dest[1] = b
 *     dest[2] = c
 */
  (__pyx_v_dest[0]) = __pyx_v_a;

  /* "_glarea_es2.pyx":219
 *     d = src1[0]*src2[3] + src1[1]*src2[2] - src1[2]*src2[1] + src1[3]*src2[0]
 *     dest[0] = a
 *     dest[1] = b             # <<<<<<<<<<<<<<
 *     dest[2] = c
 *     dest[3] = d
 */
  (__pyx_v_dest[1]) = __pyx_v_b;

  /* "_glarea_es2.pyx":220
 *     dest[0] = a
 *     dest[1] = b
 *     dest[2] = c             # <<<<<<<<<<<<<<
 *     dest[3] = d
 * 
 */
  (__pyx_v_dest[2]) = __pyx_v_c;

  /* "_glarea_es2.pyx":221
 *     dest[1] = b
 *     dest[2] = c
 *     dest[3] = d             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  (__pyx_v_dest[3]) = __pyx_v_d;

  /* "_glarea_es2.pyx":212
 * 
 * ##pxm-FUNC P nogil
 * cdef void quat_mult(gldraw.vec4 &dest, gldraw.vec4 &src1, gldraw.vec4 &src2) nogil:             # <<<<<<<<<<<<<<
 *     cdef float a,b,c,d #px+
 *     a = src1[0]*src2[0] - src1[1]*src2[1] - src1[2]*src2[2] - src1[3]*src2[3]
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":238
 * 
 * ##pxm-FUNC P nogil
 * cdef void quat_to_matrix(gldraw.mat4 &dest, gldraw.vec4 &src) nogil:             # <<<<<<<<<<<<<<
 *     cdef float wx2,wy2,wz2, xx2,xy2,xz2, yy2,yz2,zz2 #px+
 *     cdef float nn #px+
 */

static void __pyx_f_11_glarea_es2_quat_to_matrix(__pyx_t_11_gldraw_es2_vec4 *__pyx_v_dest, float *__pyx_v_src) {
  float __pyx_v_wx2;
  float __pyx_v_wy2;
  float __pyx_v_wz2;
  float __pyx_v_xx2;
  float __pyx_v_xy2;
  float __pyx_v_xz2;
  float __pyx_v_yy2;
  float __pyx_v_yz2;
  float __pyx_v_zz2;
  float __pyx_v_nn;
  float __pyx_t_1;

  /* "_glarea_es2.pyx":241
 *     cdef float wx2,wy2,wz2, xx2,xy2,xz2, yy2,yz2,zz2 #px+
 *     cdef float nn #px+
 *     nn = src[0]*src[0] + src[1]*src[1] + src[2]*src[2] + src[3]*src[3]             # <<<<<<<<<<<<<<
 * 
 *     wx2 = 2*src[0]*src[1] / nn
 */
  __pyx_v_nn = (((((__pyx_v_src[0]) * (__pyx_v_src[0])) + ((__pyx_v_src[1]) * (__pyx_v_src[1]))) + ((__pyx_v_src[2]) * (__pyx_v_src[2]))) + ((__pyx_v_src[3]) * (__pyx_v_src[3])));

  /* "_glarea_es2.pyx":243
 *     nn = src[0]*src[0] + src[1]*src[1] + src[2]*src[2] + src[3]*src[3]
 * 
 *     wx2 = 2*src[0]*src[1] / nn             # <<<<<<<<<<<<<<
 *     wy2 = 2*src[0]*src[2] / nn
 *     wz2 = 2*src[0]*src[3] / nn
 */
  __pyx_t_1 = ((2.0 * (__pyx_v_src[0])) * (__pyx_v_src[1]));
  if (unlikely(__pyx_v_nn == 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_ERR(0, 243, __pyx_L1_error)
  }
  __pyx_v_wx2 = (__pyx_t_1 / __pyx_v_nn);

  /* "_glarea_es2.pyx":244
 * 
 *     wx2 = 2*src[0]*src[1] / nn
 *     wy2 = 2*src[0]*src[2] / nn             # <<<<<<<<<<<<<<
 *     wz2 = 2*src[0]*src[3] / nn
 *     xx2 = 2*src[1]*src[1] / nn
 */
  __pyx_t_1 = ((2.0 * (__pyx_v_src[0])) * (__pyx_v_src[2]));
  if (unlikely(__pyx_v_nn == 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_ERR(0, 244, __pyx_L1_error)
  }
  __pyx_v_wy2 = (__pyx_t_1 / __pyx_v_nn);

  /* "_glarea_es2.pyx":245
 *     wx2 = 2*src[0]*src[1] / nn
 *     wy2 = 2*src[0]*src[2] / nn
 *     wz2 = 2*src[0]*src[3] / nn             # <<<<<<<<<<<<<<
 *     xx2 = 2*src[1]*src[1] / nn
 *     xy2 = 2*src[1]*src[2] / nn
 */
  __pyx_t_1 = ((2.0 * (__pyx_v_src[0])) * (__pyx_v_src[3]));
  if (unlikely(__pyx_v_nn == 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_ERR(0, 245, __pyx_L1_error)
  }
  __pyx_v_wz2 = (__pyx_t_1 / __pyx_v_nn);

  /* "_glarea_es2.pyx":246
 *     wy2 = 2*src[0]*src[2] / nn
 *     wz2 = 2*src[0]*src[3] / nn
 *     xx2 = 2*src[1]*src[1] / nn             # <<<<<<<<<<<<<<
 *     xy2 = 2*src[1]*src[2] / nn
 *     xz2 = 2*src[1]*src[3] / nn
 */
  __pyx_t_1 = ((2.0 * (__pyx_v_src[1])) * (__pyx_v_src[1]));
  if (unlikely(__pyx_v_nn == 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_ERR(0, 246, __pyx_L1_error)
  }
  __pyx_v_xx2 = (__pyx_t_1 / __pyx_v_nn);

  /* "_glarea_es2.pyx":247
 *     wz2 = 2*src[0]*src[3] / nn
 *     xx2 = 2*src[1]*src[1] / nn
 *     xy2 = 2*src[1]*src[2] / nn             # <<<<<<<<<<<<<<
 *     xz2 = 2*src[1]*src[3] / nn
 *     yy2 = 2*src[2]*src[2] / nn
 */
  __pyx_t_1 = ((2.0 * (__pyx_v_src[1])) * (__pyx_v_src[2]));
  if (unlikely(__pyx_v_nn == 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_ERR(0, 247, __pyx_L1_error)
  }
  __pyx_v_xy2 = (__pyx_t_1 / __pyx_v_nn);

  /* "_glarea_es2.pyx":248
 *     xx2 = 2*src[1]*src[1] / nn
 *     xy2 = 2*src[1]*src[2] / nn
 *     xz2 = 2*src[1]*src[3] / nn             # <<<<<<<<<<<<<<
 *     yy2 = 2*src[2]*src[2] / nn
 *     yz2 = 2*src[2]*src[3] / nn
 */
  __pyx_t_1 = ((2.0 * (__pyx_v_src[1])) * (__pyx_v_src[3]));
  if (unlikely(__pyx_v_nn == 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_ERR(0, 248, __pyx_L1_error)
  }
  __pyx_v_xz2 = (__pyx_t_1 / __pyx_v_nn);

  /* "_glarea_es2.pyx":249
 *     xy2 = 2*src[1]*src[2] / nn
 *     xz2 = 2*src[1]*src[3] / nn
 *     yy2 = 2*src[2]*src[2] / nn             # <<<<<<<<<<<<<<
 *     yz2 = 2*src[2]*src[3] / nn
 *     zz2 = 2*src[3]*src[3] / nn
 */
  __pyx_t_1 = ((2.0 * (__pyx_v_src[2])) * (__pyx_v_src[2]));
  if (unlikely(__pyx_v_nn == 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_ERR(0, 249, __pyx_L1_error)
  }
  __pyx_v_yy2 = (__pyx_t_1 / __pyx_v_nn);

  /* "_glarea_es2.pyx":250
 *     xz2 = 2*src[1]*src[3] / nn
 *     yy2 = 2*src[2]*src[2] / nn
 *     yz2 = 2*src[2]*src[3] / nn             # <<<<<<<<<<<<<<
 *     zz2 = 2*src[3]*src[3] / nn
 * 
 */
  __pyx_t_1 = ((2.0 * (__pyx_v_src[2])) * (__pyx_v_src[3]));
  if (unlikely(__pyx_v_nn == 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_ERR(0, 250, __pyx_L1_error)
  }
  __pyx_v_yz2 = (__pyx_t_1 / __pyx_v_nn);

  /* "_glarea_es2.pyx":251
 *     yy2 = 2*src[2]*src[2] / nn
 *     yz2 = 2*src[2]*src[3] / nn
 *     zz2 = 2*src[3]*src[3] / nn             # <<<<<<<<<<<<<<
 * 
 *     dest[0][0] = 1-yy2-zz2; dest[1][0] = xy2-wz2;   dest[2][0] = xz2+wy2
 */
  __pyx_t_1 = ((2.0 * (__pyx_v_src[3])) * (__pyx_v_src[3]));
  if (unlikely(__pyx_v_nn == 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_ERR(0, 251, __pyx_L1_error)
  }
  __pyx_v_zz2 = (__pyx_t_1 / __pyx_v_nn);

  /* "_glarea_es2.pyx":253
 *     zz2 = 2*src[3]*src[3] / nn
 * 
 *     dest[0][0] = 1-yy2-zz2; dest[1][0] = xy2-wz2;   dest[2][0] = xz2+wy2             # <<<<<<<<<<<<<<
 *     dest[0][1] = xy2+wz2;   dest[1][1] = 1-xx2-zz2; dest[2][1] = yz2-wx2
 *     dest[0][2] = xz2-wy2;   dest[1][2] = yz2+wx2;   dest[2][2] = 1-xx2-yy2
 */
  ((__pyx_v_dest[0])[0]) = ((1.0 - __pyx_v_yy2) - __pyx_v_zz2);
  ((__pyx_v_dest[1])[0]) = (__pyx_v_xy2 - __pyx_v_wz2);
  ((__pyx_v_dest[2])[0]) = (__pyx_v_xz2 + __pyx_v_wy2);

  /* "_glarea_es2.pyx":254
 * 
 *     dest[0][0] = 1-yy2-zz2; dest[1][0] = xy2-wz2;   dest[2][0] = xz2+wy2
 *     dest[0][1] = xy2+wz2;   dest[1][1] = 1-xx2-zz2; dest[2][1] = yz2-wx2             # <<<<<<<<<<<<<<
 *     dest[0][2] = xz2-wy2;   dest[1][2] = yz2+wx2;   dest[2][2] = 1-xx2-yy2
 * 
 */
  ((__pyx_v_dest[0])[1]) = (__pyx_v_xy2 + __pyx_v_wz2);
  ((__pyx_v_dest[1])[1]) = ((1.0 - __pyx_v_xx2) - __pyx_v_zz2);
  ((__pyx_v_dest[2])[1]) = (__pyx_v_yz2 - __pyx_v_wx2);

  /* "_glarea_es2.pyx":255
 *     dest[0][0] = 1-yy2-zz2; dest[1][0] = xy2-wz2;   dest[2][0] = xz2+wy2
 *     dest[0][1] = xy2+wz2;   dest[1][1] = 1-xx2-zz2; dest[2][1] = yz2-wx2
 *     dest[0][2] = xz2-wy2;   dest[1][2] = yz2+wx2;   dest[2][2] = 1-xx2-yy2             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  ((__pyx_v_dest[0])[2]) = (__pyx_v_xz2 - __pyx_v_wy2);
  ((__pyx_v_dest[1])[2]) = (__pyx_v_yz2 + __pyx_v_wx2);
  ((__pyx_v_dest[2])[2]) = ((1.0 - __pyx_v_xx2) - __pyx_v_yy2);

  /* "_glarea_es2.pyx":238
 * 
 * ##pxm-FUNC P nogil
 * cdef void quat_to_matrix(gldraw.mat4 &dest, gldraw.vec4 &src) nogil:             # <<<<<<<<<<<<<<
 *     cdef float wx2,wy2,wz2, xx2,xy2,xz2, yy2,yz2,zz2 #px+
 *     cdef float nn #px+
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("_glarea_es2.quat_to_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}

/* "_glarea_es2.pyx":258
 * 
 * ##pxm-FUNC P nogil
 * cdef void quat_from_angle_axis(gldraw.vec4 &quat, float angle, float x, float y, float z) nogil:             # <<<<<<<<<<<<<<
 *     cdef float sa, ca #px+
 *     ca = cos(angle)
 */

static void __pyx_f_11_glarea_es2_quat_from_angle_axis(float *__pyx_v_quat, float __pyx_v_angle, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z) {
  float __pyx_v_sa;
  float __pyx_v_ca;

  /* "_glarea_es2.pyx":260
 * cdef void quat_from_angle_axis(gldraw.vec4 &quat, float angle, float x, float y, float z) nogil:
 *     cdef float sa, ca #px+
 *     ca = cos(angle)             # <<<<<<<<<<<<<<
 *     sa = sin(angle)
 *     quat[0] = ca
 */
  __pyx_v_ca = cos(__pyx_v_angle);

  /* "_glarea_es2.pyx":261
 *     cdef float sa, ca #px+
 *     ca = cos(angle)
 *     sa = sin(angle)             # <<<<<<<<<<<<<<
 *     quat[0] = ca
 *     quat[1] = sa*x
 */
  __pyx_v_sa = sin(__pyx_v_angle);

  /* "_glarea_es2.pyx":262
 *     ca = cos(angle)
 *     sa = sin(angle)
 *     quat[0] = ca             # <<<<<<<<<<<<<<
 *     quat[1] = sa*x
 *     quat[2] = sa*y
 */
  (__pyx_v_quat[0]) = __pyx_v_ca;

  /* "_glarea_es2.pyx":263
 *     sa = sin(angle)
 *     quat[0] = ca
 *     quat[1] = sa*x             # <<<<<<<<<<<<<<
 *     quat[2] = sa*y
 *     quat[3] = sa*z
 */
  (__pyx_v_quat[1]) = (__pyx_v_sa * __pyx_v_x);

  /* "_glarea_es2.pyx":264
 *     quat[0] = ca
 *     quat[1] = sa*x
 *     quat[2] = sa*y             # <<<<<<<<<<<<<<
 *     quat[3] = sa*z
 * 
 */
  (__pyx_v_quat[2]) = (__pyx_v_sa * __pyx_v_y);

  /* "_glarea_es2.pyx":265
 *     quat[1] = sa*x
 *     quat[2] = sa*y
 *     quat[3] = sa*z             # <<<<<<<<<<<<<<
 * 
 * ### module state
 */
  (__pyx_v_quat[3]) = (__pyx_v_sa * __pyx_v_z);

  /* "_glarea_es2.pyx":258
 * 
 * ##pxm-FUNC P nogil
 * cdef void quat_from_angle_axis(gldraw.vec4 &quat, float angle, float x, float y, float z) nogil:             # <<<<<<<<<<<<<<
 *     cdef float sa, ca #px+
 *     ca = cos(angle)
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":269
 * ### module state
 * 
 * def init_engine():             # <<<<<<<<<<<<<<
 *     gldraw.init_gldraw()
 *     if debug & DEBUG_MSGEXT:
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_3init_engine(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_3init_engine = {"init_engine", (PyCFunction)__pyx_pw_11_glarea_es2_3init_engine, METH_NOARGS, 0};
static PyObject *__pyx_pw_11_glarea_es2_3init_engine(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_engine (wrapper)", 0);
  __pyx_r = __pyx_pf_11_glarea_es2_2init_engine(__pyx_self);

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

static PyObject *__pyx_pf_11_glarea_es2_2init_engine(CYTHON_UNUSED PyObject *__pyx_self) {
  float __pyx_v_fovy_angle;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  float __pyx_t_4;
  __Pyx_RefNannySetupContext("init_engine", 0);

  /* "_glarea_es2.pyx":270
 * 
 * def init_engine():
 *     gldraw.init_gldraw()             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_MSGEXT:
 *         print('init module:', __name__)
 */
  __pyx_f_11_gldraw_es2_init_gldraw();

  /* "_glarea_es2.pyx":271
 * def init_engine():
 *     gldraw.init_gldraw()
 *     if debug & DEBUG_MSGEXT:             # <<<<<<<<<<<<<<
 *         print('init module:', __name__)
 *         print('  from package:', __package__)
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_MSGEXT) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":272
 *     gldraw.init_gldraw()
 *     if debug & DEBUG_MSGEXT:
 *         print('init module:', __name__)             # <<<<<<<<<<<<<<
 *         print('  from package:', __package__)
 *         print('  compiled:', __compiled)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_kp_u_init_module);
    __Pyx_GIVEREF(__pyx_kp_u_init_module);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_init_module);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "_glarea_es2.pyx":273
 *     if debug & DEBUG_MSGEXT:
 *         print('init module:', __name__)
 *         print('  from package:', __package__)             # <<<<<<<<<<<<<<
 *         print('  compiled:', __compiled)
 *         print('  GL-type: es2') #px+
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_package); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_kp_u_from_package);
    __Pyx_GIVEREF(__pyx_kp_u_from_package);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_from_package);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "_glarea_es2.pyx":274
 *         print('init module:', __name__)
 *         print('  from package:', __package__)
 *         print('  compiled:', __compiled)             # <<<<<<<<<<<<<<
 *         print('  GL-type: es2') #px+
 *         print('  OFFSCREEN:', OFFSCREEN)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_compiled_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_kp_u_compiled);
    __Pyx_GIVEREF(__pyx_kp_u_compiled);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_compiled);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "_glarea_es2.pyx":275
 *         print('  from package:', __package__)
 *         print('  compiled:', __compiled)
 *         print('  GL-type: es2') #px+             # <<<<<<<<<<<<<<
 *         print('  OFFSCREEN:', OFFSCREEN)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "_glarea_es2.pyx":276
 *         print('  compiled:', __compiled)
 *         print('  GL-type: es2') #px+
 *         print('  OFFSCREEN:', OFFSCREEN)             # <<<<<<<<<<<<<<
 * 
 *     uidata.synced = False
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_print, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "_glarea_es2.pyx":271
 * def init_engine():
 *     gldraw.init_gldraw()
 *     if debug & DEBUG_MSGEXT:             # <<<<<<<<<<<<<<
 *         print('init module:', __name__)
 *         print('  from package:', __package__)
 */
  }

  /* "_glarea_es2.pyx":278
 *         print('  OFFSCREEN:', OFFSCREEN)
 * 
 *     uidata.synced = False             # <<<<<<<<<<<<<<
 *     uidata.background_changed = True
 *     uidata.viewport_changed = True
 */
  __pyx_v_11_glarea_es2_uidata.synced = 0;

  /* "_glarea_es2.pyx":279
 * 
 *     uidata.synced = False
 *     uidata.background_changed = True             # <<<<<<<<<<<<<<
 *     uidata.viewport_changed = True
 *     uidata.rotation_changed = True
 */
  __pyx_v_11_glarea_es2_uidata.background_changed = 1;

  /* "_glarea_es2.pyx":280
 *     uidata.synced = False
 *     uidata.background_changed = True
 *     uidata.viewport_changed = True             # <<<<<<<<<<<<<<
 *     uidata.rotation_changed = True
 *     uidata.rotation_quat_changed = False
 */
  __pyx_v_11_glarea_es2_uidata.viewport_changed = 1;

  /* "_glarea_es2.pyx":281
 *     uidata.background_changed = True
 *     uidata.viewport_changed = True
 *     uidata.rotation_changed = True             # <<<<<<<<<<<<<<
 *     uidata.rotation_quat_changed = False
 *     uidata.frustum_changed = True
 */
  __pyx_v_11_glarea_es2_uidata.rotation_changed = 1;

  /* "_glarea_es2.pyx":282
 *     uidata.viewport_changed = True
 *     uidata.rotation_changed = True
 *     uidata.rotation_quat_changed = False             # <<<<<<<<<<<<<<
 *     uidata.frustum_changed = True
 *     uidata.multisample_changed = 1
 */
  __pyx_v_11_glarea_es2_uidata.rotation_quat_changed = 0;

  /* "_glarea_es2.pyx":283
 *     uidata.rotation_changed = True
 *     uidata.rotation_quat_changed = False
 *     uidata.frustum_changed = True             # <<<<<<<<<<<<<<
 *     uidata.multisample_changed = 1
 *     uidata.transformation_changed = False
 */
  __pyx_v_11_glarea_es2_uidata.frustum_changed = 1;

  /* "_glarea_es2.pyx":284
 *     uidata.rotation_quat_changed = False
 *     uidata.frustum_changed = True
 *     uidata.multisample_changed = 1             # <<<<<<<<<<<<<<
 *     uidata.transformation_changed = False
 *     uidata.animation_changed = 0
 */
  __pyx_v_11_glarea_es2_uidata.multisample_changed = 1;

  /* "_glarea_es2.pyx":285
 *     uidata.frustum_changed = True
 *     uidata.multisample_changed = 1
 *     uidata.transformation_changed = False             # <<<<<<<<<<<<<<
 *     uidata.animation_changed = 0
 *     uidata.data_changed = False
 */
  __pyx_v_11_glarea_es2_uidata.transformation_changed = 0;

  /* "_glarea_es2.pyx":286
 *     uidata.multisample_changed = 1
 *     uidata.transformation_changed = False
 *     uidata.animation_changed = 0             # <<<<<<<<<<<<<<
 *     uidata.data_changed = False
 *     uidata.shaders_changed = False
 */
  __pyx_v_11_glarea_es2_uidata.animation_changed = 0;

  /* "_glarea_es2.pyx":287
 *     uidata.transformation_changed = False
 *     uidata.animation_changed = 0
 *     uidata.data_changed = False             # <<<<<<<<<<<<<<
 *     uidata.shaders_changed = False
 * 
 */
  __pyx_v_11_glarea_es2_uidata.data_changed = 0;

  /* "_glarea_es2.pyx":288
 *     uidata.animation_changed = 0
 *     uidata.data_changed = False
 *     uidata.shaders_changed = False             # <<<<<<<<<<<<<<
 * 
 *     uidata.bg_red = 0.0
 */
  __pyx_v_11_glarea_es2_uidata.shaders_changed = 0;

  /* "_glarea_es2.pyx":290
 *     uidata.shaders_changed = False
 * 
 *     uidata.bg_red = 0.0             # <<<<<<<<<<<<<<
 *     uidata.bg_green = 0.0
 *     uidata.bg_blue = 0.0
 */
  __pyx_v_11_glarea_es2_uidata.bg_red = 0.0;

  /* "_glarea_es2.pyx":291
 * 
 *     uidata.bg_red = 0.0
 *     uidata.bg_green = 0.0             # <<<<<<<<<<<<<<
 *     uidata.bg_blue = 0.0
 *     renderdata.y = 0
 */
  __pyx_v_11_glarea_es2_uidata.bg_green = 0.0;

  /* "_glarea_es2.pyx":292
 *     uidata.bg_red = 0.0
 *     uidata.bg_green = 0.0
 *     uidata.bg_blue = 0.0             # <<<<<<<<<<<<<<
 *     renderdata.y = 0
 *     renderdata.width = 1
 */
  __pyx_v_11_glarea_es2_uidata.bg_blue = 0.0;

  /* "_glarea_es2.pyx":293
 *     uidata.bg_green = 0.0
 *     uidata.bg_blue = 0.0
 *     renderdata.y = 0             # <<<<<<<<<<<<<<
 *     renderdata.width = 1
 *     renderdata.height = 1
 */
  __pyx_v_11_glarea_es2_renderdata.y = 0;

  /* "_glarea_es2.pyx":294
 *     uidata.bg_blue = 0.0
 *     renderdata.y = 0
 *     renderdata.width = 1             # <<<<<<<<<<<<<<
 *     renderdata.height = 1
 *     uidata.rotationxhalf = 0.0
 */
  __pyx_v_11_glarea_es2_renderdata.width = 1;

  /* "_glarea_es2.pyx":295
 *     renderdata.y = 0
 *     renderdata.width = 1
 *     renderdata.height = 1             # <<<<<<<<<<<<<<
 *     uidata.rotationxhalf = 0.0
 *     uidata.rotationyhalf = 0.0
 */
  __pyx_v_11_glarea_es2_renderdata.height = 1;

  /* "_glarea_es2.pyx":296
 *     renderdata.width = 1
 *     renderdata.height = 1
 *     uidata.rotationxhalf = 0.0             # <<<<<<<<<<<<<<
 *     uidata.rotationyhalf = 0.0
 *     quat_set_identity(uidata.rotation_quat)
 */
  __pyx_v_11_glarea_es2_uidata.rotationxhalf = 0.0;

  /* "_glarea_es2.pyx":297
 *     renderdata.height = 1
 *     uidata.rotationxhalf = 0.0
 *     uidata.rotationyhalf = 0.0             # <<<<<<<<<<<<<<
 *     quat_set_identity(uidata.rotation_quat)
 *     uidata.pick_x = -1
 */
  __pyx_v_11_glarea_es2_uidata.rotationyhalf = 0.0;

  /* "_glarea_es2.pyx":298
 *     uidata.rotationxhalf = 0.0
 *     uidata.rotationyhalf = 0.0
 *     quat_set_identity(uidata.rotation_quat)             # <<<<<<<<<<<<<<
 *     uidata.pick_x = -1
 *     uidata.pick_y = -1
 */
  __pyx_f_11_glarea_es2_quat_set_identity(__pyx_v_11_glarea_es2_uidata.rotation_quat);

  /* "_glarea_es2.pyx":299
 *     uidata.rotationyhalf = 0.0
 *     quat_set_identity(uidata.rotation_quat)
 *     uidata.pick_x = -1             # <<<<<<<<<<<<<<
 *     uidata.pick_y = -1
 *     renderdata.pick_x = -1
 */
  __pyx_v_11_glarea_es2_uidata.pick_x = -1;

  /* "_glarea_es2.pyx":300
 *     quat_set_identity(uidata.rotation_quat)
 *     uidata.pick_x = -1
 *     uidata.pick_y = -1             # <<<<<<<<<<<<<<
 *     renderdata.pick_x = -1
 *     renderdata.pick_y = -1
 */
  __pyx_v_11_glarea_es2_uidata.pick_y = -1;

  /* "_glarea_es2.pyx":301
 *     uidata.pick_x = -1
 *     uidata.pick_y = -1
 *     renderdata.pick_x = -1             # <<<<<<<<<<<<<<
 *     renderdata.pick_y = -1
 *     cdef float fovy_angle  # field of view angle #px+
 */
  __pyx_v_11_glarea_es2_renderdata.pick_x = -1;

  /* "_glarea_es2.pyx":302
 *     uidata.pick_y = -1
 *     renderdata.pick_x = -1
 *     renderdata.pick_y = -1             # <<<<<<<<<<<<<<
 *     cdef float fovy_angle  # field of view angle #px+
 *     fovy_angle = 33.0  # field of view angle
 */
  __pyx_v_11_glarea_es2_renderdata.pick_y = -1;

  /* "_glarea_es2.pyx":304
 *     renderdata.pick_y = -1
 *     cdef float fovy_angle  # field of view angle #px+
 *     fovy_angle = 33.0  # field of view angle             # <<<<<<<<<<<<<<
 *     uidata.fovy_radius = tan(fovy_angle * M_PI / 360.0)
 *     uidata.fovy_radius_zoom = uidata.fovy_radius  # zoom == 1.
 */
  __pyx_v_fovy_angle = 33.0;

  /* "_glarea_es2.pyx":305
 *     cdef float fovy_angle  # field of view angle #px+
 *     fovy_angle = 33.0  # field of view angle
 *     uidata.fovy_radius = tan(fovy_angle * M_PI / 360.0)             # <<<<<<<<<<<<<<
 *     uidata.fovy_radius_zoom = uidata.fovy_radius  # zoom == 1.
 *     uidata.bounding_sphere_radius = 1.
 */
  __pyx_v_11_glarea_es2_uidata.fovy_radius = tan(((__pyx_v_fovy_angle * M_PI) / 360.0));

  /* "_glarea_es2.pyx":306
 *     fovy_angle = 33.0  # field of view angle
 *     uidata.fovy_radius = tan(fovy_angle * M_PI / 360.0)
 *     uidata.fovy_radius_zoom = uidata.fovy_radius  # zoom == 1.             # <<<<<<<<<<<<<<
 *     uidata.bounding_sphere_radius = 1.
 *     uidata.angle = 0
 */
  __pyx_t_4 = __pyx_v_11_glarea_es2_uidata.fovy_radius;
  __pyx_v_11_glarea_es2_uidata.fovy_radius_zoom = __pyx_t_4;

  /* "_glarea_es2.pyx":307
 *     uidata.fovy_radius = tan(fovy_angle * M_PI / 360.0)
 *     uidata.fovy_radius_zoom = uidata.fovy_radius  # zoom == 1.
 *     uidata.bounding_sphere_radius = 1.             # <<<<<<<<<<<<<<
 *     uidata.angle = 0
 * 
 */
  __pyx_v_11_glarea_es2_uidata.bounding_sphere_radius = 1.;

  /* "_glarea_es2.pyx":308
 *     uidata.fovy_radius_zoom = uidata.fovy_radius  # zoom == 1.
 *     uidata.bounding_sphere_radius = 1.
 *     uidata.angle = 0             # <<<<<<<<<<<<<<
 * 
 *     # fill modelview_matrix
 */
  __pyx_v_11_glarea_es2_uidata.angle = 0.0;

  /* "_glarea_es2.pyx":311
 * 
 *     # fill modelview_matrix
 *     gldraw.matrix_set_identity(renderdata.modelview_matrix)             # <<<<<<<<<<<<<<
 *     # fill projection_matrix
 *     gldraw.matrix_set_identity(renderdata.projection_matrix)
 */
  __pyx_f_11_gldraw_es2_matrix_set_identity(__pyx_v_11_glarea_es2_renderdata.modelview_matrix);

  /* "_glarea_es2.pyx":313
 *     gldraw.matrix_set_identity(renderdata.modelview_matrix)
 *     # fill projection_matrix
 *     gldraw.matrix_set_identity(renderdata.projection_matrix)             # <<<<<<<<<<<<<<
 *     renderdata.projection_matrix[2][3] = -1.
 *     renderdata.projection_matrix[3][3] = 0.
 */
  __pyx_f_11_gldraw_es2_matrix_set_identity(__pyx_v_11_glarea_es2_renderdata.projection_matrix);

  /* "_glarea_es2.pyx":314
 *     # fill projection_matrix
 *     gldraw.matrix_set_identity(renderdata.projection_matrix)
 *     renderdata.projection_matrix[2][3] = -1.             # <<<<<<<<<<<<<<
 *     renderdata.projection_matrix[3][3] = 0.
 *     # fill picking_matrix
 */
  ((__pyx_v_11_glarea_es2_renderdata.projection_matrix[2])[3]) = -1.;

  /* "_glarea_es2.pyx":315
 *     gldraw.matrix_set_identity(renderdata.projection_matrix)
 *     renderdata.projection_matrix[2][3] = -1.
 *     renderdata.projection_matrix[3][3] = 0.             # <<<<<<<<<<<<<<
 *     # fill picking_matrix
 *     gldraw.matrix_set_identity(renderdata.picking_matrix)
 */
  ((__pyx_v_11_glarea_es2_renderdata.projection_matrix[3])[3]) = 0.;

  /* "_glarea_es2.pyx":317
 *     renderdata.projection_matrix[3][3] = 0.
 *     # fill picking_matrix
 *     gldraw.matrix_set_identity(renderdata.picking_matrix)             # <<<<<<<<<<<<<<
 * 
 *     renderdata.shader_changed = False
 */
  __pyx_f_11_gldraw_es2_matrix_set_identity(__pyx_v_11_glarea_es2_renderdata.picking_matrix);

  /* "_glarea_es2.pyx":319
 *     gldraw.matrix_set_identity(renderdata.picking_matrix)
 * 
 *     renderdata.shader_changed = False             # <<<<<<<<<<<<<<
 *     renderdata.prog_render = 0
 *     renderdata.prog_hud = 0
 */
  __pyx_v_11_glarea_es2_renderdata.shader_changed = 0;

  /* "_glarea_es2.pyx":320
 * 
 *     renderdata.shader_changed = False
 *     renderdata.prog_render = 0             # <<<<<<<<<<<<<<
 *     renderdata.prog_hud = 0
 *     renderdata.prog_pick = 0
 */
  __pyx_v_11_glarea_es2_renderdata.prog_render = 0;

  /* "_glarea_es2.pyx":321
 *     renderdata.shader_changed = False
 *     renderdata.prog_render = 0
 *     renderdata.prog_hud = 0             # <<<<<<<<<<<<<<
 *     renderdata.prog_pick = 0
 * 
 */
  __pyx_v_11_glarea_es2_renderdata.prog_hud = 0;

  /* "_glarea_es2.pyx":322
 *     renderdata.prog_render = 0
 *     renderdata.prog_hud = 0
 *     renderdata.prog_pick = 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_11_glarea_es2_renderdata.prog_pick = 0;

  /* "_glarea_es2.pyx":269
 * ### module state
 * 
 * def init_engine():             # <<<<<<<<<<<<<<
 *     gldraw.init_gldraw()
 *     if debug & DEBUG_MSGEXT:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_glarea_es2.init_engine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":326
 * 
 * ##pxm-FUNC P nogil
 * cdef void _sync_modelview_matrix_translation() nogil:             # <<<<<<<<<<<<<<
 *     renderdata.modelview_matrix[3][2] = -uidata.bounding_sphere_radius * (1/uidata.fovy_radius + 1.)
 * 
 */

static void __pyx_f_11_glarea_es2__sync_modelview_matrix_translation(void) {

  /* "_glarea_es2.pyx":327
 * ##pxm-FUNC P nogil
 * cdef void _sync_modelview_matrix_translation() nogil:
 *     renderdata.modelview_matrix[3][2] = -uidata.bounding_sphere_radius * (1/uidata.fovy_radius + 1.)             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  if (unlikely(__pyx_v_11_glarea_es2_uidata.fovy_radius == 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_ERR(0, 327, __pyx_L1_error)
  }
  ((__pyx_v_11_glarea_es2_renderdata.modelview_matrix[3])[2]) = ((-__pyx_v_11_glarea_es2_uidata.bounding_sphere_radius) * ((1.0 / __pyx_v_11_glarea_es2_uidata.fovy_radius) + 1.));

  /* "_glarea_es2.pyx":326
 * 
 * ##pxm-FUNC P nogil
 * cdef void _sync_modelview_matrix_translation() nogil:             # <<<<<<<<<<<<<<
 *     renderdata.modelview_matrix[3][2] = -uidata.bounding_sphere_radius * (1/uidata.fovy_radius + 1.)
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("_glarea_es2._sync_modelview_matrix_translation", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}

/* "_glarea_es2.pyx":330
 * 
 * ##pxm-FUNC P nogil
 * cdef void _sync_modelview_matrix_rotation() nogil:             # <<<<<<<<<<<<<<
 *     cdef gldraw.vec4 *M #px+
 *     cdef float sx, sy, cx, cy #px+
 */

static void __pyx_f_11_glarea_es2__sync_modelview_matrix_rotation(void) {
  __pyx_t_11_gldraw_es2_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;

  /* "_glarea_es2.pyx":335
 *     cdef float m00, m11, m12, m20 #px+
 * 
 *     M = <gldraw.vec4*>&renderdata.modelview_matrix[0][0] #px/             # <<<<<<<<<<<<<<
 *     #M = renderdata.modelview_matrix
 * 
 */
  __pyx_v_M = ((__pyx_t_11_gldraw_es2_vec4 *)(&((__pyx_v_11_glarea_es2_renderdata.modelview_matrix[0])[0])));

  /* "_glarea_es2.pyx":338
 *     #M = renderdata.modelview_matrix
 * 
 *     sx = sin(uidata.rotationxhalf)             # <<<<<<<<<<<<<<
 *     sy = sin(uidata.rotationyhalf)
 *     cx = cos(uidata.rotationxhalf)
 */
  __pyx_v_sx = sin(__pyx_v_11_glarea_es2_uidata.rotationxhalf);

  /* "_glarea_es2.pyx":339
 * 
 *     sx = sin(uidata.rotationxhalf)
 *     sy = sin(uidata.rotationyhalf)             # <<<<<<<<<<<<<<
 *     cx = cos(uidata.rotationxhalf)
 *     cy = cos(uidata.rotationyhalf)
 */
  __pyx_v_sy = sin(__pyx_v_11_glarea_es2_uidata.rotationyhalf);

  /* "_glarea_es2.pyx":340
 *     sx = sin(uidata.rotationxhalf)
 *     sy = sin(uidata.rotationyhalf)
 *     cx = cos(uidata.rotationxhalf)             # <<<<<<<<<<<<<<
 *     cy = cos(uidata.rotationyhalf)
 * 
 */
  __pyx_v_cx = cos(__pyx_v_11_glarea_es2_uidata.rotationxhalf);

  /* "_glarea_es2.pyx":341
 *     sy = sin(uidata.rotationyhalf)
 *     cx = cos(uidata.rotationxhalf)
 *     cy = cos(uidata.rotationyhalf)             # <<<<<<<<<<<<<<
 * 
 *     m00 = 2*cx*cx - 1.
 */
  __pyx_v_cy = cos(__pyx_v_11_glarea_es2_uidata.rotationyhalf);

  /* "_glarea_es2.pyx":343
 *     cy = cos(uidata.rotationyhalf)
 * 
 *     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_es2.pyx":344
 * 
 *     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_es2.pyx":345
 *     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_es2.pyx":346
 *     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_es2.pyx":348
 *     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_es2.pyx":349
 *     # 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_es2.pyx":350
 *     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             # <<<<<<<<<<<<<<
 * 
 * def set_rotation_rel(x, y):
 */
  ((__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_es2.pyx":330
 * 
 * ##pxm-FUNC P nogil
 * cdef void _sync_modelview_matrix_rotation() nogil:             # <<<<<<<<<<<<<<
 *     cdef gldraw.vec4 *M #px+
 *     cdef float sx, sy, cx, cy #px+
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":352
 *     M[0][2] = -m11 * m20;   M[1][2] = m12;  M[2][2] =  m00 * m11
 * 
 * def set_rotation_rel(x, y):             # <<<<<<<<<<<<<<
 *     cdef gldraw.vec4 quat #px+
 *     cdef float nxy #px+
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_5set_rotation_rel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_5set_rotation_rel = {"set_rotation_rel", (PyCFunction)__pyx_pw_11_glarea_es2_5set_rotation_rel, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_11_glarea_es2_5set_rotation_rel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_rotation_rel (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_rel", 1, 2, 2, 1); __PYX_ERR(0, 352, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_rotation_rel") < 0)) __PYX_ERR(0, 352, __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_rel", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 352, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea_es2.set_rotation_rel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11_glarea_es2_4set_rotation_rel(__pyx_self, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_11_glarea_es2_4set_rotation_rel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  __pyx_t_11_gldraw_es2_vec4 __pyx_v_quat;
  float __pyx_v_nxy;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  double __pyx_t_4;
  float __pyx_t_5;
  float __pyx_t_6;
  __Pyx_RefNannySetupContext("set_rotation_rel", 0);

  /* "_glarea_es2.pyx":355
 *     cdef gldraw.vec4 quat #px+
 *     cdef float nxy #px+
 *     nxy = sqrt(x*x + y*y)             # <<<<<<<<<<<<<<
 *     quat_from_angle_axis(quat, nxy/50., y/nxy, x/nxy, 0.)
 *     quat_mult(uidata.rotation_quat, quat, uidata.rotation_quat)
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_x, __pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Multiply(__pyx_v_y, __pyx_v_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 355, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_nxy = sqrt(__pyx_t_4);

  /* "_glarea_es2.pyx":356
 *     cdef float nxy #px+
 *     nxy = sqrt(x*x + y*y)
 *     quat_from_angle_axis(quat, nxy/50., y/nxy, x/nxy, 0.)             # <<<<<<<<<<<<<<
 *     quat_mult(uidata.rotation_quat, quat, uidata.rotation_quat)
 * 
 */
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_nxy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_y, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_nxy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 356, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_f_11_glarea_es2_quat_from_angle_axis(__pyx_v_quat, (((double)__pyx_v_nxy) / 50.), __pyx_t_5, __pyx_t_6, 0.);

  /* "_glarea_es2.pyx":357
 *     nxy = sqrt(x*x + y*y)
 *     quat_from_angle_axis(quat, nxy/50., y/nxy, x/nxy, 0.)
 *     quat_mult(uidata.rotation_quat, quat, uidata.rotation_quat)             # <<<<<<<<<<<<<<
 * 
 *     # avoid rotation about z-axis
 */
  __pyx_f_11_glarea_es2_quat_mult(__pyx_v_11_glarea_es2_uidata.rotation_quat, __pyx_v_quat, __pyx_v_11_glarea_es2_uidata.rotation_quat);

  /* "_glarea_es2.pyx":367
 *     #quat_mult(uidata.rotation_quat, quat, uidata.rotation_quat)
 * 
 *     uidata.rotation_quat_changed = True             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  __pyx_v_11_glarea_es2_uidata.rotation_quat_changed = 1;

  /* "_glarea_es2.pyx":352
 *     M[0][2] = -m11 * m20;   M[1][2] = m12;  M[2][2] =  m00 * m11
 * 
 * def set_rotation_rel(x, y):             # <<<<<<<<<<<<<<
 *     cdef gldraw.vec4 quat #px+
 *     cdef float nxy #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_AddTraceback("_glarea_es2.set_rotation_rel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":370
 * 
 * ##pxm-FUNC P nogil
 * cdef void _sync_projection_matrix() nogil:             # <<<<<<<<<<<<<<
 *     # Taken from the OpenGL documentation for glFrustum:
 *     # glFrustum describes a perspective matrix that produces a perspective projection.
 */

static void __pyx_f_11_glarea_es2__sync_projection_matrix(void) {
  float __pyx_v__1_aspectx;
  float __pyx_v__1_aspecty;
  int __pyx_t_1;
  double __pyx_t_2;

  /* "_glarea_es2.pyx":408
 * 
 *     cdef float _1_aspectx, _1_aspecty #px+
 *     if renderdata.width < renderdata.height:             # <<<<<<<<<<<<<<
 *         _1_aspectx = 1.
 *         _1_aspecty = renderdata.width / renderdata.height
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_renderdata.width < __pyx_v_11_glarea_es2_renderdata.height) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":409
 *     cdef float _1_aspectx, _1_aspecty #px+
 *     if renderdata.width < renderdata.height:
 *         _1_aspectx = 1.             # <<<<<<<<<<<<<<
 *         _1_aspecty = renderdata.width / renderdata.height
 *     else:
 */
    __pyx_v__1_aspectx = 1.;

    /* "_glarea_es2.pyx":410
 *     if renderdata.width < renderdata.height:
 *         _1_aspectx = 1.
 *         _1_aspecty = renderdata.width / renderdata.height             # <<<<<<<<<<<<<<
 *     else:
 *         _1_aspectx = renderdata.height / renderdata.width
 */
    if (unlikely(__pyx_v_11_glarea_es2_renderdata.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_ERR(0, 410, __pyx_L1_error)
    }
    __pyx_v__1_aspecty = (((double)__pyx_v_11_glarea_es2_renderdata.width) / ((double)__pyx_v_11_glarea_es2_renderdata.height));

    /* "_glarea_es2.pyx":408
 * 
 *     cdef float _1_aspectx, _1_aspecty #px+
 *     if renderdata.width < renderdata.height:             # <<<<<<<<<<<<<<
 *         _1_aspectx = 1.
 *         _1_aspecty = renderdata.width / renderdata.height
 */
    goto __pyx_L3;
  }

  /* "_glarea_es2.pyx":412
 *         _1_aspecty = renderdata.width / renderdata.height
 *     else:
 *         _1_aspectx = renderdata.height / renderdata.width             # <<<<<<<<<<<<<<
 *         _1_aspecty = 1.
 *     renderdata.projection_matrix[0][0] = _1_aspectx / uidata.fovy_radius_zoom
 */
  /*else*/ {
    if (unlikely(__pyx_v_11_glarea_es2_renderdata.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_ERR(0, 412, __pyx_L1_error)
    }
    __pyx_v__1_aspectx = (((double)__pyx_v_11_glarea_es2_renderdata.height) / ((double)__pyx_v_11_glarea_es2_renderdata.width));

    /* "_glarea_es2.pyx":413
 *     else:
 *         _1_aspectx = renderdata.height / renderdata.width
 *         _1_aspecty = 1.             # <<<<<<<<<<<<<<
 *     renderdata.projection_matrix[0][0] = _1_aspectx / uidata.fovy_radius_zoom
 *     renderdata.projection_matrix[1][1] = _1_aspecty / uidata.fovy_radius_zoom
 */
    __pyx_v__1_aspecty = 1.;
  }
  __pyx_L3:;

  /* "_glarea_es2.pyx":414
 *         _1_aspectx = renderdata.height / renderdata.width
 *         _1_aspecty = 1.
 *     renderdata.projection_matrix[0][0] = _1_aspectx / uidata.fovy_radius_zoom             # <<<<<<<<<<<<<<
 *     renderdata.projection_matrix[1][1] = _1_aspecty / uidata.fovy_radius_zoom
 *     renderdata.projection_matrix[2][2] = -(1/uidata.fovy_radius + 1.)
 */
  if (unlikely(__pyx_v_11_glarea_es2_uidata.fovy_radius_zoom == 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_ERR(0, 414, __pyx_L1_error)
  }
  ((__pyx_v_11_glarea_es2_renderdata.projection_matrix[0])[0]) = (__pyx_v__1_aspectx / __pyx_v_11_glarea_es2_uidata.fovy_radius_zoom);

  /* "_glarea_es2.pyx":415
 *         _1_aspecty = 1.
 *     renderdata.projection_matrix[0][0] = _1_aspectx / uidata.fovy_radius_zoom
 *     renderdata.projection_matrix[1][1] = _1_aspecty / uidata.fovy_radius_zoom             # <<<<<<<<<<<<<<
 *     renderdata.projection_matrix[2][2] = -(1/uidata.fovy_radius + 1.)
 *     renderdata.projection_matrix[3][2] = -(1/uidata.fovy_radius + 2.
 */
  if (unlikely(__pyx_v_11_glarea_es2_uidata.fovy_radius_zoom == 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_ERR(0, 415, __pyx_L1_error)
  }
  ((__pyx_v_11_glarea_es2_renderdata.projection_matrix[1])[1]) = (__pyx_v__1_aspecty / __pyx_v_11_glarea_es2_uidata.fovy_radius_zoom);

  /* "_glarea_es2.pyx":416
 *     renderdata.projection_matrix[0][0] = _1_aspectx / uidata.fovy_radius_zoom
 *     renderdata.projection_matrix[1][1] = _1_aspecty / uidata.fovy_radius_zoom
 *     renderdata.projection_matrix[2][2] = -(1/uidata.fovy_radius + 1.)             # <<<<<<<<<<<<<<
 *     renderdata.projection_matrix[3][2] = -(1/uidata.fovy_radius + 2.
 *                             ) * uidata.bounding_sphere_radius / uidata.fovy_radius
 */
  if (unlikely(__pyx_v_11_glarea_es2_uidata.fovy_radius == 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_ERR(0, 416, __pyx_L1_error)
  }
  ((__pyx_v_11_glarea_es2_renderdata.projection_matrix[2])[2]) = (-((1.0 / __pyx_v_11_glarea_es2_uidata.fovy_radius) + 1.));

  /* "_glarea_es2.pyx":417
 *     renderdata.projection_matrix[1][1] = _1_aspecty / uidata.fovy_radius_zoom
 *     renderdata.projection_matrix[2][2] = -(1/uidata.fovy_radius + 1.)
 *     renderdata.projection_matrix[3][2] = -(1/uidata.fovy_radius + 2.             # <<<<<<<<<<<<<<
 *                             ) * uidata.bounding_sphere_radius / uidata.fovy_radius
 * 
 */
  if (unlikely(__pyx_v_11_glarea_es2_uidata.fovy_radius == 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_ERR(0, 417, __pyx_L1_error)
  }

  /* "_glarea_es2.pyx":418
 *     renderdata.projection_matrix[2][2] = -(1/uidata.fovy_radius + 1.)
 *     renderdata.projection_matrix[3][2] = -(1/uidata.fovy_radius + 2.
 *                             ) * uidata.bounding_sphere_radius / uidata.fovy_radius             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  __pyx_t_2 = ((-((1.0 / __pyx_v_11_glarea_es2_uidata.fovy_radius) + 2.)) * __pyx_v_11_glarea_es2_uidata.bounding_sphere_radius);
  if (unlikely(__pyx_v_11_glarea_es2_uidata.fovy_radius == 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_ERR(0, 418, __pyx_L1_error)
  }

  /* "_glarea_es2.pyx":417
 *     renderdata.projection_matrix[1][1] = _1_aspecty / uidata.fovy_radius_zoom
 *     renderdata.projection_matrix[2][2] = -(1/uidata.fovy_radius + 1.)
 *     renderdata.projection_matrix[3][2] = -(1/uidata.fovy_radius + 2.             # <<<<<<<<<<<<<<
 *                             ) * uidata.bounding_sphere_radius / uidata.fovy_radius
 * 
 */
  ((__pyx_v_11_glarea_es2_renderdata.projection_matrix[3])[2]) = (__pyx_t_2 / ((double)__pyx_v_11_glarea_es2_uidata.fovy_radius));

  /* "_glarea_es2.pyx":370
 * 
 * ##pxm-FUNC P nogil
 * cdef void _sync_projection_matrix() nogil:             # <<<<<<<<<<<<<<
 *     # Taken from the OpenGL documentation for glFrustum:
 *     # glFrustum describes a perspective matrix that produces a perspective projection.
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("_glarea_es2._sync_projection_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}

/* "_glarea_es2.pyx":421
 * 
 * ##pxm-FUNC P nogil
 * cdef void _set_picking_matrix(int x, int y) nogil:             # <<<<<<<<<<<<<<
 *     # Set picking matrix, restrict drawing to one pixel of the viewport
 *     # same as:  _glLoadIdentity()
 */

static void __pyx_f_11_glarea_es2__set_picking_matrix(int __pyx_v_x, int __pyx_v_y) {
  int __pyx_t_1;

  /* "_glarea_es2.pyx":428
 *     #           _glTranslatef(renderdata.width - 2*x, renderdata.height - 2*y, 0.)
 *     #           _glScalef(renderdata.width, renderdata.height, 1.0)
 *     renderdata.picking_matrix[3][0] = renderdata.width - 2*x             # <<<<<<<<<<<<<<
 *     renderdata.picking_matrix[3][1] = renderdata.height - 2*y
 *     renderdata.picking_matrix[0][0] = renderdata.width
 */
  ((__pyx_v_11_glarea_es2_renderdata.picking_matrix[3])[0]) = (__pyx_v_11_glarea_es2_renderdata.width - (2 * __pyx_v_x));

  /* "_glarea_es2.pyx":429
 *     #           _glScalef(renderdata.width, renderdata.height, 1.0)
 *     renderdata.picking_matrix[3][0] = renderdata.width - 2*x
 *     renderdata.picking_matrix[3][1] = renderdata.height - 2*y             # <<<<<<<<<<<<<<
 *     renderdata.picking_matrix[0][0] = renderdata.width
 *     renderdata.picking_matrix[1][1] = renderdata.height
 */
  ((__pyx_v_11_glarea_es2_renderdata.picking_matrix[3])[1]) = (__pyx_v_11_glarea_es2_renderdata.height - (2 * __pyx_v_y));

  /* "_glarea_es2.pyx":430
 *     renderdata.picking_matrix[3][0] = renderdata.width - 2*x
 *     renderdata.picking_matrix[3][1] = renderdata.height - 2*y
 *     renderdata.picking_matrix[0][0] = renderdata.width             # <<<<<<<<<<<<<<
 *     renderdata.picking_matrix[1][1] = renderdata.height
 * 
 */
  __pyx_t_1 = __pyx_v_11_glarea_es2_renderdata.width;
  ((__pyx_v_11_glarea_es2_renderdata.picking_matrix[0])[0]) = __pyx_t_1;

  /* "_glarea_es2.pyx":431
 *     renderdata.picking_matrix[3][1] = renderdata.height - 2*y
 *     renderdata.picking_matrix[0][0] = renderdata.width
 *     renderdata.picking_matrix[1][1] = renderdata.height             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  __pyx_t_1 = __pyx_v_11_glarea_es2_renderdata.height;
  ((__pyx_v_11_glarea_es2_renderdata.picking_matrix[1])[1]) = __pyx_t_1;

  /* "_glarea_es2.pyx":421
 * 
 * ##pxm-FUNC P nogil
 * cdef void _set_picking_matrix(int x, int y) nogil:             # <<<<<<<<<<<<<<
 *     # Set picking matrix, restrict drawing to one pixel of the viewport
 *     # same as:  _glLoadIdentity()
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":434
 * 
 * ##pxm-FUNC P nogil
 * cdef void _set_picking_matrix_identity() nogil:             # <<<<<<<<<<<<<<
 *     renderdata.picking_matrix[3][0] = 0.
 *     renderdata.picking_matrix[3][1] = 0.
 */

static void __pyx_f_11_glarea_es2__set_picking_matrix_identity(void) {

  /* "_glarea_es2.pyx":435
 * ##pxm-FUNC P nogil
 * cdef void _set_picking_matrix_identity() nogil:
 *     renderdata.picking_matrix[3][0] = 0.             # <<<<<<<<<<<<<<
 *     renderdata.picking_matrix[3][1] = 0.
 *     renderdata.picking_matrix[0][0] = 1.
 */
  ((__pyx_v_11_glarea_es2_renderdata.picking_matrix[3])[0]) = 0.;

  /* "_glarea_es2.pyx":436
 * cdef void _set_picking_matrix_identity() nogil:
 *     renderdata.picking_matrix[3][0] = 0.
 *     renderdata.picking_matrix[3][1] = 0.             # <<<<<<<<<<<<<<
 *     renderdata.picking_matrix[0][0] = 1.
 *     renderdata.picking_matrix[1][1] = 1.
 */
  ((__pyx_v_11_glarea_es2_renderdata.picking_matrix[3])[1]) = 0.;

  /* "_glarea_es2.pyx":437
 *     renderdata.picking_matrix[3][0] = 0.
 *     renderdata.picking_matrix[3][1] = 0.
 *     renderdata.picking_matrix[0][0] = 1.             # <<<<<<<<<<<<<<
 *     renderdata.picking_matrix[1][1] = 1.
 * 
 */
  ((__pyx_v_11_glarea_es2_renderdata.picking_matrix[0])[0]) = 1.;

  /* "_glarea_es2.pyx":438
 *     renderdata.picking_matrix[3][1] = 0.
 *     renderdata.picking_matrix[0][0] = 1.
 *     renderdata.picking_matrix[1][1] = 1.             # <<<<<<<<<<<<<<
 * 
 * def set_frustum(bounding_sphere_radius, zoom):
 */
  ((__pyx_v_11_glarea_es2_renderdata.picking_matrix[1])[1]) = 1.;

  /* "_glarea_es2.pyx":434
 * 
 * ##pxm-FUNC P nogil
 * cdef void _set_picking_matrix_identity() nogil:             # <<<<<<<<<<<<<<
 *     renderdata.picking_matrix[3][0] = 0.
 *     renderdata.picking_matrix[3][1] = 0.
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":440
 *     renderdata.picking_matrix[1][1] = 1.
 * 
 * def set_frustum(bounding_sphere_radius, zoom):             # <<<<<<<<<<<<<<
 *     uidata.frustum_changed = True
 *     if bounding_sphere_radius > 0:
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_7set_frustum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_7set_frustum = {"set_frustum", (PyCFunction)__pyx_pw_11_glarea_es2_7set_frustum, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_11_glarea_es2_7set_frustum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bounding_sphere_radius = 0;
  PyObject *__pyx_v_zoom = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_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_ERR(0, 440, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_frustum") < 0)) __PYX_ERR(0, 440, __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_ERR(0, 440, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea_es2.set_frustum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11_glarea_es2_6set_frustum(__pyx_self, __pyx_v_bounding_sphere_radius, __pyx_v_zoom);

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

static PyObject *__pyx_pf_11_glarea_es2_6set_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;
  __Pyx_RefNannySetupContext("set_frustum", 0);

  /* "_glarea_es2.pyx":441
 * 
 * def set_frustum(bounding_sphere_radius, zoom):
 *     uidata.frustum_changed = True             # <<<<<<<<<<<<<<
 *     if bounding_sphere_radius > 0:
 *         uidata.bounding_sphere_radius = bounding_sphere_radius
 */
  __pyx_v_11_glarea_es2_uidata.frustum_changed = 1;

  /* "_glarea_es2.pyx":442
 * def set_frustum(bounding_sphere_radius, zoom):
 *     uidata.frustum_changed = True
 *     if bounding_sphere_radius > 0:             # <<<<<<<<<<<<<<
 *         uidata.bounding_sphere_radius = bounding_sphere_radius
 *     uidata.fovy_radius_zoom = uidata.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_ERR(0, 442, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "_glarea_es2.pyx":443
 *     uidata.frustum_changed = True
 *     if bounding_sphere_radius > 0:
 *         uidata.bounding_sphere_radius = bounding_sphere_radius             # <<<<<<<<<<<<<<
 *     uidata.fovy_radius_zoom = uidata.fovy_radius / zoom
 * 
 */
    __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_bounding_sphere_radius); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L1_error)
    __pyx_v_11_glarea_es2_uidata.bounding_sphere_radius = __pyx_t_3;

    /* "_glarea_es2.pyx":442
 * def set_frustum(bounding_sphere_radius, zoom):
 *     uidata.frustum_changed = True
 *     if bounding_sphere_radius > 0:             # <<<<<<<<<<<<<<
 *         uidata.bounding_sphere_radius = bounding_sphere_radius
 *     uidata.fovy_radius_zoom = uidata.fovy_radius / zoom
 */
  }

  /* "_glarea_es2.pyx":444
 *     if bounding_sphere_radius > 0:
 *         uidata.bounding_sphere_radius = bounding_sphere_radius
 *     uidata.fovy_radius_zoom = uidata.fovy_radius / zoom             # <<<<<<<<<<<<<<
 * 
 * def set_background_color(red, green, blue):
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_11_glarea_es2_uidata.fovy_radius); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __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_ERR(0, 444, __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_ERR(0, 444, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_11_glarea_es2_uidata.fovy_radius_zoom = __pyx_t_5;

  /* "_glarea_es2.pyx":440
 *     renderdata.picking_matrix[1][1] = 1.
 * 
 * def set_frustum(bounding_sphere_radius, zoom):             # <<<<<<<<<<<<<<
 *     uidata.frustum_changed = True
 *     if bounding_sphere_radius > 0:
 */

  /* 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_es2.set_frustum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":446
 *     uidata.fovy_radius_zoom = uidata.fovy_radius / zoom
 * 
 * def set_background_color(red, green, blue):             # <<<<<<<<<<<<<<
 *     uidata.background_changed = True
 *     uidata.bg_red = red
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_9set_background_color(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_9set_background_color = {"set_background_color", (PyCFunction)__pyx_pw_11_glarea_es2_9set_background_color, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_11_glarea_es2_9set_background_color(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_red = 0;
  PyObject *__pyx_v_green = 0;
  PyObject *__pyx_v_blue = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_background_color (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_red,&__pyx_n_s_green,&__pyx_n_s_blue,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_red)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_green)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_background_color", 1, 3, 3, 1); __PYX_ERR(0, 446, __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_ERR(0, 446, __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_ERR(0, 446, __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_ERR(0, 446, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea_es2.set_background_color", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11_glarea_es2_8set_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_11_glarea_es2_8set_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;
  __Pyx_RefNannySetupContext("set_background_color", 0);

  /* "_glarea_es2.pyx":447
 * 
 * def set_background_color(red, green, blue):
 *     uidata.background_changed = True             # <<<<<<<<<<<<<<
 *     uidata.bg_red = red
 *     uidata.bg_green = green
 */
  __pyx_v_11_glarea_es2_uidata.background_changed = 1;

  /* "_glarea_es2.pyx":448
 * def set_background_color(red, green, blue):
 *     uidata.background_changed = True
 *     uidata.bg_red = red             # <<<<<<<<<<<<<<
 *     uidata.bg_green = green
 *     uidata.bg_blue = blue
 */
  __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_red); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 448, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.bg_red = __pyx_t_1;

  /* "_glarea_es2.pyx":449
 *     uidata.background_changed = True
 *     uidata.bg_red = red
 *     uidata.bg_green = green             # <<<<<<<<<<<<<<
 *     uidata.bg_blue = blue
 * 
 */
  __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_green); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 449, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.bg_green = __pyx_t_1;

  /* "_glarea_es2.pyx":450
 *     uidata.bg_red = red
 *     uidata.bg_green = green
 *     uidata.bg_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_ERR(0, 450, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.bg_blue = __pyx_t_1;

  /* "_glarea_es2.pyx":446
 *     uidata.fovy_radius_zoom = uidata.fovy_radius / zoom
 * 
 * def set_background_color(red, green, blue):             # <<<<<<<<<<<<<<
 *     uidata.background_changed = True
 *     uidata.bg_red = red
 */

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

/* "_glarea_es2.pyx":452
 *     uidata.bg_blue = blue
 * 
 * def set_antialiasing(multisample):             # <<<<<<<<<<<<<<
 *     uidata.multisample_changed = 2 if multisample else 1
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_11set_antialiasing(PyObject *__pyx_self, PyObject *__pyx_v_multisample); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_11set_antialiasing = {"set_antialiasing", (PyCFunction)__pyx_pw_11_glarea_es2_11set_antialiasing, METH_O, 0};
static PyObject *__pyx_pw_11_glarea_es2_11set_antialiasing(PyObject *__pyx_self, PyObject *__pyx_v_multisample) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_antialiasing (wrapper)", 0);
  __pyx_r = __pyx_pf_11_glarea_es2_10set_antialiasing(__pyx_self, ((PyObject *)__pyx_v_multisample));

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

static PyObject *__pyx_pf_11_glarea_es2_10set_antialiasing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_multisample) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("set_antialiasing", 0);

  /* "_glarea_es2.pyx":453
 * 
 * def set_antialiasing(multisample):
 *     uidata.multisample_changed = 2 if multisample else 1             # <<<<<<<<<<<<<<
 * 
 * def set_rotation_xy(x, y):
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_multisample); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 453, __pyx_L1_error)
  if (__pyx_t_2) {
    __pyx_t_1 = 2;
  } else {
    __pyx_t_1 = 1;
  }
  __pyx_v_11_glarea_es2_uidata.multisample_changed = __pyx_t_1;

  /* "_glarea_es2.pyx":452
 *     uidata.bg_blue = blue
 * 
 * def set_antialiasing(multisample):             # <<<<<<<<<<<<<<
 *     uidata.multisample_changed = 2 if multisample else 1
 * 
 */

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

/* "_glarea_es2.pyx":455
 *     uidata.multisample_changed = 2 if multisample else 1
 * 
 * def set_rotation_xy(x, y):             # <<<<<<<<<<<<<<
 *     x %= 360
 *     # pylint: disable=C0321
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_13set_rotation_xy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_13set_rotation_xy = {"set_rotation_xy", (PyCFunction)__pyx_pw_11_glarea_es2_13set_rotation_xy, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_11_glarea_es2_13set_rotation_xy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_rotation_xy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_rotation_xy", 1, 2, 2, 1); __PYX_ERR(0, 455, __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_ERR(0, 455, __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_ERR(0, 455, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea_es2.set_rotation_xy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11_glarea_es2_12set_rotation_xy(__pyx_self, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_11_glarea_es2_12set_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;
  __Pyx_RefNannySetupContext("set_rotation_xy", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "_glarea_es2.pyx":456
 * 
 * def set_rotation_xy(x, y):
 *     x %= 360             # <<<<<<<<<<<<<<
 *     # pylint: disable=C0321
 *     if y < -120:     y = -120
 */
  __pyx_t_1 = __Pyx_PyInt_RemainderObjC(__pyx_v_x, __pyx_int_360, 0x168, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea_es2.pyx":458
 *     x %= 360
 *     # pylint: disable=C0321
 *     if y < -120:     y = -120             # <<<<<<<<<<<<<<
 *     elif y > 120:    y = 120
 *     uidata.rotation_changed = True
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_int_neg_120, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 458, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_int_neg_120);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_int_neg_120);
    goto __pyx_L3;
  }

  /* "_glarea_es2.pyx":459
 *     # pylint: disable=C0321
 *     if y < -120:     y = -120
 *     elif y > 120:    y = 120             # <<<<<<<<<<<<<<
 *     uidata.rotation_changed = True
 *     uidata.rotationxhalf = M_PI * x / 360.0
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_int_120, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 459, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {
    __Pyx_INCREF(__pyx_int_120);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_int_120);
  }
  __pyx_L3:;

  /* "_glarea_es2.pyx":460
 *     if y < -120:     y = -120
 *     elif y > 120:    y = 120
 *     uidata.rotation_changed = True             # <<<<<<<<<<<<<<
 *     uidata.rotationxhalf = M_PI * x / 360.0
 *     uidata.rotationyhalf = M_PI * y / 360.0
 */
  __pyx_v_11_glarea_es2_uidata.rotation_changed = 1;

  /* "_glarea_es2.pyx":461
 *     elif y > 120:    y = 120
 *     uidata.rotation_changed = True
 *     uidata.rotationxhalf = M_PI * x / 360.0             # <<<<<<<<<<<<<<
 *     uidata.rotationyhalf = M_PI * y / 360.0
 *     return x, y
 */
  __pyx_t_1 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __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_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_3, __pyx_float_360_0, 360.0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __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_ERR(0, 461, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_11_glarea_es2_uidata.rotationxhalf = __pyx_t_4;

  /* "_glarea_es2.pyx":462
 *     uidata.rotation_changed = True
 *     uidata.rotationxhalf = M_PI * x / 360.0
 *     uidata.rotationyhalf = M_PI * y / 360.0             # <<<<<<<<<<<<<<
 *     return x, y
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __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_ERR(0, 462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyFloat_TrueDivideObjC(__pyx_t_3, __pyx_float_360_0, 360.0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __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_ERR(0, 462, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_11_glarea_es2_uidata.rotationyhalf = __pyx_t_4;

  /* "_glarea_es2.pyx":463
 *     uidata.rotationxhalf = M_PI * x / 360.0
 *     uidata.rotationyhalf = M_PI * y / 360.0
 *     return x, y             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC PD nogil
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "_glarea_es2.pyx":455
 *     uidata.multisample_changed = 2 if multisample else 1
 * 
 * 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_es2.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_es2.pyx":466
 * 
 * ##pxm-FUNC PD nogil
 * cdef void render_resize(int y, int width, int height) nogil:             # <<<<<<<<<<<<<<
 *     renderdata.y = y
 *     renderdata.width = width
 */

static void __pyx_f_11_glarea_es2_render_resize(int __pyx_v_y, int __pyx_v_width, int __pyx_v_height) {

  /* "_glarea_es2.pyx":467
 * ##pxm-FUNC PD nogil
 * cdef void render_resize(int y, int width, int height) nogil:
 *     renderdata.y = y             # <<<<<<<<<<<<<<
 *     renderdata.width = width
 *     renderdata.height = height
 */
  __pyx_v_11_glarea_es2_renderdata.y = __pyx_v_y;

  /* "_glarea_es2.pyx":468
 * cdef void render_resize(int y, int width, int height) nogil:
 *     renderdata.y = y
 *     renderdata.width = width             # <<<<<<<<<<<<<<
 *     renderdata.height = height
 *     uidata.viewport_changed = True
 */
  __pyx_v_11_glarea_es2_renderdata.width = __pyx_v_width;

  /* "_glarea_es2.pyx":469
 *     renderdata.y = y
 *     renderdata.width = width
 *     renderdata.height = height             # <<<<<<<<<<<<<<
 *     uidata.viewport_changed = True
 * 
 */
  __pyx_v_11_glarea_es2_renderdata.height = __pyx_v_height;

  /* "_glarea_es2.pyx":470
 *     renderdata.width = width
 *     renderdata.height = height
 *     uidata.viewport_changed = True             # <<<<<<<<<<<<<<
 * 
 * def set_transformations(blocks):
 */
  __pyx_v_11_glarea_es2_uidata.viewport_changed = 1;

  /* "_glarea_es2.pyx":466
 * 
 * ##pxm-FUNC PD nogil
 * cdef void render_resize(int y, int width, int height) nogil:             # <<<<<<<<<<<<<<
 *     renderdata.y = y
 *     renderdata.width = width
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":472
 *     uidata.viewport_changed = True
 * 
 * def set_transformations(blocks):             # <<<<<<<<<<<<<<
 *     assert uidata.nblocks == len(blocks)
 *     cdef int i #px+
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_15set_transformations(PyObject *__pyx_self, PyObject *__pyx_v_blocks); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_15set_transformations = {"set_transformations", (PyCFunction)__pyx_pw_11_glarea_es2_15set_transformations, METH_O, 0};
static PyObject *__pyx_pw_11_glarea_es2_15set_transformations(PyObject *__pyx_self, PyObject *__pyx_v_blocks) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_transformations (wrapper)", 0);
  __pyx_r = __pyx_pf_11_glarea_es2_14set_transformations(__pyx_self, ((PyObject *)__pyx_v_blocks));

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

static PyObject *__pyx_pf_11_glarea_es2_14set_transformations(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_blocks) {
  int __pyx_v_i;
  short __pyx_v_b;
  CYTHON_UNUSED PyObject *__pyx_v_unused = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *(*__pyx_t_3)(PyObject *);
  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)(PyObject *);
  int __pyx_t_10;
  short __pyx_t_11;
  __Pyx_RefNannySetupContext("set_transformations", 0);

  /* "_glarea_es2.pyx":473
 * 
 * def set_transformations(blocks):
 *     assert uidata.nblocks == len(blocks)             # <<<<<<<<<<<<<<
 *     cdef int i #px+
 *     cdef short b #px+
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = PyObject_Length(__pyx_v_blocks); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 473, __pyx_L1_error)
    if (unlikely(!((__pyx_v_11_glarea_es2_uidata.nblocks == __pyx_t_1) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 473, __pyx_L1_error)
    }
  }
  #endif

  /* "_glarea_es2.pyx":476
 *     cdef int i #px+
 *     cdef short b #px+
 *     for i, b, unused in blocks:             # <<<<<<<<<<<<<<
 *         uidata.transformation_blocks[i] = b
 *     uidata.transformation_changed = True
 */
  if (likely(PyList_CheckExact(__pyx_v_blocks)) || PyTuple_CheckExact(__pyx_v_blocks)) {
    __pyx_t_2 = __pyx_v_blocks; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_blocks); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 476, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 476, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 476, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 476, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 476, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_2);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 476, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 476, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 3) < 0) __PYX_ERR(0, 476, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 476, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 476, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_11 = __Pyx_PyInt_As_short(__pyx_t_6); if (unlikely((__pyx_t_11 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 476, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_i = __pyx_t_10;
    __pyx_v_b = __pyx_t_11;
    __Pyx_XDECREF_SET(__pyx_v_unused, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "_glarea_es2.pyx":477
 *     cdef short b #px+
 *     for i, b, unused in blocks:
 *         uidata.transformation_blocks[i] = b             # <<<<<<<<<<<<<<
 *     uidata.transformation_changed = True
 * 
 */
    (__pyx_v_11_glarea_es2_uidata.transformation_blocks[__pyx_v_i]) = __pyx_v_b;

    /* "_glarea_es2.pyx":476
 *     cdef int i #px+
 *     cdef short b #px+
 *     for i, b, unused in blocks:             # <<<<<<<<<<<<<<
 *         uidata.transformation_blocks[i] = b
 *     uidata.transformation_changed = True
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":478
 *     for i, b, unused in blocks:
 *         uidata.transformation_blocks[i] = b
 *     uidata.transformation_changed = True             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P
 */
  __pyx_v_11_glarea_es2_uidata.transformation_changed = 1;

  /* "_glarea_es2.pyx":472
 *     uidata.viewport_changed = True
 * 
 * def set_transformations(blocks):             # <<<<<<<<<<<<<<
 *     assert uidata.nblocks == len(blocks)
 *     cdef int i #px+
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __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_AddTraceback("_glarea_es2.set_transformations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_unused);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":481
 * 
 * ##pxm-FUNC P
 * cpdef set_animation_start(blocks, float axisx, float axisy, float axisz):             # <<<<<<<<<<<<<<
 *     for i, (b, unused) in enumerate(blocks):
 *         uidata.animation_blocks[i] = b
 */

static PyObject *__pyx_pw_11_glarea_es2_17set_animation_start(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11_glarea_es2_set_animation_start(PyObject *__pyx_v_blocks, float __pyx_v_axisx, float __pyx_v_axisy, float __pyx_v_axisz, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_b = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_unused = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  short __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("set_animation_start", 0);

  /* "_glarea_es2.pyx":482
 * ##pxm-FUNC P
 * cpdef set_animation_start(blocks, float axisx, float axisy, float axisz):
 *     for i, (b, unused) in enumerate(blocks):             # <<<<<<<<<<<<<<
 *         uidata.animation_blocks[i] = b
 *     uidata.animation_blocks_count = i+1
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_1 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_blocks)) || PyTuple_CheckExact(__pyx_v_blocks)) {
    __pyx_t_2 = __pyx_v_blocks; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_blocks); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 482, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 482, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 482, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 482, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if !CYTHON_COMPILING_IN_PYPY
      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_ERR(0, 482, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 482, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 482, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(0, 482, __pyx_L1_error)
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 482, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_unused, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
    __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "_glarea_es2.pyx":483
 * cpdef set_animation_start(blocks, float axisx, float axisy, float axisz):
 *     for i, (b, unused) in enumerate(blocks):
 *         uidata.animation_blocks[i] = b             # <<<<<<<<<<<<<<
 *     uidata.animation_blocks_count = i+1
 *     uidata.angle = 0.0
 */
    __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_v_b); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L1_error)
    (__pyx_v_11_glarea_es2_uidata.animation_blocks[__pyx_t_11]) = __pyx_t_10;

    /* "_glarea_es2.pyx":482
 * ##pxm-FUNC P
 * cpdef set_animation_start(blocks, float axisx, float axisy, float axisz):
 *     for i, (b, unused) in enumerate(blocks):             # <<<<<<<<<<<<<<
 *         uidata.animation_blocks[i] = b
 *     uidata.animation_blocks_count = i+1
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_glarea_es2.pyx":484
 *     for i, (b, unused) in enumerate(blocks):
 *         uidata.animation_blocks[i] = b
 *     uidata.animation_blocks_count = i+1             # <<<<<<<<<<<<<<
 *     uidata.angle = 0.0
 *     uidata.rotation_x = axisx
 */
  if (unlikely(!__pyx_v_i)) { __Pyx_RaiseUnboundLocalError("i"); __PYX_ERR(0, 484, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 484, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_11_glarea_es2_uidata.animation_blocks_count = __pyx_t_12;

  /* "_glarea_es2.pyx":485
 *         uidata.animation_blocks[i] = b
 *     uidata.animation_blocks_count = i+1
 *     uidata.angle = 0.0             # <<<<<<<<<<<<<<
 *     uidata.rotation_x = axisx
 *     uidata.rotation_y = axisy
 */
  __pyx_v_11_glarea_es2_uidata.angle = 0.0;

  /* "_glarea_es2.pyx":486
 *     uidata.animation_blocks_count = i+1
 *     uidata.angle = 0.0
 *     uidata.rotation_x = axisx             # <<<<<<<<<<<<<<
 *     uidata.rotation_y = axisy
 *     uidata.rotation_z = axisz
 */
  __pyx_v_11_glarea_es2_uidata.rotation_x = __pyx_v_axisx;

  /* "_glarea_es2.pyx":487
 *     uidata.angle = 0.0
 *     uidata.rotation_x = axisx
 *     uidata.rotation_y = axisy             # <<<<<<<<<<<<<<
 *     uidata.rotation_z = axisz
 *     uidata.animation_changed = 1
 */
  __pyx_v_11_glarea_es2_uidata.rotation_y = __pyx_v_axisy;

  /* "_glarea_es2.pyx":488
 *     uidata.rotation_x = axisx
 *     uidata.rotation_y = axisy
 *     uidata.rotation_z = axisz             # <<<<<<<<<<<<<<
 *     uidata.animation_changed = 1
 * 
 */
  __pyx_v_11_glarea_es2_uidata.rotation_z = __pyx_v_axisz;

  /* "_glarea_es2.pyx":489
 *     uidata.rotation_y = axisy
 *     uidata.rotation_z = axisz
 *     uidata.animation_changed = 1             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC PD
 */
  __pyx_v_11_glarea_es2_uidata.animation_changed = 1;

  /* "_glarea_es2.pyx":481
 * 
 * ##pxm-FUNC P
 * cpdef set_animation_start(blocks, float axisx, float axisy, float axisz):             # <<<<<<<<<<<<<<
 *     for i, (b, unused) in enumerate(blocks):
 *         uidata.animation_blocks[i] = b
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("_glarea_es2.set_animation_start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_unused);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_17set_animation_start(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11_glarea_es2_17set_animation_start(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_blocks = 0;
  float __pyx_v_axisx;
  float __pyx_v_axisy;
  float __pyx_v_axisz;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_animation_start (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_blocks,&__pyx_n_s_axisx,&__pyx_n_s_axisy,&__pyx_n_s_axisz,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_blocks)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_axisx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_animation_start", 1, 4, 4, 1); __PYX_ERR(0, 481, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_axisy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_animation_start", 1, 4, 4, 2); __PYX_ERR(0, 481, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_axisz)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_animation_start", 1, 4, 4, 3); __PYX_ERR(0, 481, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_animation_start") < 0)) __PYX_ERR(0, 481, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      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);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_blocks = values[0];
    __pyx_v_axisx = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_axisx == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 481, __pyx_L3_error)
    __pyx_v_axisy = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_axisy == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 481, __pyx_L3_error)
    __pyx_v_axisz = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_axisz == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 481, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_animation_start", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 481, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea_es2.set_animation_start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11_glarea_es2_16set_animation_start(__pyx_self, __pyx_v_blocks, __pyx_v_axisx, __pyx_v_axisy, __pyx_v_axisz);

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

static PyObject *__pyx_pf_11_glarea_es2_16set_animation_start(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_blocks, float __pyx_v_axisx, float __pyx_v_axisy, float __pyx_v_axisz) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("set_animation_start", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11_glarea_es2_set_animation_start(__pyx_v_blocks, __pyx_v_axisx, __pyx_v_axisy, __pyx_v_axisz, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __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_es2.set_animation_start", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":492
 * 
 * ##pxm-FUNC PD
 * cdef void set_animation_next(float angle):             # <<<<<<<<<<<<<<
 *     uidata.angle = -angle
 *     uidata.animation_changed = 2
 */

static void __pyx_f_11_glarea_es2_set_animation_next(float __pyx_v_angle) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_animation_next", 0);

  /* "_glarea_es2.pyx":493
 * ##pxm-FUNC PD
 * cdef void set_animation_next(float angle):
 *     uidata.angle = -angle             # <<<<<<<<<<<<<<
 *     uidata.animation_changed = 2
 * 
 */
  __pyx_v_11_glarea_es2_uidata.angle = (-__pyx_v_angle);

  /* "_glarea_es2.pyx":494
 * cdef void set_animation_next(float angle):
 *     uidata.angle = -angle
 *     uidata.animation_changed = 2             # <<<<<<<<<<<<<<
 * 
 * def set_data(nblocks, vertexdata, vertexpointers, vertexinfo, transformations):
 */
  __pyx_v_11_glarea_es2_uidata.animation_changed = 2;

  /* "_glarea_es2.pyx":492
 * 
 * ##pxm-FUNC PD
 * cdef void set_animation_next(float angle):             # <<<<<<<<<<<<<<
 *     uidata.angle = -angle
 *     uidata.animation_changed = 2
 */

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

/* "_glarea_es2.pyx":496
 *     uidata.animation_changed = 2
 * 
 * def set_data(nblocks, vertexdata, vertexpointers, vertexinfo, transformations):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     cdef int t,i,j #px+
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_19set_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_19set_data = {"set_data", (PyCFunction)__pyx_pw_11_glarea_es2_19set_data, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_11_glarea_es2_19set_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nblocks = 0;
  PyObject *__pyx_v_vertexdata = 0;
  PyObject *__pyx_v_vertexpointers = 0;
  PyObject *__pyx_v_vertexinfo = 0;
  PyObject *__pyx_v_transformations = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_data (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nblocks,&__pyx_n_s_vertexdata,&__pyx_n_s_vertexpointers,&__pyx_n_s_vertexinfo,&__pyx_n_s_transformations,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nblocks)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vertexdata)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_data", 1, 5, 5, 1); __PYX_ERR(0, 496, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vertexpointers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_data", 1, 5, 5, 2); __PYX_ERR(0, 496, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_vertexinfo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_data", 1, 5, 5, 3); __PYX_ERR(0, 496, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transformations)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_data", 1, 5, 5, 4); __PYX_ERR(0, 496, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_data") < 0)) __PYX_ERR(0, 496, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      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);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_nblocks = values[0];
    __pyx_v_vertexdata = values[1];
    __pyx_v_vertexpointers = values[2];
    __pyx_v_vertexinfo = values[3];
    __pyx_v_transformations = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_data", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 496, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea_es2.set_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11_glarea_es2_18set_data(__pyx_self, __pyx_v_nblocks, __pyx_v_vertexdata, __pyx_v_vertexpointers, __pyx_v_vertexinfo, __pyx_v_transformations);

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

static PyObject *__pyx_pf_11_glarea_es2_18set_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_nblocks, PyObject *__pyx_v_vertexdata, PyObject *__pyx_v_vertexpointers, PyObject *__pyx_v_vertexinfo, PyObject *__pyx_v_transformations) {
  int __pyx_v_t;
  int __pyx_v_i;
  int __pyx_v_j;
  PyObject *__pyx_v_cnts_block = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  char *__pyx_t_7;
  long __pyx_t_8;
  long __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *(*__pyx_t_12)(PyObject *);
  int __pyx_t_13;
  int __pyx_t_14;
  short __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  int __pyx_t_17;
  double __pyx_t_18;
  __Pyx_RefNannySetupContext("set_data", 0);

  /* "_glarea_es2.pyx":497
 * 
 * def set_data(nblocks, vertexdata, vertexpointers, vertexinfo, transformations):
 *     pydata_postsync()             # <<<<<<<<<<<<<<
 *     cdef int t,i,j #px+
 *     assert nblocks <= gldraw.MAX_BLOCKS, (nblocks, gldraw.MAX_BLOCKS)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydata_postsync); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __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_es2.pyx":499
 *     pydata_postsync()
 *     cdef int t,i,j #px+
 *     assert nblocks <= gldraw.MAX_BLOCKS, (nblocks, gldraw.MAX_BLOCKS)             # <<<<<<<<<<<<<<
 *     uidata.nblocks = nblocks
 *     pydata['vertexdata'] = vertexdata
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_e_11_gldraw_es2_MAX_BLOCKS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_nblocks, __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 499, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_4)) {
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_e_11_gldraw_es2_MAX_BLOCKS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_nblocks);
      __Pyx_GIVEREF(__pyx_v_nblocks);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_nblocks);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_Pack(1, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 499, __pyx_L1_error)
    }
  }
  #endif

  /* "_glarea_es2.pyx":500
 *     cdef int t,i,j #px+
 *     assert nblocks <= gldraw.MAX_BLOCKS, (nblocks, gldraw.MAX_BLOCKS)
 *     uidata.nblocks = nblocks             # <<<<<<<<<<<<<<
 *     pydata['vertexdata'] = vertexdata
 *     uidata.vertexdatalen = len(vertexdata)
 */
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_nblocks); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 500, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.nblocks = __pyx_t_5;

  /* "_glarea_es2.pyx":501
 *     assert nblocks <= gldraw.MAX_BLOCKS, (nblocks, gldraw.MAX_BLOCKS)
 *     uidata.nblocks = nblocks
 *     pydata['vertexdata'] = vertexdata             # <<<<<<<<<<<<<<
 *     uidata.vertexdatalen = len(vertexdata)
 *     uidata.vertexdata = vertexdata
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_u_vertexdata, __pyx_v_vertexdata) < 0)) __PYX_ERR(0, 501, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":502
 *     uidata.nblocks = nblocks
 *     pydata['vertexdata'] = vertexdata
 *     uidata.vertexdatalen = len(vertexdata)             # <<<<<<<<<<<<<<
 *     uidata.vertexdata = vertexdata
 *     assert len(vertexpointers) == gldraw.ATTRIB_CNT-1
 */
  __pyx_t_6 = PyObject_Length(__pyx_v_vertexdata); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 502, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.vertexdatalen = __pyx_t_6;

  /* "_glarea_es2.pyx":503
 *     pydata['vertexdata'] = vertexdata
 *     uidata.vertexdatalen = len(vertexdata)
 *     uidata.vertexdata = vertexdata             # <<<<<<<<<<<<<<
 *     assert len(vertexpointers) == gldraw.ATTRIB_CNT-1
 *     for i in range(gldraw.ATTRIB_CNT-1):
 */
  __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_vertexdata); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 503, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.vertexdata = __pyx_t_7;

  /* "_glarea_es2.pyx":504
 *     uidata.vertexdatalen = len(vertexdata)
 *     uidata.vertexdata = vertexdata
 *     assert len(vertexpointers) == gldraw.ATTRIB_CNT-1             # <<<<<<<<<<<<<<
 *     for i in range(gldraw.ATTRIB_CNT-1):
 *         uidata.vertexpointers[i] = vertexpointers[i]
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_6 = PyObject_Length(__pyx_v_vertexpointers); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 504, __pyx_L1_error)
    if (unlikely(!((__pyx_t_6 == (__pyx_e_11_gldraw_es2_ATTRIB_CNT - 1)) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 504, __pyx_L1_error)
    }
  }
  #endif

  /* "_glarea_es2.pyx":505
 *     uidata.vertexdata = vertexdata
 *     assert len(vertexpointers) == gldraw.ATTRIB_CNT-1
 *     for i in range(gldraw.ATTRIB_CNT-1):             # <<<<<<<<<<<<<<
 *         uidata.vertexpointers[i] = vertexpointers[i]
 *     cnts_block, uidata.idx_debug, uidata.cnt_debug, uidata.cnt_pick = vertexinfo
 */
  __pyx_t_8 = (__pyx_e_11_gldraw_es2_ATTRIB_CNT - 1);
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_8; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "_glarea_es2.pyx":506
 *     assert len(vertexpointers) == gldraw.ATTRIB_CNT-1
 *     for i in range(gldraw.ATTRIB_CNT-1):
 *         uidata.vertexpointers[i] = vertexpointers[i]             # <<<<<<<<<<<<<<
 *     cnts_block, uidata.idx_debug, uidata.cnt_debug, uidata.cnt_pick = vertexinfo
 *     assert len(cnts_block) == nblocks
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_vertexpointers, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyInt_As_long(__pyx_t_2); if (unlikely((__pyx_t_9 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    (__pyx_v_11_glarea_es2_uidata.vertexpointers[__pyx_v_i]) = __pyx_t_9;
  }

  /* "_glarea_es2.pyx":507
 *     for i in range(gldraw.ATTRIB_CNT-1):
 *         uidata.vertexpointers[i] = vertexpointers[i]
 *     cnts_block, uidata.idx_debug, uidata.cnt_debug, uidata.cnt_pick = vertexinfo             # <<<<<<<<<<<<<<
 *     assert len(cnts_block) == nblocks
 *     for i in range(nblocks):
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_vertexinfo))) || (PyList_CheckExact(__pyx_v_vertexinfo))) {
    PyObject* sequence = __pyx_v_vertexinfo;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 507, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_10 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_10);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_1,&__pyx_t_3,&__pyx_t_10};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 507, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_1,&__pyx_t_3,&__pyx_t_10};
    __pyx_t_11 = PyObject_GetIter(__pyx_v_vertexinfo); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_12(__pyx_t_11); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 4) < 0) __PYX_ERR(0, 507, __pyx_L1_error)
    __pyx_t_12 = NULL;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_12 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 507, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 507, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 507, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 507, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_v_cnts_block = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_11_glarea_es2_uidata.idx_debug = __pyx_t_5;
  __pyx_v_11_glarea_es2_uidata.cnt_debug = __pyx_t_13;
  __pyx_v_11_glarea_es2_uidata.cnt_pick = __pyx_t_14;

  /* "_glarea_es2.pyx":508
 *         uidata.vertexpointers[i] = vertexpointers[i]
 *     cnts_block, uidata.idx_debug, uidata.cnt_debug, uidata.cnt_pick = vertexinfo
 *     assert len(cnts_block) == nblocks             # <<<<<<<<<<<<<<
 *     for i in range(nblocks):
 *         uidata.cnts_block[i] = cnts_block[i]
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_6 = PyObject_Length(__pyx_v_cnts_block); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 508, __pyx_L1_error)
    __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_10, __pyx_v_nblocks, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 508, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_4)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 508, __pyx_L1_error)
    }
  }
  #endif

  /* "_glarea_es2.pyx":509
 *     cnts_block, uidata.idx_debug, uidata.cnt_debug, uidata.cnt_pick = vertexinfo
 *     assert len(cnts_block) == nblocks
 *     for i in range(nblocks):             # <<<<<<<<<<<<<<
 *         uidata.cnts_block[i] = cnts_block[i]
 *     assert len(transformations) <= gldraw.MAX_TRANSFORMATIONS, len(transformations)
 */
  __pyx_t_8 = __Pyx_PyInt_As_long(__pyx_v_nblocks); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 509, __pyx_L1_error)
  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_8; __pyx_t_14+=1) {
    __pyx_v_i = __pyx_t_14;

    /* "_glarea_es2.pyx":510
 *     assert len(cnts_block) == nblocks
 *     for i in range(nblocks):
 *         uidata.cnts_block[i] = cnts_block[i]             # <<<<<<<<<<<<<<
 *     assert len(transformations) <= gldraw.MAX_TRANSFORMATIONS, len(transformations)
 *     uidata.transformations_count = len(transformations)
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_cnts_block, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_15 == (short)-1) && PyErr_Occurred())) __PYX_ERR(0, 510, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    (__pyx_v_11_glarea_es2_uidata.cnts_block[__pyx_v_i]) = __pyx_t_15;
  }

  /* "_glarea_es2.pyx":511
 *     for i in range(nblocks):
 *         uidata.cnts_block[i] = cnts_block[i]
 *     assert len(transformations) <= gldraw.MAX_TRANSFORMATIONS, len(transformations)             # <<<<<<<<<<<<<<
 *     uidata.transformations_count = len(transformations)
 *     for t in range(uidata.transformations_count):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_6 = PyObject_Length(__pyx_v_transformations); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 511, __pyx_L1_error)
    if (unlikely(!((__pyx_t_6 <= __pyx_e_11_gldraw_es2_MAX_TRANSFORMATIONS) != 0))) {
      __pyx_t_16 = PyObject_Length(__pyx_v_transformations); if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 511, __pyx_L1_error)
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 511, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_10);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(0, 511, __pyx_L1_error)
    }
  }
  #endif

  /* "_glarea_es2.pyx":512
 *         uidata.cnts_block[i] = cnts_block[i]
 *     assert len(transformations) <= gldraw.MAX_TRANSFORMATIONS, len(transformations)
 *     uidata.transformations_count = len(transformations)             # <<<<<<<<<<<<<<
 *     for t in range(uidata.transformations_count):
 *         for i in range(4):
 */
  __pyx_t_6 = PyObject_Length(__pyx_v_transformations); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 512, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.transformations_count = __pyx_t_6;

  /* "_glarea_es2.pyx":513
 *     assert len(transformations) <= gldraw.MAX_TRANSFORMATIONS, len(transformations)
 *     uidata.transformations_count = len(transformations)
 *     for t in range(uidata.transformations_count):             # <<<<<<<<<<<<<<
 *         for i in range(4):
 *             for j in range(4):
 */
  __pyx_t_14 = __pyx_v_11_glarea_es2_uidata.transformations_count;
  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) {
    __pyx_v_t = __pyx_t_13;

    /* "_glarea_es2.pyx":514
 *     uidata.transformations_count = len(transformations)
 *     for t in range(uidata.transformations_count):
 *         for i in range(4):             # <<<<<<<<<<<<<<
 *             for j in range(4):
 *                 uidata.transformations[t][i][j] = float(transformations[t][i][j])
 */
    for (__pyx_t_5 = 0; __pyx_t_5 < 4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "_glarea_es2.pyx":515
 *     for t in range(uidata.transformations_count):
 *         for i in range(4):
 *             for j in range(4):             # <<<<<<<<<<<<<<
 *                 uidata.transformations[t][i][j] = float(transformations[t][i][j])
 *     uidata.data_changed = True
 */
      for (__pyx_t_17 = 0; __pyx_t_17 < 4; __pyx_t_17+=1) {
        __pyx_v_j = __pyx_t_17;

        /* "_glarea_es2.pyx":516
 *         for i in range(4):
 *             for j in range(4):
 *                 uidata.transformations[t][i][j] = float(transformations[t][i][j])             # <<<<<<<<<<<<<<
 *     uidata.data_changed = True
 * 
 */
        __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_transformations, __pyx_v_t, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 516, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_10, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_j, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 516, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_18 = __Pyx_PyObject_AsDouble(__pyx_t_10); if (unlikely(__pyx_t_18 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 516, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        (((__pyx_v_11_glarea_es2_uidata.transformations[__pyx_v_t])[__pyx_v_i])[__pyx_v_j]) = __pyx_t_18;
      }
    }
  }

  /* "_glarea_es2.pyx":517
 *             for j in range(4):
 *                 uidata.transformations[t][i][j] = float(transformations[t][i][j])
 *     uidata.data_changed = True             # <<<<<<<<<<<<<<
 * 
 * def pydata_postsync():
 */
  __pyx_v_11_glarea_es2_uidata.data_changed = 1;

  /* "_glarea_es2.pyx":496
 *     uidata.animation_changed = 2
 * 
 * def set_data(nblocks, vertexdata, vertexpointers, vertexinfo, transformations):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     cdef int t,i,j #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_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("_glarea_es2.set_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cnts_block);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":519
 *     uidata.data_changed = True
 * 
 * def pydata_postsync():             # <<<<<<<<<<<<<<
 *     global pydata_backed
 *     if uidata.synced:
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_21pydata_postsync(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_21pydata_postsync = {"pydata_postsync", (PyCFunction)__pyx_pw_11_glarea_es2_21pydata_postsync, METH_NOARGS, 0};
static PyObject *__pyx_pw_11_glarea_es2_21pydata_postsync(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pydata_postsync (wrapper)", 0);
  __pyx_r = __pyx_pf_11_glarea_es2_20pydata_postsync(__pyx_self);

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

static PyObject *__pyx_pf_11_glarea_es2_20pydata_postsync(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("pydata_postsync", 0);

  /* "_glarea_es2.pyx":521
 * def pydata_postsync():
 *     global pydata_backed
 *     if uidata.synced:             # <<<<<<<<<<<<<<
 *         pydata_backed = dict(pydata)
 *         uidata.synced = False
 */
  __pyx_t_1 = (__pyx_v_11_glarea_es2_uidata.synced != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":522
 *     global pydata_backed
 *     if uidata.synced:
 *         pydata_backed = dict(pydata)             # <<<<<<<<<<<<<<
 *         uidata.synced = False
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyDict_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_pydata_backed, __pyx_t_2) < 0) __PYX_ERR(0, 522, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "_glarea_es2.pyx":523
 *     if uidata.synced:
 *         pydata_backed = dict(pydata)
 *         uidata.synced = False             # <<<<<<<<<<<<<<
 * 
 * def update_shader_version(shader_src):
 */
    __pyx_v_11_glarea_es2_uidata.synced = 0;

    /* "_glarea_es2.pyx":521
 * def pydata_postsync():
 *     global pydata_backed
 *     if uidata.synced:             # <<<<<<<<<<<<<<
 *         pydata_backed = dict(pydata)
 *         uidata.synced = False
 */
  }

  /* "_glarea_es2.pyx":519
 *     uidata.data_changed = True
 * 
 * def pydata_postsync():             # <<<<<<<<<<<<<<
 *     global pydata_backed
 *     if uidata.synced:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("_glarea_es2.pydata_postsync", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":525
 *         uidata.synced = False
 * 
 * def update_shader_version(shader_src):             # <<<<<<<<<<<<<<
 *     assert shader_src.startswith(b'#version 120\n')
 *     IF 'es2' == 'es2': #px/
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_23update_shader_version(PyObject *__pyx_self, PyObject *__pyx_v_shader_src); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_23update_shader_version = {"update_shader_version", (PyCFunction)__pyx_pw_11_glarea_es2_23update_shader_version, METH_O, 0};
static PyObject *__pyx_pw_11_glarea_es2_23update_shader_version(PyObject *__pyx_self, PyObject *__pyx_v_shader_src) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_shader_version (wrapper)", 0);
  __pyx_r = __pyx_pf_11_glarea_es2_22update_shader_version(__pyx_self, ((PyObject *)__pyx_v_shader_src));

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

static PyObject *__pyx_pf_11_glarea_es2_22update_shader_version(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_shader_src) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("update_shader_version", 0);
  __Pyx_INCREF(__pyx_v_shader_src);

  /* "_glarea_es2.pyx":526
 * 
 * def update_shader_version(shader_src):
 *     assert shader_src.startswith(b'#version 120\n')             # <<<<<<<<<<<<<<
 *     IF 'es2' == 'es2': #px/
 *     #if False:
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_shader_src, __pyx_n_s_startswith); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(0, 526, __pyx_L1_error)
    }
  }
  #endif

  /* "_glarea_es2.pyx":529
 *     IF 'es2' == 'es2': #px/
 *     #if False:
 *         shader_src = b'#version 100\n' + shader_src.split(b'\n', 1)[1]             # <<<<<<<<<<<<<<
 *     return shader_src
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_shader_src, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_kp_b_version_100, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_shader_src, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea_es2.pyx":530
 *     #if False:
 *         shader_src = b'#version 100\n' + shader_src.split(b'\n', 1)[1]
 *     return shader_src             # <<<<<<<<<<<<<<
 * 
 * def set_shaders(shader_vertsrc, shader_fragsrc):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_shader_src);
  __pyx_r = __pyx_v_shader_src;
  goto __pyx_L0;

  /* "_glarea_es2.pyx":525
 *         uidata.synced = False
 * 
 * def update_shader_version(shader_src):             # <<<<<<<<<<<<<<
 *     assert shader_src.startswith(b'#version 120\n')
 *     IF 'es2' == 'es2': #px/
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("_glarea_es2.update_shader_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_shader_src);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":532
 *     return shader_src
 * 
 * def set_shaders(shader_vertsrc, shader_fragsrc):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     shader_vertsrc = update_shader_version(shader_vertsrc)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_25set_shaders(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_25set_shaders = {"set_shaders", (PyCFunction)__pyx_pw_11_glarea_es2_25set_shaders, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_11_glarea_es2_25set_shaders(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_shader_vertsrc = 0;
  PyObject *__pyx_v_shader_fragsrc = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_shaders (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shader_vertsrc,&__pyx_n_s_shader_fragsrc,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_shader_vertsrc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shader_fragsrc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_shaders", 1, 2, 2, 1); __PYX_ERR(0, 532, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_shaders") < 0)) __PYX_ERR(0, 532, __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_shader_vertsrc = values[0];
    __pyx_v_shader_fragsrc = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_shaders", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 532, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea_es2.set_shaders", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11_glarea_es2_24set_shaders(__pyx_self, __pyx_v_shader_vertsrc, __pyx_v_shader_fragsrc);

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

static PyObject *__pyx_pf_11_glarea_es2_24set_shaders(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_shader_vertsrc, PyObject *__pyx_v_shader_fragsrc) {
  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;
  char *__pyx_t_5;
  __Pyx_RefNannySetupContext("set_shaders", 0);
  __Pyx_INCREF(__pyx_v_shader_vertsrc);
  __Pyx_INCREF(__pyx_v_shader_fragsrc);

  /* "_glarea_es2.pyx":533
 * 
 * def set_shaders(shader_vertsrc, shader_fragsrc):
 *     pydata_postsync()             # <<<<<<<<<<<<<<
 *     shader_vertsrc = update_shader_version(shader_vertsrc)
 *     shader_fragsrc = update_shader_version(shader_fragsrc)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydata_postsync); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 533, __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_es2.pyx":534
 * def set_shaders(shader_vertsrc, shader_fragsrc):
 *     pydata_postsync()
 *     shader_vertsrc = update_shader_version(shader_vertsrc)             # <<<<<<<<<<<<<<
 *     shader_fragsrc = update_shader_version(shader_fragsrc)
 *     pydata['shader_vertsrc'] = shader_vertsrc
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_update_shader_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_shader_vertsrc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_shader_vertsrc};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_shader_vertsrc};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_shader_vertsrc);
      __Pyx_GIVEREF(__pyx_v_shader_vertsrc);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_shader_vertsrc);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_shader_vertsrc, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea_es2.pyx":535
 *     pydata_postsync()
 *     shader_vertsrc = update_shader_version(shader_vertsrc)
 *     shader_fragsrc = update_shader_version(shader_fragsrc)             # <<<<<<<<<<<<<<
 *     pydata['shader_vertsrc'] = shader_vertsrc
 *     uidata.shader_vertsrc = shader_vertsrc
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_update_shader_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_shader_fragsrc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_shader_fragsrc};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_shader_fragsrc};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 535, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_shader_fragsrc);
      __Pyx_GIVEREF(__pyx_v_shader_fragsrc);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_shader_fragsrc);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 535, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_shader_fragsrc, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea_es2.pyx":536
 *     shader_vertsrc = update_shader_version(shader_vertsrc)
 *     shader_fragsrc = update_shader_version(shader_fragsrc)
 *     pydata['shader_vertsrc'] = shader_vertsrc             # <<<<<<<<<<<<<<
 *     uidata.shader_vertsrc = shader_vertsrc
 *     pydata['shader_fragsrc'] = shader_fragsrc
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydata); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_u_shader_vertsrc, __pyx_v_shader_vertsrc) < 0)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_glarea_es2.pyx":537
 *     shader_fragsrc = update_shader_version(shader_fragsrc)
 *     pydata['shader_vertsrc'] = shader_vertsrc
 *     uidata.shader_vertsrc = shader_vertsrc             # <<<<<<<<<<<<<<
 *     pydata['shader_fragsrc'] = shader_fragsrc
 *     uidata.shader_fragsrc = shader_fragsrc
 */
  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_shader_vertsrc); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 537, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.shader_vertsrc = __pyx_t_5;

  /* "_glarea_es2.pyx":538
 *     pydata['shader_vertsrc'] = shader_vertsrc
 *     uidata.shader_vertsrc = shader_vertsrc
 *     pydata['shader_fragsrc'] = shader_fragsrc             # <<<<<<<<<<<<<<
 *     uidata.shader_fragsrc = shader_fragsrc
 *     uidata.shaders_changed = True
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydata); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_u_shader_fragsrc, __pyx_v_shader_fragsrc) < 0)) __PYX_ERR(0, 538, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_glarea_es2.pyx":539
 *     uidata.shader_vertsrc = shader_vertsrc
 *     pydata['shader_fragsrc'] = shader_fragsrc
 *     uidata.shader_fragsrc = shader_fragsrc             # <<<<<<<<<<<<<<
 *     uidata.shaders_changed = True
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_shader_fragsrc); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 539, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.shader_fragsrc = __pyx_t_5;

  /* "_glarea_es2.pyx":540
 *     pydata['shader_fragsrc'] = shader_fragsrc
 *     uidata.shader_fragsrc = shader_fragsrc
 *     uidata.shaders_changed = True             # <<<<<<<<<<<<<<
 * 
 * def set_fixedshaders(fixedshaders):
 */
  __pyx_v_11_glarea_es2_uidata.shaders_changed = 1;

  /* "_glarea_es2.pyx":532
 *     return shader_src
 * 
 * def set_shaders(shader_vertsrc, shader_fragsrc):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     shader_vertsrc = update_shader_version(shader_vertsrc)
 */

  /* 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_es2.set_shaders", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_shader_vertsrc);
  __Pyx_XDECREF(__pyx_v_shader_fragsrc);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":542
 *     uidata.shaders_changed = True
 * 
 * def set_fixedshaders(fixedshaders):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     fixedshaders = [update_shader_version(s) for s in fixedshaders]
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_27set_fixedshaders(PyObject *__pyx_self, PyObject *__pyx_v_fixedshaders); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_27set_fixedshaders = {"set_fixedshaders", (PyCFunction)__pyx_pw_11_glarea_es2_27set_fixedshaders, METH_O, 0};
static PyObject *__pyx_pw_11_glarea_es2_27set_fixedshaders(PyObject *__pyx_self, PyObject *__pyx_v_fixedshaders) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_fixedshaders (wrapper)", 0);
  __pyx_r = __pyx_pf_11_glarea_es2_26set_fixedshaders(__pyx_self, ((PyObject *)__pyx_v_fixedshaders));

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

static PyObject *__pyx_pf_11_glarea_es2_26set_fixedshaders(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fixedshaders) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  char *__pyx_t_9;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("set_fixedshaders", 0);
  __Pyx_INCREF(__pyx_v_fixedshaders);

  /* "_glarea_es2.pyx":543
 * 
 * def set_fixedshaders(fixedshaders):
 *     pydata_postsync()             # <<<<<<<<<<<<<<
 *     fixedshaders = [update_shader_version(s) for s in fixedshaders]
 *     pydata['fixedshaders'] = fixedshaders
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydata_postsync); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __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_es2.pyx":544
 * def set_fixedshaders(fixedshaders):
 *     pydata_postsync()
 *     fixedshaders = [update_shader_version(s) for s in fixedshaders]             # <<<<<<<<<<<<<<
 *     pydata['fixedshaders'] = fixedshaders
 *     uidata.pick_vertsrc = fixedshaders[0]
 */
  { /* enter inner scope */
    PyObject *__pyx_7genexpr__pyx_v_s = NULL;
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 544, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_v_fixedshaders)) || PyTuple_CheckExact(__pyx_v_fixedshaders)) {
      __pyx_t_2 = __pyx_v_fixedshaders; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_fixedshaders); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 544, __pyx_L5_error)
    }
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 544, __pyx_L5_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 544, __pyx_L5_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_5(__pyx_t_2);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 544, __pyx_L5_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_s, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_update_shader_version); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 544, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (!__pyx_t_7) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_7genexpr__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_7genexpr__pyx_v_s};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L5_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_7genexpr__pyx_v_s};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L5_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 544, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
          __Pyx_INCREF(__pyx_7genexpr__pyx_v_s);
          __Pyx_GIVEREF(__pyx_7genexpr__pyx_v_s);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_7genexpr__pyx_v_s);
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L5_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 544, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_s);
    goto __pyx_L8_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_7genexpr__pyx_v_s);
    goto __pyx_L1_error;
    __pyx_L8_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_fixedshaders, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "_glarea_es2.pyx":545
 *     pydata_postsync()
 *     fixedshaders = [update_shader_version(s) for s in fixedshaders]
 *     pydata['fixedshaders'] = fixedshaders             # <<<<<<<<<<<<<<
 *     uidata.pick_vertsrc = fixedshaders[0]
 *     uidata.pick_fragsrc = fixedshaders[1]
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pydata); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_n_u_fixedshaders, __pyx_v_fixedshaders) < 0)) __PYX_ERR(0, 545, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_glarea_es2.pyx":546
 *     fixedshaders = [update_shader_version(s) for s in fixedshaders]
 *     pydata['fixedshaders'] = fixedshaders
 *     uidata.pick_vertsrc = fixedshaders[0]             # <<<<<<<<<<<<<<
 *     uidata.pick_fragsrc = fixedshaders[1]
 *     if debug & DEBUG_DRAW:
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fixedshaders, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 546, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.pick_vertsrc = __pyx_t_9;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_glarea_es2.pyx":547
 *     pydata['fixedshaders'] = fixedshaders
 *     uidata.pick_vertsrc = fixedshaders[0]
 *     uidata.pick_fragsrc = fixedshaders[1]             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_DRAW:
 *         uidata.hud_vertsrc = fixedshaders[2]
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fixedshaders, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 547, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.pick_fragsrc = __pyx_t_9;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "_glarea_es2.pyx":548
 *     uidata.pick_vertsrc = fixedshaders[0]
 *     uidata.pick_fragsrc = fixedshaders[1]
 *     if debug & DEBUG_DRAW:             # <<<<<<<<<<<<<<
 *         uidata.hud_vertsrc = fixedshaders[2]
 *         uidata.hud_fragsrc = fixedshaders[1]
 */
  __pyx_t_10 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_DRAW) != 0);
  if (__pyx_t_10) {

    /* "_glarea_es2.pyx":549
 *     uidata.pick_fragsrc = fixedshaders[1]
 *     if debug & DEBUG_DRAW:
 *         uidata.hud_vertsrc = fixedshaders[2]             # <<<<<<<<<<<<<<
 *         uidata.hud_fragsrc = fixedshaders[1]
 * 
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fixedshaders, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 549, __pyx_L1_error)
    __pyx_v_11_glarea_es2_uidata.hud_vertsrc = __pyx_t_9;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea_es2.pyx":550
 *     if debug & DEBUG_DRAW:
 *         uidata.hud_vertsrc = fixedshaders[2]
 *         uidata.hud_fragsrc = fixedshaders[1]             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC PD nogil
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_fixedshaders, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 550, __pyx_L1_error)
    __pyx_v_11_glarea_es2_uidata.hud_fragsrc = __pyx_t_9;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "_glarea_es2.pyx":548
 *     uidata.pick_vertsrc = fixedshaders[0]
 *     uidata.pick_fragsrc = fixedshaders[1]
 *     if debug & DEBUG_DRAW:             # <<<<<<<<<<<<<<
 *         uidata.hud_vertsrc = fixedshaders[2]
 *         uidata.hud_fragsrc = fixedshaders[1]
 */
  }

  /* "_glarea_es2.pyx":542
 *     uidata.shaders_changed = True
 * 
 * def set_fixedshaders(fixedshaders):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     fixedshaders = [update_shader_version(s) for s in fixedshaders]
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("_glarea_es2.set_fixedshaders", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fixedshaders);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":553
 * 
 * ##pxm-FUNC PD nogil
 * cdef void sync_set_fixedshaders() nogil:             # <<<<<<<<<<<<<<
 *     renderdata.pick_vertsrc = uidata.pick_vertsrc
 *     renderdata.pick_fragsrc = uidata.pick_fragsrc
 */

static void __pyx_f_11_glarea_es2_sync_set_fixedshaders(void) {
  char *__pyx_t_1;
  int __pyx_t_2;

  /* "_glarea_es2.pyx":554
 * ##pxm-FUNC PD nogil
 * cdef void sync_set_fixedshaders() nogil:
 *     renderdata.pick_vertsrc = uidata.pick_vertsrc             # <<<<<<<<<<<<<<
 *     renderdata.pick_fragsrc = uidata.pick_fragsrc
 *     if debug & DEBUG_DRAW:
 */
  __pyx_t_1 = __pyx_v_11_glarea_es2_uidata.pick_vertsrc;
  __pyx_v_11_glarea_es2_renderdata.pick_vertsrc = __pyx_t_1;

  /* "_glarea_es2.pyx":555
 * cdef void sync_set_fixedshaders() nogil:
 *     renderdata.pick_vertsrc = uidata.pick_vertsrc
 *     renderdata.pick_fragsrc = uidata.pick_fragsrc             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_DRAW:
 *         renderdata.hud_vertsrc = uidata.hud_vertsrc
 */
  __pyx_t_1 = __pyx_v_11_glarea_es2_uidata.pick_fragsrc;
  __pyx_v_11_glarea_es2_renderdata.pick_fragsrc = __pyx_t_1;

  /* "_glarea_es2.pyx":556
 *     renderdata.pick_vertsrc = uidata.pick_vertsrc
 *     renderdata.pick_fragsrc = uidata.pick_fragsrc
 *     if debug & DEBUG_DRAW:             # <<<<<<<<<<<<<<
 *         renderdata.hud_vertsrc = uidata.hud_vertsrc
 *         renderdata.hud_fragsrc = uidata.hud_fragsrc
 */
  __pyx_t_2 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_DRAW) != 0);
  if (__pyx_t_2) {

    /* "_glarea_es2.pyx":557
 *     renderdata.pick_fragsrc = uidata.pick_fragsrc
 *     if debug & DEBUG_DRAW:
 *         renderdata.hud_vertsrc = uidata.hud_vertsrc             # <<<<<<<<<<<<<<
 *         renderdata.hud_fragsrc = uidata.hud_fragsrc
 * 
 */
    __pyx_t_1 = __pyx_v_11_glarea_es2_uidata.hud_vertsrc;
    __pyx_v_11_glarea_es2_renderdata.hud_vertsrc = __pyx_t_1;

    /* "_glarea_es2.pyx":558
 *     if debug & DEBUG_DRAW:
 *         renderdata.hud_vertsrc = uidata.hud_vertsrc
 *         renderdata.hud_fragsrc = uidata.hud_fragsrc             # <<<<<<<<<<<<<<
 * 
 * def set_pick_position(x, y):
 */
    __pyx_t_1 = __pyx_v_11_glarea_es2_uidata.hud_fragsrc;
    __pyx_v_11_glarea_es2_renderdata.hud_fragsrc = __pyx_t_1;

    /* "_glarea_es2.pyx":556
 *     renderdata.pick_vertsrc = uidata.pick_vertsrc
 *     renderdata.pick_fragsrc = uidata.pick_fragsrc
 *     if debug & DEBUG_DRAW:             # <<<<<<<<<<<<<<
 *         renderdata.hud_vertsrc = uidata.hud_vertsrc
 *         renderdata.hud_fragsrc = uidata.hud_fragsrc
 */
  }

  /* "_glarea_es2.pyx":553
 * 
 * ##pxm-FUNC PD nogil
 * cdef void sync_set_fixedshaders() nogil:             # <<<<<<<<<<<<<<
 *     renderdata.pick_vertsrc = uidata.pick_vertsrc
 *     renderdata.pick_fragsrc = uidata.pick_fragsrc
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":560
 *         renderdata.hud_fragsrc = uidata.hud_fragsrc
 * 
 * def set_pick_position(x, y):             # <<<<<<<<<<<<<<
 *     uidata.pick_x = x
 *     uidata.pick_y = y
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_29set_pick_position(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_29set_pick_position = {"set_pick_position", (PyCFunction)__pyx_pw_11_glarea_es2_29set_pick_position, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_11_glarea_es2_29set_pick_position(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_pick_position (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_pick_position", 1, 2, 2, 1); __PYX_ERR(0, 560, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_pick_position") < 0)) __PYX_ERR(0, 560, __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_pick_position", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 560, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea_es2.set_pick_position", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11_glarea_es2_28set_pick_position(__pyx_self, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_11_glarea_es2_28set_pick_position(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("set_pick_position", 0);

  /* "_glarea_es2.pyx":561
 * 
 * def set_pick_position(x, y):
 *     uidata.pick_x = x             # <<<<<<<<<<<<<<
 *     uidata.pick_y = y
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_x); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 561, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.pick_x = __pyx_t_1;

  /* "_glarea_es2.pyx":562
 * def set_pick_position(x, y):
 *     uidata.pick_x = x
 *     uidata.pick_y = y             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC PD nogil
 */
  __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_y); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 562, __pyx_L1_error)
  __pyx_v_11_glarea_es2_uidata.pick_y = __pyx_t_1;

  /* "_glarea_es2.pyx":560
 *         renderdata.hud_fragsrc = uidata.hud_fragsrc
 * 
 * def set_pick_position(x, y):             # <<<<<<<<<<<<<<
 *     uidata.pick_x = x
 *     uidata.pick_y = y
 */

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

/* "_glarea_es2.pyx":565
 * 
 * ##pxm-FUNC PD nogil
 * cdef void sync_set_pick_position() nogil:             # <<<<<<<<<<<<<<
 *     renderdata.pick_x = uidata.pick_x
 *     renderdata.pick_y = uidata.pick_y
 */

static void __pyx_f_11_glarea_es2_sync_set_pick_position(void) {
  int __pyx_t_1;

  /* "_glarea_es2.pyx":566
 * ##pxm-FUNC PD nogil
 * cdef void sync_set_pick_position() nogil:
 *     renderdata.pick_x = uidata.pick_x             # <<<<<<<<<<<<<<
 *     renderdata.pick_y = uidata.pick_y
 * 
 */
  __pyx_t_1 = __pyx_v_11_glarea_es2_uidata.pick_x;
  __pyx_v_11_glarea_es2_renderdata.pick_x = __pyx_t_1;

  /* "_glarea_es2.pyx":567
 * cdef void sync_set_pick_position() nogil:
 *     renderdata.pick_x = uidata.pick_x
 *     renderdata.pick_y = uidata.pick_y             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P
 */
  __pyx_t_1 = __pyx_v_11_glarea_es2_uidata.pick_y;
  __pyx_v_11_glarea_es2_renderdata.pick_y = __pyx_t_1;

  /* "_glarea_es2.pyx":565
 * 
 * ##pxm-FUNC PD nogil
 * cdef void sync_set_pick_position() nogil:             # <<<<<<<<<<<<<<
 *     renderdata.pick_x = uidata.pick_x
 *     renderdata.pick_y = uidata.pick_y
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":570
 * 
 * ##pxm-FUNC P
 * cpdef set_atlas_data(int i, bytes data, int x, int w, int h):             # <<<<<<<<<<<<<<
 *     assert i < gldraw.MAX_FACES, (i, gldraw.MAX_FACES)
 *     if i == 0:
 */

static PyObject *__pyx_pw_11_glarea_es2_31set_atlas_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11_glarea_es2_set_atlas_data(int __pyx_v_i, PyObject *__pyx_v_data, int __pyx_v_x, int __pyx_v_w, int __pyx_v_h, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  char *__pyx_t_6;
  __Pyx_RefNannySetupContext("set_atlas_data", 0);

  /* "_glarea_es2.pyx":571
 * ##pxm-FUNC P
 * cpdef set_atlas_data(int i, bytes data, int x, int w, int h):
 *     assert i < gldraw.MAX_FACES, (i, gldraw.MAX_FACES)             # <<<<<<<<<<<<<<
 *     if i == 0:
 *         uipydata.atlasdata = []
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_i < __pyx_e_11_gldraw_es2_MAX_FACES) != 0))) {
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_e_11_gldraw_es2_MAX_FACES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 571, __pyx_L1_error)
    }
  }
  #endif

  /* "_glarea_es2.pyx":572
 * cpdef set_atlas_data(int i, bytes data, int x, int w, int h):
 *     assert i < gldraw.MAX_FACES, (i, gldraw.MAX_FACES)
 *     if i == 0:             # <<<<<<<<<<<<<<
 *         uipydata.atlasdata = []
 *     uipydata.atlasdata.append(data)
 */
  __pyx_t_4 = ((__pyx_v_i == 0) != 0);
  if (__pyx_t_4) {

    /* "_glarea_es2.pyx":573
 *     assert i < gldraw.MAX_FACES, (i, gldraw.MAX_FACES)
 *     if i == 0:
 *         uipydata.atlasdata = []             # <<<<<<<<<<<<<<
 *     uipydata.atlasdata.append(data)
 *     uidata.atlasdata[i].x = x
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_uipydata); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_3, __pyx_n_s_atlasdata, __pyx_t_2) < 0) __PYX_ERR(0, 573, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "_glarea_es2.pyx":572
 * cpdef set_atlas_data(int i, bytes data, int x, int w, int h):
 *     assert i < gldraw.MAX_FACES, (i, gldraw.MAX_FACES)
 *     if i == 0:             # <<<<<<<<<<<<<<
 *         uipydata.atlasdata = []
 *     uipydata.atlasdata.append(data)
 */
  }

  /* "_glarea_es2.pyx":574
 *     if i == 0:
 *         uipydata.atlasdata = []
 *     uipydata.atlasdata.append(data)             # <<<<<<<<<<<<<<
 *     uidata.atlasdata[i].x = x
 *     uidata.atlasdata[i].w = w
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_uipydata); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_atlasdata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_Append(__pyx_t_2, __pyx_v_data); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":575
 *         uipydata.atlasdata = []
 *     uipydata.atlasdata.append(data)
 *     uidata.atlasdata[i].x = x             # <<<<<<<<<<<<<<
 *     uidata.atlasdata[i].w = w
 *     uidata.atlasdata[i].h = h
 */
  (__pyx_v_11_glarea_es2_uidata.atlasdata[__pyx_v_i]).x = __pyx_v_x;

  /* "_glarea_es2.pyx":576
 *     uipydata.atlasdata.append(data)
 *     uidata.atlasdata[i].x = x
 *     uidata.atlasdata[i].w = w             # <<<<<<<<<<<<<<
 *     uidata.atlasdata[i].h = h
 *     uidata.atlasdata[i].data = data
 */
  (__pyx_v_11_glarea_es2_uidata.atlasdata[__pyx_v_i]).w = __pyx_v_w;

  /* "_glarea_es2.pyx":577
 *     uidata.atlasdata[i].x = x
 *     uidata.atlasdata[i].w = w
 *     uidata.atlasdata[i].h = h             # <<<<<<<<<<<<<<
 *     uidata.atlasdata[i].data = data
 *     uidata.atlaslen = i+1
 */
  (__pyx_v_11_glarea_es2_uidata.atlasdata[__pyx_v_i]).h = __pyx_v_h;

  /* "_glarea_es2.pyx":578
 *     uidata.atlasdata[i].w = w
 *     uidata.atlasdata[i].h = h
 *     uidata.atlasdata[i].data = data             # <<<<<<<<<<<<<<
 *     uidata.atlaslen = i+1
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_data); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L1_error)
  (__pyx_v_11_glarea_es2_uidata.atlasdata[__pyx_v_i]).data = __pyx_t_6;

  /* "_glarea_es2.pyx":579
 *     uidata.atlasdata[i].h = h
 *     uidata.atlasdata[i].data = data
 *     uidata.atlaslen = i+1             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC PD nogil
 */
  __pyx_v_11_glarea_es2_uidata.atlaslen = (__pyx_v_i + 1);

  /* "_glarea_es2.pyx":570
 * 
 * ##pxm-FUNC P
 * cpdef set_atlas_data(int i, bytes data, int x, int w, int h):             # <<<<<<<<<<<<<<
 *     assert i < gldraw.MAX_FACES, (i, gldraw.MAX_FACES)
 *     if i == 0:
 */

  /* 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_AddTraceback("_glarea_es2.set_atlas_data", __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_11_glarea_es2_31set_atlas_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_11_glarea_es2_31set_atlas_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_i;
  PyObject *__pyx_v_data = 0;
  int __pyx_v_x;
  int __pyx_v_w;
  int __pyx_v_h;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_atlas_data (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_i,&__pyx_n_s_data,&__pyx_n_s_x,&__pyx_n_s_w,&__pyx_n_s_h,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_atlas_data", 1, 5, 5, 1); __PYX_ERR(0, 570, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_atlas_data", 1, 5, 5, 2); __PYX_ERR(0, 570, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_atlas_data", 1, 5, 5, 3); __PYX_ERR(0, 570, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_atlas_data", 1, 5, 5, 4); __PYX_ERR(0, 570, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_atlas_data") < 0)) __PYX_ERR(0, 570, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      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);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_i = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 570, __pyx_L3_error)
    __pyx_v_data = ((PyObject*)values[1]);
    __pyx_v_x = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_x == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 570, __pyx_L3_error)
    __pyx_v_w = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 570, __pyx_L3_error)
    __pyx_v_h = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 570, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_atlas_data", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 570, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("_glarea_es2.set_atlas_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 1, "data", 1))) __PYX_ERR(0, 570, __pyx_L1_error)
  __pyx_r = __pyx_pf_11_glarea_es2_30set_atlas_data(__pyx_self, __pyx_v_i, __pyx_v_data, __pyx_v_x, __pyx_v_w, __pyx_v_h);

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

static PyObject *__pyx_pf_11_glarea_es2_30set_atlas_data(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_i, PyObject *__pyx_v_data, int __pyx_v_x, int __pyx_v_w, int __pyx_v_h) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("set_atlas_data", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_11_glarea_es2_set_atlas_data(__pyx_v_i, __pyx_v_data, __pyx_v_x, __pyx_v_w, __pyx_v_h, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 570, __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_es2.set_atlas_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":582
 * 
 * ##pxm-FUNC PD nogil
 * cdef void sync_set_atlas_data() nogil:             # <<<<<<<<<<<<<<
 *     cdef int i #px+
 *     for i in range(uidata.atlaslen):
 */

static void __pyx_f_11_glarea_es2_sync_set_atlas_data(void) {
  int __pyx_v_i;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  char *__pyx_t_4;

  /* "_glarea_es2.pyx":584
 * cdef void sync_set_atlas_data() nogil:
 *     cdef int i #px+
 *     for i in range(uidata.atlaslen):             # <<<<<<<<<<<<<<
 *         renderdata.atlasdata[i].x = uidata.atlasdata[i].x
 *         renderdata.atlasdata[i].w = uidata.atlasdata[i].w
 */
  __pyx_t_1 = __pyx_v_11_glarea_es2_uidata.atlaslen;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "_glarea_es2.pyx":585
 *     cdef int i #px+
 *     for i in range(uidata.atlaslen):
 *         renderdata.atlasdata[i].x = uidata.atlasdata[i].x             # <<<<<<<<<<<<<<
 *         renderdata.atlasdata[i].w = uidata.atlasdata[i].w
 *         renderdata.atlasdata[i].h = uidata.atlasdata[i].h
 */
    __pyx_t_3 = (__pyx_v_11_glarea_es2_uidata.atlasdata[__pyx_v_i]).x;
    (__pyx_v_11_glarea_es2_renderdata.atlasdata[__pyx_v_i]).x = __pyx_t_3;

    /* "_glarea_es2.pyx":586
 *     for i in range(uidata.atlaslen):
 *         renderdata.atlasdata[i].x = uidata.atlasdata[i].x
 *         renderdata.atlasdata[i].w = uidata.atlasdata[i].w             # <<<<<<<<<<<<<<
 *         renderdata.atlasdata[i].h = uidata.atlasdata[i].h
 *         renderdata.atlasdata[i].data = uidata.atlasdata[i].data
 */
    __pyx_t_3 = (__pyx_v_11_glarea_es2_uidata.atlasdata[__pyx_v_i]).w;
    (__pyx_v_11_glarea_es2_renderdata.atlasdata[__pyx_v_i]).w = __pyx_t_3;

    /* "_glarea_es2.pyx":587
 *         renderdata.atlasdata[i].x = uidata.atlasdata[i].x
 *         renderdata.atlasdata[i].w = uidata.atlasdata[i].w
 *         renderdata.atlasdata[i].h = uidata.atlasdata[i].h             # <<<<<<<<<<<<<<
 *         renderdata.atlasdata[i].data = uidata.atlasdata[i].data
 *     renderdata.atlaslen = uidata.atlaslen
 */
    __pyx_t_3 = (__pyx_v_11_glarea_es2_uidata.atlasdata[__pyx_v_i]).h;
    (__pyx_v_11_glarea_es2_renderdata.atlasdata[__pyx_v_i]).h = __pyx_t_3;

    /* "_glarea_es2.pyx":588
 *         renderdata.atlasdata[i].w = uidata.atlasdata[i].w
 *         renderdata.atlasdata[i].h = uidata.atlasdata[i].h
 *         renderdata.atlasdata[i].data = uidata.atlasdata[i].data             # <<<<<<<<<<<<<<
 *     renderdata.atlaslen = uidata.atlaslen
 * 
 */
    __pyx_t_4 = (__pyx_v_11_glarea_es2_uidata.atlasdata[__pyx_v_i]).data;
    (__pyx_v_11_glarea_es2_renderdata.atlasdata[__pyx_v_i]).data = __pyx_t_4;
  }

  /* "_glarea_es2.pyx":589
 *         renderdata.atlasdata[i].h = uidata.atlasdata[i].h
 *         renderdata.atlasdata[i].data = uidata.atlasdata[i].data
 *     renderdata.atlaslen = uidata.atlaslen             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC PD nogil
 */
  __pyx_t_1 = __pyx_v_11_glarea_es2_uidata.atlaslen;
  __pyx_v_11_glarea_es2_renderdata.atlaslen = __pyx_t_1;

  /* "_glarea_es2.pyx":582
 * 
 * ##pxm-FUNC PD nogil
 * cdef void sync_set_atlas_data() nogil:             # <<<<<<<<<<<<<<
 *     cdef int i #px+
 *     for i in range(uidata.atlaslen):
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":592
 * 
 * ##pxm-FUNC PD nogil
 * cdef void sync() nogil:             # <<<<<<<<<<<<<<
 *     uidata.synced = True
 *     if uidata.background_changed:
 */

static void __pyx_f_11_glarea_es2_sync(void) {
  int __pyx_t_1;
  float __pyx_t_2;
  char *__pyx_t_3;

  /* "_glarea_es2.pyx":593
 * ##pxm-FUNC PD nogil
 * cdef void sync() nogil:
 *     uidata.synced = True             # <<<<<<<<<<<<<<
 *     if uidata.background_changed:
 *         renderdata.bg_red = uidata.bg_red
 */
  __pyx_v_11_glarea_es2_uidata.synced = 1;

  /* "_glarea_es2.pyx":594
 * cdef void sync() nogil:
 *     uidata.synced = True
 *     if uidata.background_changed:             # <<<<<<<<<<<<<<
 *         renderdata.bg_red = uidata.bg_red
 *         renderdata.bg_green = uidata.bg_green
 */
  __pyx_t_1 = (__pyx_v_11_glarea_es2_uidata.background_changed != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":595
 *     uidata.synced = True
 *     if uidata.background_changed:
 *         renderdata.bg_red = uidata.bg_red             # <<<<<<<<<<<<<<
 *         renderdata.bg_green = uidata.bg_green
 *         renderdata.bg_blue = uidata.bg_blue
 */
    __pyx_t_2 = __pyx_v_11_glarea_es2_uidata.bg_red;
    __pyx_v_11_glarea_es2_renderdata.bg_red = __pyx_t_2;

    /* "_glarea_es2.pyx":596
 *     if uidata.background_changed:
 *         renderdata.bg_red = uidata.bg_red
 *         renderdata.bg_green = uidata.bg_green             # <<<<<<<<<<<<<<
 *         renderdata.bg_blue = uidata.bg_blue
 *         uidata.background_changed = False
 */
    __pyx_t_2 = __pyx_v_11_glarea_es2_uidata.bg_green;
    __pyx_v_11_glarea_es2_renderdata.bg_green = __pyx_t_2;

    /* "_glarea_es2.pyx":597
 *         renderdata.bg_red = uidata.bg_red
 *         renderdata.bg_green = uidata.bg_green
 *         renderdata.bg_blue = uidata.bg_blue             # <<<<<<<<<<<<<<
 *         uidata.background_changed = False
 *     if uidata.viewport_changed:
 */
    __pyx_t_2 = __pyx_v_11_glarea_es2_uidata.bg_blue;
    __pyx_v_11_glarea_es2_renderdata.bg_blue = __pyx_t_2;

    /* "_glarea_es2.pyx":598
 *         renderdata.bg_green = uidata.bg_green
 *         renderdata.bg_blue = uidata.bg_blue
 *         uidata.background_changed = False             # <<<<<<<<<<<<<<
 *     if uidata.viewport_changed:
 *         _sync_projection_matrix()
 */
    __pyx_v_11_glarea_es2_uidata.background_changed = 0;

    /* "_glarea_es2.pyx":594
 * cdef void sync() nogil:
 *     uidata.synced = True
 *     if uidata.background_changed:             # <<<<<<<<<<<<<<
 *         renderdata.bg_red = uidata.bg_red
 *         renderdata.bg_green = uidata.bg_green
 */
  }

  /* "_glarea_es2.pyx":599
 *         renderdata.bg_blue = uidata.bg_blue
 *         uidata.background_changed = False
 *     if uidata.viewport_changed:             # <<<<<<<<<<<<<<
 *         _sync_projection_matrix()
 *         uidata.viewport_changed = False
 */
  __pyx_t_1 = (__pyx_v_11_glarea_es2_uidata.viewport_changed != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":600
 *         uidata.background_changed = False
 *     if uidata.viewport_changed:
 *         _sync_projection_matrix()             # <<<<<<<<<<<<<<
 *         uidata.viewport_changed = False
 *     if uidata.rotation_changed:
 */
    __pyx_f_11_glarea_es2__sync_projection_matrix();

    /* "_glarea_es2.pyx":601
 *     if uidata.viewport_changed:
 *         _sync_projection_matrix()
 *         uidata.viewport_changed = False             # <<<<<<<<<<<<<<
 *     if uidata.rotation_changed:
 *         _sync_modelview_matrix_rotation()
 */
    __pyx_v_11_glarea_es2_uidata.viewport_changed = 0;

    /* "_glarea_es2.pyx":599
 *         renderdata.bg_blue = uidata.bg_blue
 *         uidata.background_changed = False
 *     if uidata.viewport_changed:             # <<<<<<<<<<<<<<
 *         _sync_projection_matrix()
 *         uidata.viewport_changed = False
 */
  }

  /* "_glarea_es2.pyx":602
 *         _sync_projection_matrix()
 *         uidata.viewport_changed = False
 *     if uidata.rotation_changed:             # <<<<<<<<<<<<<<
 *         _sync_modelview_matrix_rotation()
 *         uidata.rotation_changed = False
 */
  __pyx_t_1 = (__pyx_v_11_glarea_es2_uidata.rotation_changed != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":603
 *         uidata.viewport_changed = False
 *     if uidata.rotation_changed:
 *         _sync_modelview_matrix_rotation()             # <<<<<<<<<<<<<<
 *         uidata.rotation_changed = False
 *     if uidata.rotation_quat_changed:
 */
    __pyx_f_11_glarea_es2__sync_modelview_matrix_rotation();

    /* "_glarea_es2.pyx":604
 *     if uidata.rotation_changed:
 *         _sync_modelview_matrix_rotation()
 *         uidata.rotation_changed = False             # <<<<<<<<<<<<<<
 *     if uidata.rotation_quat_changed:
 *         quat_to_matrix(renderdata.modelview_matrix, uidata.rotation_quat)
 */
    __pyx_v_11_glarea_es2_uidata.rotation_changed = 0;

    /* "_glarea_es2.pyx":602
 *         _sync_projection_matrix()
 *         uidata.viewport_changed = False
 *     if uidata.rotation_changed:             # <<<<<<<<<<<<<<
 *         _sync_modelview_matrix_rotation()
 *         uidata.rotation_changed = False
 */
  }

  /* "_glarea_es2.pyx":605
 *         _sync_modelview_matrix_rotation()
 *         uidata.rotation_changed = False
 *     if uidata.rotation_quat_changed:             # <<<<<<<<<<<<<<
 *         quat_to_matrix(renderdata.modelview_matrix, uidata.rotation_quat)
 *         uidata.rotation_quat_changed = False
 */
  __pyx_t_1 = (__pyx_v_11_glarea_es2_uidata.rotation_quat_changed != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":606
 *         uidata.rotation_changed = False
 *     if uidata.rotation_quat_changed:
 *         quat_to_matrix(renderdata.modelview_matrix, uidata.rotation_quat)             # <<<<<<<<<<<<<<
 *         uidata.rotation_quat_changed = False
 *     if uidata.frustum_changed:
 */
    __pyx_f_11_glarea_es2_quat_to_matrix(__pyx_v_11_glarea_es2_renderdata.modelview_matrix, __pyx_v_11_glarea_es2_uidata.rotation_quat);

    /* "_glarea_es2.pyx":607
 *     if uidata.rotation_quat_changed:
 *         quat_to_matrix(renderdata.modelview_matrix, uidata.rotation_quat)
 *         uidata.rotation_quat_changed = False             # <<<<<<<<<<<<<<
 *     if uidata.frustum_changed:
 *         _sync_modelview_matrix_translation()
 */
    __pyx_v_11_glarea_es2_uidata.rotation_quat_changed = 0;

    /* "_glarea_es2.pyx":605
 *         _sync_modelview_matrix_rotation()
 *         uidata.rotation_changed = False
 *     if uidata.rotation_quat_changed:             # <<<<<<<<<<<<<<
 *         quat_to_matrix(renderdata.modelview_matrix, uidata.rotation_quat)
 *         uidata.rotation_quat_changed = False
 */
  }

  /* "_glarea_es2.pyx":608
 *         quat_to_matrix(renderdata.modelview_matrix, uidata.rotation_quat)
 *         uidata.rotation_quat_changed = False
 *     if uidata.frustum_changed:             # <<<<<<<<<<<<<<
 *         _sync_modelview_matrix_translation()
 *         _sync_projection_matrix()
 */
  __pyx_t_1 = (__pyx_v_11_glarea_es2_uidata.frustum_changed != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":609
 *         uidata.rotation_quat_changed = False
 *     if uidata.frustum_changed:
 *         _sync_modelview_matrix_translation()             # <<<<<<<<<<<<<<
 *         _sync_projection_matrix()
 *         uidata.frustum_changed = False
 */
    __pyx_f_11_glarea_es2__sync_modelview_matrix_translation();

    /* "_glarea_es2.pyx":610
 *     if uidata.frustum_changed:
 *         _sync_modelview_matrix_translation()
 *         _sync_projection_matrix()             # <<<<<<<<<<<<<<
 *         uidata.frustum_changed = False
 *     if uidata.multisample_changed:
 */
    __pyx_f_11_glarea_es2__sync_projection_matrix();

    /* "_glarea_es2.pyx":611
 *         _sync_modelview_matrix_translation()
 *         _sync_projection_matrix()
 *         uidata.frustum_changed = False             # <<<<<<<<<<<<<<
 *     if uidata.multisample_changed:
 *         renderdata.multisample = uidata.multisample_changed - 1
 */
    __pyx_v_11_glarea_es2_uidata.frustum_changed = 0;

    /* "_glarea_es2.pyx":608
 *         quat_to_matrix(renderdata.modelview_matrix, uidata.rotation_quat)
 *         uidata.rotation_quat_changed = False
 *     if uidata.frustum_changed:             # <<<<<<<<<<<<<<
 *         _sync_modelview_matrix_translation()
 *         _sync_projection_matrix()
 */
  }

  /* "_glarea_es2.pyx":612
 *         _sync_projection_matrix()
 *         uidata.frustum_changed = False
 *     if uidata.multisample_changed:             # <<<<<<<<<<<<<<
 *         renderdata.multisample = uidata.multisample_changed - 1
 *         uidata.multisample_changed = 0
 */
  __pyx_t_1 = (__pyx_v_11_glarea_es2_uidata.multisample_changed != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":613
 *         uidata.frustum_changed = False
 *     if uidata.multisample_changed:
 *         renderdata.multisample = uidata.multisample_changed - 1             # <<<<<<<<<<<<<<
 *         uidata.multisample_changed = 0
 *     if uidata.data_changed:
 */
    __pyx_v_11_glarea_es2_renderdata.multisample = (__pyx_v_11_glarea_es2_uidata.multisample_changed - 1);

    /* "_glarea_es2.pyx":614
 *     if uidata.multisample_changed:
 *         renderdata.multisample = uidata.multisample_changed - 1
 *         uidata.multisample_changed = 0             # <<<<<<<<<<<<<<
 *     if uidata.data_changed:
 *         gldraw.sync_vertexdata(uidata.vertexdatalen, uidata.vertexdata, uidata.vertexpointers)
 */
    __pyx_v_11_glarea_es2_uidata.multisample_changed = 0;

    /* "_glarea_es2.pyx":612
 *         _sync_projection_matrix()
 *         uidata.frustum_changed = False
 *     if uidata.multisample_changed:             # <<<<<<<<<<<<<<
 *         renderdata.multisample = uidata.multisample_changed - 1
 *         uidata.multisample_changed = 0
 */
  }

  /* "_glarea_es2.pyx":615
 *         renderdata.multisample = uidata.multisample_changed - 1
 *         uidata.multisample_changed = 0
 *     if uidata.data_changed:             # <<<<<<<<<<<<<<
 *         gldraw.sync_vertexdata(uidata.vertexdatalen, uidata.vertexdata, uidata.vertexpointers)
 *         gldraw.sync_blocks(uidata.nblocks, uidata.cnts_block, uidata.idx_debug, uidata.cnt_debug, uidata.cnt_pick)
 */
  __pyx_t_1 = (__pyx_v_11_glarea_es2_uidata.data_changed != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":616
 *         uidata.multisample_changed = 0
 *     if uidata.data_changed:
 *         gldraw.sync_vertexdata(uidata.vertexdatalen, uidata.vertexdata, uidata.vertexpointers)             # <<<<<<<<<<<<<<
 *         gldraw.sync_blocks(uidata.nblocks, uidata.cnts_block, uidata.idx_debug, uidata.cnt_debug, uidata.cnt_pick)
 *         gldraw.sync_transformations(uidata.transformations_count, uidata.transformations)
 */
    __pyx_f_11_gldraw_es2_sync_vertexdata(__pyx_v_11_glarea_es2_uidata.vertexdatalen, __pyx_v_11_glarea_es2_uidata.vertexdata, __pyx_v_11_glarea_es2_uidata.vertexpointers);

    /* "_glarea_es2.pyx":617
 *     if uidata.data_changed:
 *         gldraw.sync_vertexdata(uidata.vertexdatalen, uidata.vertexdata, uidata.vertexpointers)
 *         gldraw.sync_blocks(uidata.nblocks, uidata.cnts_block, uidata.idx_debug, uidata.cnt_debug, uidata.cnt_pick)             # <<<<<<<<<<<<<<
 *         gldraw.sync_transformations(uidata.transformations_count, uidata.transformations)
 *         uidata.data_changed = False
 */
    __pyx_f_11_gldraw_es2_sync_blocks(__pyx_v_11_glarea_es2_uidata.nblocks, __pyx_v_11_glarea_es2_uidata.cnts_block, __pyx_v_11_glarea_es2_uidata.idx_debug, __pyx_v_11_glarea_es2_uidata.cnt_debug, __pyx_v_11_glarea_es2_uidata.cnt_pick);

    /* "_glarea_es2.pyx":618
 *         gldraw.sync_vertexdata(uidata.vertexdatalen, uidata.vertexdata, uidata.vertexpointers)
 *         gldraw.sync_blocks(uidata.nblocks, uidata.cnts_block, uidata.idx_debug, uidata.cnt_debug, uidata.cnt_pick)
 *         gldraw.sync_transformations(uidata.transformations_count, uidata.transformations)             # <<<<<<<<<<<<<<
 *         uidata.data_changed = False
 *     if uidata.transformation_changed:
 */
    __pyx_f_11_gldraw_es2_sync_transformations(__pyx_v_11_glarea_es2_uidata.transformations_count, __pyx_v_11_glarea_es2_uidata.transformations);

    /* "_glarea_es2.pyx":619
 *         gldraw.sync_blocks(uidata.nblocks, uidata.cnts_block, uidata.idx_debug, uidata.cnt_debug, uidata.cnt_pick)
 *         gldraw.sync_transformations(uidata.transformations_count, uidata.transformations)
 *         uidata.data_changed = False             # <<<<<<<<<<<<<<
 *     if uidata.transformation_changed:
 *         gldraw.sync_block_transformations(uidata.transformation_blocks)
 */
    __pyx_v_11_glarea_es2_uidata.data_changed = 0;

    /* "_glarea_es2.pyx":615
 *         renderdata.multisample = uidata.multisample_changed - 1
 *         uidata.multisample_changed = 0
 *     if uidata.data_changed:             # <<<<<<<<<<<<<<
 *         gldraw.sync_vertexdata(uidata.vertexdatalen, uidata.vertexdata, uidata.vertexpointers)
 *         gldraw.sync_blocks(uidata.nblocks, uidata.cnts_block, uidata.idx_debug, uidata.cnt_debug, uidata.cnt_pick)
 */
  }

  /* "_glarea_es2.pyx":620
 *         gldraw.sync_transformations(uidata.transformations_count, uidata.transformations)
 *         uidata.data_changed = False
 *     if uidata.transformation_changed:             # <<<<<<<<<<<<<<
 *         gldraw.sync_block_transformations(uidata.transformation_blocks)
 *         uidata.transformation_changed = False
 */
  __pyx_t_1 = (__pyx_v_11_glarea_es2_uidata.transformation_changed != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":621
 *         uidata.data_changed = False
 *     if uidata.transformation_changed:
 *         gldraw.sync_block_transformations(uidata.transformation_blocks)             # <<<<<<<<<<<<<<
 *         uidata.transformation_changed = False
 *     if uidata.animation_changed == 2:
 */
    __pyx_f_11_gldraw_es2_sync_block_transformations(__pyx_v_11_glarea_es2_uidata.transformation_blocks);

    /* "_glarea_es2.pyx":622
 *     if uidata.transformation_changed:
 *         gldraw.sync_block_transformations(uidata.transformation_blocks)
 *         uidata.transformation_changed = False             # <<<<<<<<<<<<<<
 *     if uidata.animation_changed == 2:
 *         gldraw.sync_animation_next(uidata.angle, uidata.rotation_x, uidata.rotation_y, uidata.rotation_z)
 */
    __pyx_v_11_glarea_es2_uidata.transformation_changed = 0;

    /* "_glarea_es2.pyx":620
 *         gldraw.sync_transformations(uidata.transformations_count, uidata.transformations)
 *         uidata.data_changed = False
 *     if uidata.transformation_changed:             # <<<<<<<<<<<<<<
 *         gldraw.sync_block_transformations(uidata.transformation_blocks)
 *         uidata.transformation_changed = False
 */
  }

  /* "_glarea_es2.pyx":623
 *         gldraw.sync_block_transformations(uidata.transformation_blocks)
 *         uidata.transformation_changed = False
 *     if uidata.animation_changed == 2:             # <<<<<<<<<<<<<<
 *         gldraw.sync_animation_next(uidata.angle, uidata.rotation_x, uidata.rotation_y, uidata.rotation_z)
 *         uidata.animation_changed = 0
 */
  switch (__pyx_v_11_glarea_es2_uidata.animation_changed) {
    case 2:

    /* "_glarea_es2.pyx":624
 *         uidata.transformation_changed = False
 *     if uidata.animation_changed == 2:
 *         gldraw.sync_animation_next(uidata.angle, uidata.rotation_x, uidata.rotation_y, uidata.rotation_z)             # <<<<<<<<<<<<<<
 *         uidata.animation_changed = 0
 *     elif uidata.animation_changed == 1:
 */
    __pyx_f_11_gldraw_es2_sync_animation_next(__pyx_v_11_glarea_es2_uidata.angle, __pyx_v_11_glarea_es2_uidata.rotation_x, __pyx_v_11_glarea_es2_uidata.rotation_y, __pyx_v_11_glarea_es2_uidata.rotation_z);

    /* "_glarea_es2.pyx":625
 *     if uidata.animation_changed == 2:
 *         gldraw.sync_animation_next(uidata.angle, uidata.rotation_x, uidata.rotation_y, uidata.rotation_z)
 *         uidata.animation_changed = 0             # <<<<<<<<<<<<<<
 *     elif uidata.animation_changed == 1:
 *         gldraw.sync_animation_start(uidata.animation_blocks_count, uidata.animation_blocks)
 */
    __pyx_v_11_glarea_es2_uidata.animation_changed = 0;

    /* "_glarea_es2.pyx":623
 *         gldraw.sync_block_transformations(uidata.transformation_blocks)
 *         uidata.transformation_changed = False
 *     if uidata.animation_changed == 2:             # <<<<<<<<<<<<<<
 *         gldraw.sync_animation_next(uidata.angle, uidata.rotation_x, uidata.rotation_y, uidata.rotation_z)
 *         uidata.animation_changed = 0
 */
    break;

    /* "_glarea_es2.pyx":626
 *         gldraw.sync_animation_next(uidata.angle, uidata.rotation_x, uidata.rotation_y, uidata.rotation_z)
 *         uidata.animation_changed = 0
 *     elif uidata.animation_changed == 1:             # <<<<<<<<<<<<<<
 *         gldraw.sync_animation_start(uidata.animation_blocks_count, uidata.animation_blocks)
 *         uidata.animation_changed = 0
 */
    case 1:

    /* "_glarea_es2.pyx":627
 *         uidata.animation_changed = 0
 *     elif uidata.animation_changed == 1:
 *         gldraw.sync_animation_start(uidata.animation_blocks_count, uidata.animation_blocks)             # <<<<<<<<<<<<<<
 *         uidata.animation_changed = 0
 *     if uidata.shaders_changed:
 */
    __pyx_f_11_gldraw_es2_sync_animation_start(__pyx_v_11_glarea_es2_uidata.animation_blocks_count, __pyx_v_11_glarea_es2_uidata.animation_blocks);

    /* "_glarea_es2.pyx":628
 *     elif uidata.animation_changed == 1:
 *         gldraw.sync_animation_start(uidata.animation_blocks_count, uidata.animation_blocks)
 *         uidata.animation_changed = 0             # <<<<<<<<<<<<<<
 *     if uidata.shaders_changed:
 *         renderdata.shader_changed = True
 */
    __pyx_v_11_glarea_es2_uidata.animation_changed = 0;

    /* "_glarea_es2.pyx":626
 *         gldraw.sync_animation_next(uidata.angle, uidata.rotation_x, uidata.rotation_y, uidata.rotation_z)
 *         uidata.animation_changed = 0
 *     elif uidata.animation_changed == 1:             # <<<<<<<<<<<<<<
 *         gldraw.sync_animation_start(uidata.animation_blocks_count, uidata.animation_blocks)
 *         uidata.animation_changed = 0
 */
    break;
    default: break;
  }

  /* "_glarea_es2.pyx":629
 *         gldraw.sync_animation_start(uidata.animation_blocks_count, uidata.animation_blocks)
 *         uidata.animation_changed = 0
 *     if uidata.shaders_changed:             # <<<<<<<<<<<<<<
 *         renderdata.shader_changed = True
 *         renderdata.shader_vertsrc = uidata.shader_vertsrc
 */
  __pyx_t_1 = (__pyx_v_11_glarea_es2_uidata.shaders_changed != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":630
 *         uidata.animation_changed = 0
 *     if uidata.shaders_changed:
 *         renderdata.shader_changed = True             # <<<<<<<<<<<<<<
 *         renderdata.shader_vertsrc = uidata.shader_vertsrc
 *         renderdata.shader_fragsrc = uidata.shader_fragsrc
 */
    __pyx_v_11_glarea_es2_renderdata.shader_changed = 1;

    /* "_glarea_es2.pyx":631
 *     if uidata.shaders_changed:
 *         renderdata.shader_changed = True
 *         renderdata.shader_vertsrc = uidata.shader_vertsrc             # <<<<<<<<<<<<<<
 *         renderdata.shader_fragsrc = uidata.shader_fragsrc
 *         uidata.shaders_changed = False
 */
    __pyx_t_3 = __pyx_v_11_glarea_es2_uidata.shader_vertsrc;
    __pyx_v_11_glarea_es2_renderdata.shader_vertsrc = __pyx_t_3;

    /* "_glarea_es2.pyx":632
 *         renderdata.shader_changed = True
 *         renderdata.shader_vertsrc = uidata.shader_vertsrc
 *         renderdata.shader_fragsrc = uidata.shader_fragsrc             # <<<<<<<<<<<<<<
 *         uidata.shaders_changed = False
 * 
 */
    __pyx_t_3 = __pyx_v_11_glarea_es2_uidata.shader_fragsrc;
    __pyx_v_11_glarea_es2_renderdata.shader_fragsrc = __pyx_t_3;

    /* "_glarea_es2.pyx":633
 *         renderdata.shader_vertsrc = uidata.shader_vertsrc
 *         renderdata.shader_fragsrc = uidata.shader_fragsrc
 *         uidata.shaders_changed = False             # <<<<<<<<<<<<<<
 * 
 * ### GL state
 */
    __pyx_v_11_glarea_es2_uidata.shaders_changed = 0;

    /* "_glarea_es2.pyx":629
 *         gldraw.sync_animation_start(uidata.animation_blocks_count, uidata.animation_blocks)
 *         uidata.animation_changed = 0
 *     if uidata.shaders_changed:             # <<<<<<<<<<<<<<
 *         renderdata.shader_changed = True
 *         renderdata.shader_vertsrc = uidata.shader_vertsrc
 */
  }

  /* "_glarea_es2.pyx":592
 * 
 * ##pxm-FUNC PD nogil
 * cdef void sync() nogil:             # <<<<<<<<<<<<<<
 *     uidata.synced = True
 *     if uidata.background_changed:
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":638
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_string(char *msg, GLenum name) nogil:             # <<<<<<<<<<<<<<
 *     printf('%s %s\n', msg, <char*>glGetString(name)) #px/
 *     #printf('%s %s\n', msg, glGetString(name))
 */

static void __pyx_f_11_glarea_es2__gl_print_string(char *__pyx_v_msg, GLenum __pyx_v_name) {

  /* "_glarea_es2.pyx":639
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_string(char *msg, GLenum name) nogil:
 *     printf('%s %s\n', msg, <char*>glGetString(name)) #px/             # <<<<<<<<<<<<<<
 *     #printf('%s %s\n', msg, glGetString(name))
 * 
 */
  printf(((char const *)"%s %s\n"), __pyx_v_msg, ((char *)glGetString(__pyx_v_name)));

  /* "_glarea_es2.pyx":638
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_string(char *msg, GLenum name) nogil:             # <<<<<<<<<<<<<<
 *     printf('%s %s\n', msg, <char*>glGetString(name)) #px/
 *     #printf('%s %s\n', msg, glGetString(name))
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":643
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_float(char *msg, GLenum name) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLfloat i #px+
 *     glGetFloatv(name, &i) #px/
 */

static void __pyx_f_11_glarea_es2__gl_print_float(char *__pyx_v_msg, GLenum __pyx_v_name) {
  GLfloat __pyx_v_i;

  /* "_glarea_es2.pyx":645
 * cdef void _gl_print_float(char *msg, GLenum name) nogil:
 *     cdef GLfloat i #px+
 *     glGetFloatv(name, &i) #px/             # <<<<<<<<<<<<<<
 *     #i = glGetFloatv(name)
 *     printf('%s %f\n', msg, i)
 */
  glGetFloatv(__pyx_v_name, (&__pyx_v_i));

  /* "_glarea_es2.pyx":647
 *     glGetFloatv(name, &i) #px/
 *     #i = glGetFloatv(name)
 *     printf('%s %f\n', msg, i)             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  printf(((char const *)"%s %f\n"), __pyx_v_msg, __pyx_v_i);

  /* "_glarea_es2.pyx":643
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_float(char *msg, GLenum name) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLfloat i #px+
 *     glGetFloatv(name, &i) #px/
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":650
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_integer(char *msg, GLenum name) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint i #px+
 *     glGetIntegerv(name, &i) #px/
 */

static void __pyx_f_11_glarea_es2__gl_print_integer(char *__pyx_v_msg, GLenum __pyx_v_name) {
  GLint __pyx_v_i;

  /* "_glarea_es2.pyx":652
 * cdef void _gl_print_integer(char *msg, GLenum name) nogil:
 *     cdef GLint i #px+
 *     glGetIntegerv(name, &i) #px/             # <<<<<<<<<<<<<<
 *     #i = glGetIntegerv(name)
 *     printf('%s %d\n', msg, i)
 */
  glGetIntegerv(__pyx_v_name, (&__pyx_v_i));

  /* "_glarea_es2.pyx":654
 *     glGetIntegerv(name, &i) #px/
 *     #i = glGetIntegerv(name)
 *     printf('%s %d\n', msg, i)             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  printf(((char const *)"%s %d\n"), __pyx_v_msg, __pyx_v_i);

  /* "_glarea_es2.pyx":650
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_integer(char *msg, GLenum name) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint i #px+
 *     glGetIntegerv(name, &i) #px/
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":657
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_bool(char *msg, GLenum name) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLboolean i #px+
 *     glGetBooleanv(name, &i) #px+
 */

static void __pyx_f_11_glarea_es2__gl_print_bool(char *__pyx_v_msg, GLenum __pyx_v_name) {
  GLboolean __pyx_v_i;

  /* "_glarea_es2.pyx":659
 * cdef void _gl_print_bool(char *msg, GLenum name) nogil:
 *     cdef GLboolean i #px+
 *     glGetBooleanv(name, &i) #px+             # <<<<<<<<<<<<<<
 *     printf('%s %d\n', msg, <int>i) #px/
 *     #printf('%s %d\n', msg, glGetBooleanv(name))
 */
  glGetBooleanv(__pyx_v_name, (&__pyx_v_i));

  /* "_glarea_es2.pyx":660
 *     cdef GLboolean i #px+
 *     glGetBooleanv(name, &i) #px+
 *     printf('%s %d\n', msg, <int>i) #px/             # <<<<<<<<<<<<<<
 *     #printf('%s %d\n', msg, glGetBooleanv(name))
 * 
 */
  printf(((char const *)"%s %d\n"), __pyx_v_msg, ((int)__pyx_v_i));

  /* "_glarea_es2.pyx":657
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_bool(char *msg, GLenum name) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLboolean i #px+
 *     glGetBooleanv(name, &i) #px+
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":664
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_init() nogil:             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_MSGGL:
 *         puts('GL Strings:')
 */

static void __pyx_f_11_glarea_es2_gl_init(void) {
  int __pyx_t_1;

  /* "_glarea_es2.pyx":665
 * ##pxm-FUNC PD nogil
 * cdef void gl_init() nogil:
 *     if debug & DEBUG_MSGGL:             # <<<<<<<<<<<<<<
 *         puts('GL Strings:')
 *         _gl_print_string('  GL Vendor:', GL_VENDOR)
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_MSGGL) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":666
 * cdef void gl_init() nogil:
 *     if debug & DEBUG_MSGGL:
 *         puts('GL Strings:')             # <<<<<<<<<<<<<<
 *         _gl_print_string('  GL Vendor:', GL_VENDOR)
 *         _gl_print_string('  GL Renderer:', GL_RENDERER)
 */
    puts(((char const *)"GL Strings:"));

    /* "_glarea_es2.pyx":667
 *     if debug & DEBUG_MSGGL:
 *         puts('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_11_glarea_es2__gl_print_string(((char *)"  GL Vendor:"), GL_VENDOR);

    /* "_glarea_es2.pyx":668
 *         puts('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_11_glarea_es2__gl_print_string(((char *)"  GL Renderer:"), GL_RENDERER);

    /* "_glarea_es2.pyx":669
 *         _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_11_glarea_es2__gl_print_string(((char *)"  GL Version:"), GL_VERSION);

    /* "_glarea_es2.pyx":670
 *         _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_11_glarea_es2__gl_print_string(((char *)"  GL Shading Language Version:"), GL_SHADING_LANGUAGE_VERSION);

    /* "_glarea_es2.pyx":672
 *         _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_11_glarea_es2__gl_print_integer(((char *)"  GL_SAMPLE_BUFFERS:"), GL_SAMPLE_BUFFERS);

    /* "_glarea_es2.pyx":673
 *         #_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_11_glarea_es2__gl_print_float(((char *)"  GL_SAMPLE_COVERAGE_VALUE:"), GL_SAMPLE_COVERAGE_VALUE);

    /* "_glarea_es2.pyx":674
 *         _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 'es2' == 'ogl': #px/
 */
    __pyx_f_11_glarea_es2__gl_print_bool(((char *)"  GL_SAMPLE_COVERAGE_INVERT:"), GL_SAMPLE_COVERAGE_INVERT);

    /* "_glarea_es2.pyx":675
 *         _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 'es2' == 'ogl': #px/
 *         #if True:
 */
    __pyx_f_11_glarea_es2__gl_print_integer(((char *)"  GL_SAMPLES:"), GL_SAMPLES);

    /* "_glarea_es2.pyx":681
 *         #print('  GL_SAMPLE_ALPHA_TO_COVERAGE:', glIsEnabled(GL_SAMPLE_ALPHA_TO_COVERAGE))
 *         #print('  GL_SAMPLE_COVERAGE:', glIsEnabled(GL_SAMPLE_COVERAGE))
 *         _gl_print_integer('  GL_MAX_VERTEX_ATTRIBS:', GL_MAX_VERTEX_ATTRIBS)             # <<<<<<<<<<<<<<
 *         _gl_print_integer('  GL_MAX_TEXTURE_SIZE:', GL_MAX_TEXTURE_SIZE)
 *     gldraw.gl_init_buffers()
 */
    __pyx_f_11_glarea_es2__gl_print_integer(((char *)"  GL_MAX_VERTEX_ATTRIBS:"), GL_MAX_VERTEX_ATTRIBS);

    /* "_glarea_es2.pyx":682
 *         #print('  GL_SAMPLE_COVERAGE:', glIsEnabled(GL_SAMPLE_COVERAGE))
 *         _gl_print_integer('  GL_MAX_VERTEX_ATTRIBS:', GL_MAX_VERTEX_ATTRIBS)
 *         _gl_print_integer('  GL_MAX_TEXTURE_SIZE:', GL_MAX_TEXTURE_SIZE)             # <<<<<<<<<<<<<<
 *     gldraw.gl_init_buffers()
 *     if debug & DEBUG_DRAW:
 */
    __pyx_f_11_glarea_es2__gl_print_integer(((char *)"  GL_MAX_TEXTURE_SIZE:"), GL_MAX_TEXTURE_SIZE);

    /* "_glarea_es2.pyx":665
 * ##pxm-FUNC PD nogil
 * cdef void gl_init() nogil:
 *     if debug & DEBUG_MSGGL:             # <<<<<<<<<<<<<<
 *         puts('GL Strings:')
 *         _gl_print_string('  GL Vendor:', GL_VENDOR)
 */
  }

  /* "_glarea_es2.pyx":683
 *         _gl_print_integer('  GL_MAX_VERTEX_ATTRIBS:', GL_MAX_VERTEX_ATTRIBS)
 *         _gl_print_integer('  GL_MAX_TEXTURE_SIZE:', GL_MAX_TEXTURE_SIZE)
 *     gldraw.gl_init_buffers()             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_DRAW:
 *         gl_create_hud_program()
 */
  __pyx_f_11_gldraw_es2_gl_init_buffers();

  /* "_glarea_es2.pyx":684
 *         _gl_print_integer('  GL_MAX_TEXTURE_SIZE:', GL_MAX_TEXTURE_SIZE)
 *     gldraw.gl_init_buffers()
 *     if debug & DEBUG_DRAW:             # <<<<<<<<<<<<<<
 *         gl_create_hud_program()
 *     gl_create_pick_program()
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_DRAW) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":685
 *     gldraw.gl_init_buffers()
 *     if debug & DEBUG_DRAW:
 *         gl_create_hud_program()             # <<<<<<<<<<<<<<
 *     gl_create_pick_program()
 * 
 */
    __pyx_f_11_glarea_es2_gl_create_hud_program();

    /* "_glarea_es2.pyx":684
 *         _gl_print_integer('  GL_MAX_TEXTURE_SIZE:', GL_MAX_TEXTURE_SIZE)
 *     gldraw.gl_init_buffers()
 *     if debug & DEBUG_DRAW:             # <<<<<<<<<<<<<<
 *         gl_create_hud_program()
 *     gl_create_pick_program()
 */
  }

  /* "_glarea_es2.pyx":686
 *     if debug & DEBUG_DRAW:
 *         gl_create_hud_program()
 *     gl_create_pick_program()             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC PD nogil
 */
  __pyx_f_11_glarea_es2_gl_create_pick_program();

  /* "_glarea_es2.pyx":664
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_init() nogil:             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_MSGGL:
 *         puts('GL Strings:')
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":689
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_exit() nogil:             # <<<<<<<<<<<<<<
 *     gldraw.gl_delete_buffers()
 *     if renderdata.prog_render > 0:  glDeleteProgram(renderdata.prog_render)
 */

static void __pyx_f_11_glarea_es2_gl_exit(void) {
  int __pyx_t_1;

  /* "_glarea_es2.pyx":690
 * ##pxm-FUNC PD nogil
 * cdef void gl_exit() nogil:
 *     gldraw.gl_delete_buffers()             # <<<<<<<<<<<<<<
 *     if renderdata.prog_render > 0:  glDeleteProgram(renderdata.prog_render)
 *     if renderdata.prog_hud > 0:     glDeleteProgram(renderdata.prog_hud)
 */
  __pyx_f_11_gldraw_es2_gl_delete_buffers();

  /* "_glarea_es2.pyx":691
 * cdef void gl_exit() nogil:
 *     gldraw.gl_delete_buffers()
 *     if renderdata.prog_render > 0:  glDeleteProgram(renderdata.prog_render)             # <<<<<<<<<<<<<<
 *     if renderdata.prog_hud > 0:     glDeleteProgram(renderdata.prog_hud)
 *     if renderdata.prog_pick > 0:    glDeleteProgram(renderdata.prog_pick)
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_renderdata.prog_render > 0) != 0);
  if (__pyx_t_1) {
    glDeleteProgram(__pyx_v_11_glarea_es2_renderdata.prog_render);
  }

  /* "_glarea_es2.pyx":692
 *     gldraw.gl_delete_buffers()
 *     if renderdata.prog_render > 0:  glDeleteProgram(renderdata.prog_render)
 *     if renderdata.prog_hud > 0:     glDeleteProgram(renderdata.prog_hud)             # <<<<<<<<<<<<<<
 *     if renderdata.prog_pick > 0:    glDeleteProgram(renderdata.prog_pick)
 *     renderdata.prog_render = 0
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_renderdata.prog_hud > 0) != 0);
  if (__pyx_t_1) {
    glDeleteProgram(__pyx_v_11_glarea_es2_renderdata.prog_hud);
  }

  /* "_glarea_es2.pyx":693
 *     if renderdata.prog_render > 0:  glDeleteProgram(renderdata.prog_render)
 *     if renderdata.prog_hud > 0:     glDeleteProgram(renderdata.prog_hud)
 *     if renderdata.prog_pick > 0:    glDeleteProgram(renderdata.prog_pick)             # <<<<<<<<<<<<<<
 *     renderdata.prog_render = 0
 *     renderdata.prog_hud = 0
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_renderdata.prog_pick > 0) != 0);
  if (__pyx_t_1) {
    glDeleteProgram(__pyx_v_11_glarea_es2_renderdata.prog_pick);
  }

  /* "_glarea_es2.pyx":694
 *     if renderdata.prog_hud > 0:     glDeleteProgram(renderdata.prog_hud)
 *     if renderdata.prog_pick > 0:    glDeleteProgram(renderdata.prog_pick)
 *     renderdata.prog_render = 0             # <<<<<<<<<<<<<<
 *     renderdata.prog_hud = 0
 *     renderdata.prog_pick = 0
 */
  __pyx_v_11_glarea_es2_renderdata.prog_render = 0;

  /* "_glarea_es2.pyx":695
 *     if renderdata.prog_pick > 0:    glDeleteProgram(renderdata.prog_pick)
 *     renderdata.prog_render = 0
 *     renderdata.prog_hud = 0             # <<<<<<<<<<<<<<
 *     renderdata.prog_pick = 0
 * 
 */
  __pyx_v_11_glarea_es2_renderdata.prog_hud = 0;

  /* "_glarea_es2.pyx":696
 *     renderdata.prog_render = 0
 *     renderdata.prog_hud = 0
 *     renderdata.prog_pick = 0             # <<<<<<<<<<<<<<
 * 
 * ### render functions
 */
  __pyx_v_11_glarea_es2_renderdata.prog_pick = 0;

  /* "_glarea_es2.pyx":689
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_exit() nogil:             # <<<<<<<<<<<<<<
 *     gldraw.gl_delete_buffers()
 *     if renderdata.prog_render > 0:  glDeleteProgram(renderdata.prog_render)
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":701
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_set_atlas_texture(int width, int height) nogil:             # <<<<<<<<<<<<<<
 *     cdef int i, x, w, h #px+
 *     cdef char *data = <char*>malloc(width*height*4) #px+
 */

static void __pyx_f_11_glarea_es2_gl_set_atlas_texture(int __pyx_v_width, int __pyx_v_height) {
  int __pyx_v_i;
  int __pyx_v_x;
  int __pyx_v_w;
  int __pyx_v_h;
  char *__pyx_v_data;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  char *__pyx_t_6;

  /* "_glarea_es2.pyx":703
 * cdef void gl_set_atlas_texture(int width, int height) nogil:
 *     cdef int i, x, w, h #px+
 *     cdef char *data = <char*>malloc(width*height*4) #px+             # <<<<<<<<<<<<<<
 *     memset(data, 0, width*height*4) #px+
 *     #FIXME: GL_INVALID_OPERATION, but it works, at least on the phone a call to glTexImage2D is needed before glTexSubImage2D
 */
  __pyx_v_data = ((char *)malloc(((__pyx_v_width * __pyx_v_height) * 4)));

  /* "_glarea_es2.pyx":704
 *     cdef int i, x, w, h #px+
 *     cdef char *data = <char*>malloc(width*height*4) #px+
 *     memset(data, 0, width*height*4) #px+             # <<<<<<<<<<<<<<
 *     #FIXME: GL_INVALID_OPERATION, but it works, at least on the phone a call to glTexImage2D is needed before glTexSubImage2D
 *     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data) #px+
 */
  memset(__pyx_v_data, 0, ((__pyx_v_width * __pyx_v_height) * 4));

  /* "_glarea_es2.pyx":706
 *     memset(data, 0, width*height*4) #px+
 *     #FIXME: GL_INVALID_OPERATION, but it works, at least on the phone a call to glTexImage2D is needed before glTexSubImage2D
 *     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data) #px+             # <<<<<<<<<<<<<<
 *     free(data) #px+
 *     for i in range(renderdata.atlaslen):
 */
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, __pyx_v_width, __pyx_v_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, __pyx_v_data);

  /* "_glarea_es2.pyx":707
 *     #FIXME: GL_INVALID_OPERATION, but it works, at least on the phone a call to glTexImage2D is needed before glTexSubImage2D
 *     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data) #px+
 *     free(data) #px+             # <<<<<<<<<<<<<<
 *     for i in range(renderdata.atlaslen):
 *         x, w, h = renderdata.atlasdata[i].x, renderdata.atlasdata[i].w, renderdata.atlasdata[i].h
 */
  free(__pyx_v_data);

  /* "_glarea_es2.pyx":708
 *     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data) #px+
 *     free(data) #px+
 *     for i in range(renderdata.atlaslen):             # <<<<<<<<<<<<<<
 *         x, w, h = renderdata.atlasdata[i].x, renderdata.atlasdata[i].w, renderdata.atlasdata[i].h
 *         data = renderdata.atlasdata[i].data
 */
  __pyx_t_1 = __pyx_v_11_glarea_es2_renderdata.atlaslen;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "_glarea_es2.pyx":709
 *     free(data) #px+
 *     for i in range(renderdata.atlaslen):
 *         x, w, h = renderdata.atlasdata[i].x, renderdata.atlasdata[i].w, renderdata.atlasdata[i].h             # <<<<<<<<<<<<<<
 *         data = renderdata.atlasdata[i].data
 *         glTexSubImage2D(GL_TEXTURE_2D, 0, x, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, data)
 */
    __pyx_t_3 = (__pyx_v_11_glarea_es2_renderdata.atlasdata[__pyx_v_i]).x;
    __pyx_t_4 = (__pyx_v_11_glarea_es2_renderdata.atlasdata[__pyx_v_i]).w;
    __pyx_t_5 = (__pyx_v_11_glarea_es2_renderdata.atlasdata[__pyx_v_i]).h;
    __pyx_v_x = __pyx_t_3;
    __pyx_v_w = __pyx_t_4;
    __pyx_v_h = __pyx_t_5;

    /* "_glarea_es2.pyx":710
 *     for i in range(renderdata.atlaslen):
 *         x, w, h = renderdata.atlasdata[i].x, renderdata.atlasdata[i].w, renderdata.atlasdata[i].h
 *         data = renderdata.atlasdata[i].data             # <<<<<<<<<<<<<<
 *         glTexSubImage2D(GL_TEXTURE_2D, 0, x, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, data)
 * 
 */
    __pyx_t_6 = (__pyx_v_11_glarea_es2_renderdata.atlasdata[__pyx_v_i]).data;
    __pyx_v_data = __pyx_t_6;

    /* "_glarea_es2.pyx":711
 *         x, w, h = renderdata.atlasdata[i].x, renderdata.atlasdata[i].w, renderdata.atlasdata[i].h
 *         data = renderdata.atlasdata[i].data
 *         glTexSubImage2D(GL_TEXTURE_2D, 0, x, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, data)             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
    glTexSubImage2D(GL_TEXTURE_2D, 0, __pyx_v_x, 0, __pyx_v_w, __pyx_v_h, GL_RGBA, GL_UNSIGNED_BYTE, __pyx_v_data);
  }

  /* "_glarea_es2.pyx":701
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_set_atlas_texture(int width, int height) nogil:             # <<<<<<<<<<<<<<
 *     cdef int i, x, w, h #px+
 *     cdef char *data = <char*>malloc(width*height*4) #px+
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":714
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_set_matrix(GLint location, gldraw.mat4 &matrix) nogil:             # <<<<<<<<<<<<<<
 *     glUniformMatrix4fv(location, 1, GL_FALSE, &matrix[0][0]) #px/
 *     #glUniformMatrix4fv(location, 1, GL_FALSE, matrix)
 */

static void __pyx_f_11_glarea_es2__gl_set_matrix(GLint __pyx_v_location, __pyx_t_11_gldraw_es2_vec4 *__pyx_v_matrix) {

  /* "_glarea_es2.pyx":715
 * ##pxm-FUNC P nogil
 * cdef void _gl_set_matrix(GLint location, gldraw.mat4 &matrix) nogil:
 *     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_es2.pyx":714
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_set_matrix(GLint location, gldraw.mat4 &matrix) nogil:             # <<<<<<<<<<<<<<
 *     glUniformMatrix4fv(location, 1, GL_FALSE, &matrix[0][0]) #px/
 *     #glUniformMatrix4fv(location, 1, GL_FALSE, matrix)
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":719
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_render() nogil:             # <<<<<<<<<<<<<<
 *     if renderdata.shader_changed:
 *         gl_create_render_program()
 */

static void __pyx_f_11_glarea_es2_gl_render(void) {
  int __pyx_t_1;

  /* "_glarea_es2.pyx":720
 * ##pxm-FUNC PD nogil
 * cdef void gl_render() nogil:
 *     if renderdata.shader_changed:             # <<<<<<<<<<<<<<
 *         gl_create_render_program()
 *         renderdata.shader_changed = False
 */
  __pyx_t_1 = (__pyx_v_11_glarea_es2_renderdata.shader_changed != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":721
 * cdef void gl_render() nogil:
 *     if renderdata.shader_changed:
 *         gl_create_render_program()             # <<<<<<<<<<<<<<
 *         renderdata.shader_changed = False
 *     glEnable(GL_DEPTH_TEST)
 */
    __pyx_f_11_glarea_es2_gl_create_render_program();

    /* "_glarea_es2.pyx":722
 *     if renderdata.shader_changed:
 *         gl_create_render_program()
 *         renderdata.shader_changed = False             # <<<<<<<<<<<<<<
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE)
 */
    __pyx_v_11_glarea_es2_renderdata.shader_changed = 0;

    /* "_glarea_es2.pyx":720
 * ##pxm-FUNC PD nogil
 * cdef void gl_render() nogil:
 *     if renderdata.shader_changed:             # <<<<<<<<<<<<<<
 *         gl_create_render_program()
 *         renderdata.shader_changed = False
 */
  }

  /* "_glarea_es2.pyx":723
 *         gl_create_render_program()
 *         renderdata.shader_changed = False
 *     glEnable(GL_DEPTH_TEST)             # <<<<<<<<<<<<<<
 *     glEnable(GL_CULL_FACE)
 *     glCullFace(GL_BACK)
 */
  glEnable(GL_DEPTH_TEST);

  /* "_glarea_es2.pyx":724
 *         renderdata.shader_changed = False
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE)             # <<<<<<<<<<<<<<
 *     glCullFace(GL_BACK)
 *     glFrontFace(GL_CCW)
 */
  glEnable(GL_CULL_FACE);

  /* "_glarea_es2.pyx":725
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE)
 *     glCullFace(GL_BACK)             # <<<<<<<<<<<<<<
 *     glFrontFace(GL_CCW)
 *     gldraw.gl_enable_data()
 */
  glCullFace(GL_BACK);

  /* "_glarea_es2.pyx":726
 *     glEnable(GL_CULL_FACE)
 *     glCullFace(GL_BACK)
 *     glFrontFace(GL_CCW)             # <<<<<<<<<<<<<<
 *     gldraw.gl_enable_data()
 *     glViewport(0, renderdata.y, renderdata.width, renderdata.height)
 */
  glFrontFace(GL_CCW);

  /* "_glarea_es2.pyx":727
 *     glCullFace(GL_BACK)
 *     glFrontFace(GL_CCW)
 *     gldraw.gl_enable_data()             # <<<<<<<<<<<<<<
 *     glViewport(0, renderdata.y, renderdata.width, renderdata.height)
 *     if debug & DEBUG_PICK:
 */
  __pyx_f_11_gldraw_es2_gl_enable_data();

  /* "_glarea_es2.pyx":728
 *     glFrontFace(GL_CCW)
 *     gldraw.gl_enable_data()
 *     glViewport(0, renderdata.y, renderdata.width, renderdata.height)             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_PICK:
 *         _set_picking_matrix_identity()
 */
  glViewport(0, __pyx_v_11_glarea_es2_renderdata.y, __pyx_v_11_glarea_es2_renderdata.width, __pyx_v_11_glarea_es2_renderdata.height);

  /* "_glarea_es2.pyx":729
 *     gldraw.gl_enable_data()
 *     glViewport(0, renderdata.y, renderdata.width, renderdata.height)
 *     if debug & DEBUG_PICK:             # <<<<<<<<<<<<<<
 *         _set_picking_matrix_identity()
 *         _gl_render_pick()
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_PICK) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":730
 *     glViewport(0, renderdata.y, renderdata.width, renderdata.height)
 *     if debug & DEBUG_PICK:
 *         _set_picking_matrix_identity()             # <<<<<<<<<<<<<<
 *         _gl_render_pick()
 *     else:
 */
    __pyx_f_11_glarea_es2__set_picking_matrix_identity();

    /* "_glarea_es2.pyx":731
 *     if debug & DEBUG_PICK:
 *         _set_picking_matrix_identity()
 *         _gl_render_pick()             # <<<<<<<<<<<<<<
 *     else:
 *         glUseProgram(renderdata.prog_render)
 */
    __pyx_f_11_glarea_es2__gl_render_pick();

    /* "_glarea_es2.pyx":729
 *     gldraw.gl_enable_data()
 *     glViewport(0, renderdata.y, renderdata.width, renderdata.height)
 *     if debug & DEBUG_PICK:             # <<<<<<<<<<<<<<
 *         _set_picking_matrix_identity()
 *         _gl_render_pick()
 */
    goto __pyx_L4;
  }

  /* "_glarea_es2.pyx":733
 *         _gl_render_pick()
 *     else:
 *         glUseProgram(renderdata.prog_render)             # <<<<<<<<<<<<<<
 *         IF 'es2' == 'ogl': #px/
 *         #if True:
 */
  /*else*/ {
    glUseProgram(__pyx_v_11_glarea_es2_renderdata.prog_render);

    /* "_glarea_es2.pyx":744
 *         ELSE: #px/
 *         #if True:
 *             glClearColor(renderdata.bg_red, renderdata.bg_green, renderdata.bg_blue, 1.)             # <<<<<<<<<<<<<<
 *         _gl_set_matrix(renderdata.projection_location, renderdata.projection_matrix)
 *         _gl_set_matrix(renderdata.modelview_location, renderdata.modelview_matrix)
 */
    glClearColor(__pyx_v_11_glarea_es2_renderdata.bg_red, __pyx_v_11_glarea_es2_renderdata.bg_green, __pyx_v_11_glarea_es2_renderdata.bg_blue, 1.);

    /* "_glarea_es2.pyx":745
 *         #if True:
 *             glClearColor(renderdata.bg_red, renderdata.bg_green, renderdata.bg_blue, 1.)
 *         _gl_set_matrix(renderdata.projection_location, renderdata.projection_matrix)             # <<<<<<<<<<<<<<
 *         _gl_set_matrix(renderdata.modelview_location, renderdata.modelview_matrix)
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 */
    __pyx_f_11_glarea_es2__gl_set_matrix(__pyx_v_11_glarea_es2_renderdata.projection_location, __pyx_v_11_glarea_es2_renderdata.projection_matrix);

    /* "_glarea_es2.pyx":746
 *             glClearColor(renderdata.bg_red, renderdata.bg_green, renderdata.bg_blue, 1.)
 *         _gl_set_matrix(renderdata.projection_location, renderdata.projection_matrix)
 *         _gl_set_matrix(renderdata.modelview_location, renderdata.modelview_matrix)             # <<<<<<<<<<<<<<
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *         gldraw.gl_draw_cube()
 */
    __pyx_f_11_glarea_es2__gl_set_matrix(__pyx_v_11_glarea_es2_renderdata.modelview_location, __pyx_v_11_glarea_es2_renderdata.modelview_matrix);

    /* "_glarea_es2.pyx":747
 *         _gl_set_matrix(renderdata.projection_location, renderdata.projection_matrix)
 *         _gl_set_matrix(renderdata.modelview_location, renderdata.modelview_matrix)
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)             # <<<<<<<<<<<<<<
 *         gldraw.gl_draw_cube()
 *     if debug & DEBUG_DRAW:
 */
    glClear((GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));

    /* "_glarea_es2.pyx":748
 *         _gl_set_matrix(renderdata.modelview_location, renderdata.modelview_matrix)
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *         gldraw.gl_draw_cube()             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_DRAW:
 *         gldraw.gl_draw_cube_debug()
 */
    __pyx_f_11_gldraw_es2_gl_draw_cube();
  }
  __pyx_L4:;

  /* "_glarea_es2.pyx":749
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *         gldraw.gl_draw_cube()
 *     if debug & DEBUG_DRAW:             # <<<<<<<<<<<<<<
 *         gldraw.gl_draw_cube_debug()
 *     glClearColor(0, 0, 0, 0)
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_DRAW) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":750
 *         gldraw.gl_draw_cube()
 *     if debug & DEBUG_DRAW:
 *         gldraw.gl_draw_cube_debug()             # <<<<<<<<<<<<<<
 *     glClearColor(0, 0, 0, 0)
 *     glUseProgram(0)
 */
    __pyx_f_11_gldraw_es2_gl_draw_cube_debug();

    /* "_glarea_es2.pyx":749
 *         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *         gldraw.gl_draw_cube()
 *     if debug & DEBUG_DRAW:             # <<<<<<<<<<<<<<
 *         gldraw.gl_draw_cube_debug()
 *     glClearColor(0, 0, 0, 0)
 */
  }

  /* "_glarea_es2.pyx":751
 *     if debug & DEBUG_DRAW:
 *         gldraw.gl_draw_cube_debug()
 *     glClearColor(0, 0, 0, 0)             # <<<<<<<<<<<<<<
 *     glUseProgram(0)
 *     gldraw.gl_disable_data()
 */
  glClearColor(0.0, 0.0, 0.0, 0.0);

  /* "_glarea_es2.pyx":752
 *         gldraw.gl_draw_cube_debug()
 *     glClearColor(0, 0, 0, 0)
 *     glUseProgram(0)             # <<<<<<<<<<<<<<
 *     gldraw.gl_disable_data()
 *     glDisable(GL_CULL_FACE)
 */
  glUseProgram(0);

  /* "_glarea_es2.pyx":753
 *     glClearColor(0, 0, 0, 0)
 *     glUseProgram(0)
 *     gldraw.gl_disable_data()             # <<<<<<<<<<<<<<
 *     glDisable(GL_CULL_FACE)
 *     glDisable(GL_DEPTH_TEST)
 */
  __pyx_f_11_gldraw_es2_gl_disable_data();

  /* "_glarea_es2.pyx":754
 *     glUseProgram(0)
 *     gldraw.gl_disable_data()
 *     glDisable(GL_CULL_FACE)             # <<<<<<<<<<<<<<
 *     glDisable(GL_DEPTH_TEST)
 * 
 */
  glDisable(GL_CULL_FACE);

  /* "_glarea_es2.pyx":755
 *     gldraw.gl_disable_data()
 *     glDisable(GL_CULL_FACE)
 *     glDisable(GL_DEPTH_TEST)             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC PD nogil
 */
  glDisable(GL_DEPTH_TEST);

  /* "_glarea_es2.pyx":719
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_render() nogil:             # <<<<<<<<<<<<<<
 *     if renderdata.shader_changed:
 *         gl_create_render_program()
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":758
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_render_select_debug() nogil:             # <<<<<<<<<<<<<<
 *     cdef GLfloat selectdata[12] #px/
 *     #selectdata = [0.] * 12
 */

static void __pyx_f_11_glarea_es2_gl_render_select_debug(void) {
  GLfloat __pyx_v_selectdata[12];

  /* "_glarea_es2.pyx":761
 *     cdef GLfloat selectdata[12] #px/
 *     #selectdata = [0.] * 12
 *     selectdata[0] = renderdata.debug_modelview1[0]             # <<<<<<<<<<<<<<
 *     selectdata[1] = renderdata.debug_modelview1[1]
 *     selectdata[2] = renderdata.debug_modelview1[2]
 */
  (__pyx_v_selectdata[0]) = (__pyx_v_11_glarea_es2_renderdata.debug_modelview1[0]);

  /* "_glarea_es2.pyx":762
 *     #selectdata = [0.] * 12
 *     selectdata[0] = renderdata.debug_modelview1[0]
 *     selectdata[1] = renderdata.debug_modelview1[1]             # <<<<<<<<<<<<<<
 *     selectdata[2] = renderdata.debug_modelview1[2]
 *     selectdata[3] = renderdata.debug_modelview2[0]
 */
  (__pyx_v_selectdata[1]) = (__pyx_v_11_glarea_es2_renderdata.debug_modelview1[1]);

  /* "_glarea_es2.pyx":763
 *     selectdata[0] = renderdata.debug_modelview1[0]
 *     selectdata[1] = renderdata.debug_modelview1[1]
 *     selectdata[2] = renderdata.debug_modelview1[2]             # <<<<<<<<<<<<<<
 *     selectdata[3] = renderdata.debug_modelview2[0]
 *     selectdata[4] = renderdata.debug_modelview2[1]
 */
  (__pyx_v_selectdata[2]) = (__pyx_v_11_glarea_es2_renderdata.debug_modelview1[2]);

  /* "_glarea_es2.pyx":764
 *     selectdata[1] = renderdata.debug_modelview1[1]
 *     selectdata[2] = renderdata.debug_modelview1[2]
 *     selectdata[3] = renderdata.debug_modelview2[0]             # <<<<<<<<<<<<<<
 *     selectdata[4] = renderdata.debug_modelview2[1]
 *     selectdata[5] = renderdata.debug_modelview2[2]
 */
  (__pyx_v_selectdata[3]) = (__pyx_v_11_glarea_es2_renderdata.debug_modelview2[0]);

  /* "_glarea_es2.pyx":765
 *     selectdata[2] = renderdata.debug_modelview1[2]
 *     selectdata[3] = renderdata.debug_modelview2[0]
 *     selectdata[4] = renderdata.debug_modelview2[1]             # <<<<<<<<<<<<<<
 *     selectdata[5] = renderdata.debug_modelview2[2]
 *     selectdata[6] = renderdata.debug_viewport1[0] / renderdata.width * 2 - 1
 */
  (__pyx_v_selectdata[4]) = (__pyx_v_11_glarea_es2_renderdata.debug_modelview2[1]);

  /* "_glarea_es2.pyx":766
 *     selectdata[3] = renderdata.debug_modelview2[0]
 *     selectdata[4] = renderdata.debug_modelview2[1]
 *     selectdata[5] = renderdata.debug_modelview2[2]             # <<<<<<<<<<<<<<
 *     selectdata[6] = renderdata.debug_viewport1[0] / renderdata.width * 2 - 1
 *     selectdata[7] = renderdata.debug_viewport1[1] / renderdata.height * 2 - 1
 */
  (__pyx_v_selectdata[5]) = (__pyx_v_11_glarea_es2_renderdata.debug_modelview2[2]);

  /* "_glarea_es2.pyx":767
 *     selectdata[4] = renderdata.debug_modelview2[1]
 *     selectdata[5] = renderdata.debug_modelview2[2]
 *     selectdata[6] = renderdata.debug_viewport1[0] / renderdata.width * 2 - 1             # <<<<<<<<<<<<<<
 *     selectdata[7] = renderdata.debug_viewport1[1] / renderdata.height * 2 - 1
 *     selectdata[8] = 0
 */
  if (unlikely(__pyx_v_11_glarea_es2_renderdata.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_ERR(0, 767, __pyx_L1_error)
  }
  (__pyx_v_selectdata[6]) = (((((double)(__pyx_v_11_glarea_es2_renderdata.debug_viewport1[0])) / ((double)__pyx_v_11_glarea_es2_renderdata.width)) * 2.0) - 1.0);

  /* "_glarea_es2.pyx":768
 *     selectdata[5] = renderdata.debug_modelview2[2]
 *     selectdata[6] = renderdata.debug_viewport1[0] / renderdata.width * 2 - 1
 *     selectdata[7] = renderdata.debug_viewport1[1] / renderdata.height * 2 - 1             # <<<<<<<<<<<<<<
 *     selectdata[8] = 0
 *     selectdata[9] = renderdata.debug_viewport2[0] / renderdata.width * 2 - 1
 */
  if (unlikely(__pyx_v_11_glarea_es2_renderdata.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_ERR(0, 768, __pyx_L1_error)
  }
  (__pyx_v_selectdata[7]) = (((((double)(__pyx_v_11_glarea_es2_renderdata.debug_viewport1[1])) / ((double)__pyx_v_11_glarea_es2_renderdata.height)) * 2.0) - 1.0);

  /* "_glarea_es2.pyx":769
 *     selectdata[6] = renderdata.debug_viewport1[0] / renderdata.width * 2 - 1
 *     selectdata[7] = renderdata.debug_viewport1[1] / renderdata.height * 2 - 1
 *     selectdata[8] = 0             # <<<<<<<<<<<<<<
 *     selectdata[9] = renderdata.debug_viewport2[0] / renderdata.width * 2 - 1
 *     selectdata[10] = renderdata.debug_viewport2[1] / renderdata.height * 2 - 1
 */
  (__pyx_v_selectdata[8]) = 0.0;

  /* "_glarea_es2.pyx":770
 *     selectdata[7] = renderdata.debug_viewport1[1] / renderdata.height * 2 - 1
 *     selectdata[8] = 0
 *     selectdata[9] = renderdata.debug_viewport2[0] / renderdata.width * 2 - 1             # <<<<<<<<<<<<<<
 *     selectdata[10] = renderdata.debug_viewport2[1] / renderdata.height * 2 - 1
 *     selectdata[11] = 0
 */
  if (unlikely(__pyx_v_11_glarea_es2_renderdata.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_ERR(0, 770, __pyx_L1_error)
  }
  (__pyx_v_selectdata[9]) = (((((double)(__pyx_v_11_glarea_es2_renderdata.debug_viewport2[0])) / ((double)__pyx_v_11_glarea_es2_renderdata.width)) * 2.0) - 1.0);

  /* "_glarea_es2.pyx":771
 *     selectdata[8] = 0
 *     selectdata[9] = renderdata.debug_viewport2[0] / renderdata.width * 2 - 1
 *     selectdata[10] = renderdata.debug_viewport2[1] / renderdata.height * 2 - 1             # <<<<<<<<<<<<<<
 *     selectdata[11] = 0
 *     gldraw.gl_enable_data()
 */
  if (unlikely(__pyx_v_11_glarea_es2_renderdata.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_ERR(0, 771, __pyx_L1_error)
  }
  (__pyx_v_selectdata[10]) = (((((double)(__pyx_v_11_glarea_es2_renderdata.debug_viewport2[1])) / ((double)__pyx_v_11_glarea_es2_renderdata.height)) * 2.0) - 1.0);

  /* "_glarea_es2.pyx":772
 *     selectdata[9] = renderdata.debug_viewport2[0] / renderdata.width * 2 - 1
 *     selectdata[10] = renderdata.debug_viewport2[1] / renderdata.height * 2 - 1
 *     selectdata[11] = 0             # <<<<<<<<<<<<<<
 *     gldraw.gl_enable_data()
 *     glUseProgram(renderdata.prog_render)
 */
  (__pyx_v_selectdata[11]) = 0.0;

  /* "_glarea_es2.pyx":773
 *     selectdata[10] = renderdata.debug_viewport2[1] / renderdata.height * 2 - 1
 *     selectdata[11] = 0
 *     gldraw.gl_enable_data()             # <<<<<<<<<<<<<<
 *     glUseProgram(renderdata.prog_render)
 *     glViewport(0, renderdata.y, renderdata.width, renderdata.height)
 */
  __pyx_f_11_gldraw_es2_gl_enable_data();

  /* "_glarea_es2.pyx":774
 *     selectdata[11] = 0
 *     gldraw.gl_enable_data()
 *     glUseProgram(renderdata.prog_render)             # <<<<<<<<<<<<<<
 *     glViewport(0, renderdata.y, renderdata.width, renderdata.height)
 *     gldraw.gl_draw_select_debug(&selectdata[0], sizeof(selectdata), renderdata.prog_hud) #px/
 */
  glUseProgram(__pyx_v_11_glarea_es2_renderdata.prog_render);

  /* "_glarea_es2.pyx":775
 *     gldraw.gl_enable_data()
 *     glUseProgram(renderdata.prog_render)
 *     glViewport(0, renderdata.y, renderdata.width, renderdata.height)             # <<<<<<<<<<<<<<
 *     gldraw.gl_draw_select_debug(&selectdata[0], sizeof(selectdata), renderdata.prog_hud) #px/
 *     #gldraw.gl_draw_select_debug(selectdata, 0, renderdata.prog_hud)
 */
  glViewport(0, __pyx_v_11_glarea_es2_renderdata.y, __pyx_v_11_glarea_es2_renderdata.width, __pyx_v_11_glarea_es2_renderdata.height);

  /* "_glarea_es2.pyx":776
 *     glUseProgram(renderdata.prog_render)
 *     glViewport(0, renderdata.y, renderdata.width, renderdata.height)
 *     gldraw.gl_draw_select_debug(&selectdata[0], sizeof(selectdata), renderdata.prog_hud) #px/             # <<<<<<<<<<<<<<
 *     #gldraw.gl_draw_select_debug(selectdata, 0, renderdata.prog_hud)
 *     glUseProgram(0)
 */
  __pyx_f_11_gldraw_es2_gl_draw_select_debug((&(__pyx_v_selectdata[0])), (sizeof(__pyx_v_selectdata)), __pyx_v_11_glarea_es2_renderdata.prog_hud);

  /* "_glarea_es2.pyx":778
 *     gldraw.gl_draw_select_debug(&selectdata[0], sizeof(selectdata), renderdata.prog_hud) #px/
 *     #gldraw.gl_draw_select_debug(selectdata, 0, renderdata.prog_hud)
 *     glUseProgram(0)             # <<<<<<<<<<<<<<
 *     gldraw.gl_disable_data()
 * 
 */
  glUseProgram(0);

  /* "_glarea_es2.pyx":779
 *     #gldraw.gl_draw_select_debug(selectdata, 0, renderdata.prog_hud)
 *     glUseProgram(0)
 *     gldraw.gl_disable_data()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_f_11_gldraw_es2_gl_disable_data();

  /* "_glarea_es2.pyx":758
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_render_select_debug() nogil:             # <<<<<<<<<<<<<<
 *     cdef GLfloat selectdata[12] #px/
 *     #selectdata = [0.] * 12
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("_glarea_es2.gl_render_select_debug", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 1);
  __pyx_L0:;
}

/* "_glarea_es2.pyx":785
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_render_pick() nogil:             # <<<<<<<<<<<<<<
 *     glUseProgram(renderdata.prog_pick)
 *     IF 'es2' == 'ogl': #px/
 */

static void __pyx_f_11_glarea_es2__gl_render_pick(void) {

  /* "_glarea_es2.pyx":786
 * ##pxm-FUNC P nogil
 * cdef void _gl_render_pick() nogil:
 *     glUseProgram(renderdata.prog_pick)             # <<<<<<<<<<<<<<
 *     IF 'es2' == 'ogl': #px/
 *     #if True:
 */
  glUseProgram(__pyx_v_11_glarea_es2_renderdata.prog_pick);

  /* "_glarea_es2.pyx":790
 *     #if True:
 *         glDisable(GL_MULTISAMPLE)
 *     glClearColor(0., 0., 0., 1.)             # <<<<<<<<<<<<<<
 *     _gl_set_matrix(renderdata.picking_location, renderdata.picking_matrix)
 *     _gl_set_matrix(renderdata.projection_pick_location, renderdata.projection_matrix)
 */
  glClearColor(0., 0., 0., 1.);

  /* "_glarea_es2.pyx":791
 *         glDisable(GL_MULTISAMPLE)
 *     glClearColor(0., 0., 0., 1.)
 *     _gl_set_matrix(renderdata.picking_location, renderdata.picking_matrix)             # <<<<<<<<<<<<<<
 *     _gl_set_matrix(renderdata.projection_pick_location, renderdata.projection_matrix)
 *     _gl_set_matrix(renderdata.modelview_pick_location, renderdata.modelview_matrix)
 */
  __pyx_f_11_glarea_es2__gl_set_matrix(__pyx_v_11_glarea_es2_renderdata.picking_location, __pyx_v_11_glarea_es2_renderdata.picking_matrix);

  /* "_glarea_es2.pyx":792
 *     glClearColor(0., 0., 0., 1.)
 *     _gl_set_matrix(renderdata.picking_location, renderdata.picking_matrix)
 *     _gl_set_matrix(renderdata.projection_pick_location, renderdata.projection_matrix)             # <<<<<<<<<<<<<<
 *     _gl_set_matrix(renderdata.modelview_pick_location, renderdata.modelview_matrix)
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 */
  __pyx_f_11_glarea_es2__gl_set_matrix(__pyx_v_11_glarea_es2_renderdata.projection_pick_location, __pyx_v_11_glarea_es2_renderdata.projection_matrix);

  /* "_glarea_es2.pyx":793
 *     _gl_set_matrix(renderdata.picking_location, renderdata.picking_matrix)
 *     _gl_set_matrix(renderdata.projection_pick_location, renderdata.projection_matrix)
 *     _gl_set_matrix(renderdata.modelview_pick_location, renderdata.modelview_matrix)             # <<<<<<<<<<<<<<
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *     gldraw.gl_pick_cube()
 */
  __pyx_f_11_glarea_es2__gl_set_matrix(__pyx_v_11_glarea_es2_renderdata.modelview_pick_location, __pyx_v_11_glarea_es2_renderdata.modelview_matrix);

  /* "_glarea_es2.pyx":794
 *     _gl_set_matrix(renderdata.projection_pick_location, renderdata.projection_matrix)
 *     _gl_set_matrix(renderdata.modelview_pick_location, renderdata.modelview_matrix)
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)             # <<<<<<<<<<<<<<
 *     gldraw.gl_pick_cube()
 * 
 */
  glClear((GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));

  /* "_glarea_es2.pyx":795
 *     _gl_set_matrix(renderdata.modelview_pick_location, renderdata.modelview_matrix)
 *     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
 *     gldraw.gl_pick_cube()             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC PD nogil
 */
  __pyx_f_11_gldraw_es2_gl_pick_cube();

  /* "_glarea_es2.pyx":785
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_render_pick() nogil:             # <<<<<<<<<<<<<<
 *     glUseProgram(renderdata.prog_pick)
 *     IF 'es2' == 'ogl': #px/
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":798
 * 
 * ##pxm-FUNC PD nogil
 * cdef int gl_pick_polygons() nogil:             # <<<<<<<<<<<<<<
 *     cdef unsigned char pixel[4] #px+
 *     cdef int index #px+
 */

static int __pyx_f_11_glarea_es2_gl_pick_polygons(void) {
  unsigned char __pyx_v_pixel[4];
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "_glarea_es2.pyx":802
 *     cdef int index #px+
 * 
 *     if not (0 <= renderdata.pick_x < renderdata.width and 0 <= renderdata.pick_y < renderdata.height):             # <<<<<<<<<<<<<<
 *         return 0
 *     _set_picking_matrix(renderdata.pick_x, renderdata.pick_y)
 */
  __pyx_t_2 = (0 <= __pyx_v_11_glarea_es2_renderdata.pick_x);
  if (__pyx_t_2) {
    __pyx_t_2 = (__pyx_v_11_glarea_es2_renderdata.pick_x < __pyx_v_11_glarea_es2_renderdata.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_11_glarea_es2_renderdata.pick_y);
  if (__pyx_t_3) {
    __pyx_t_3 = (__pyx_v_11_glarea_es2_renderdata.pick_y < __pyx_v_11_glarea_es2_renderdata.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_es2.pyx":803
 * 
 *     if not (0 <= renderdata.pick_x < renderdata.width and 0 <= renderdata.pick_y < renderdata.height):
 *         return 0             # <<<<<<<<<<<<<<
 *     _set_picking_matrix(renderdata.pick_x, renderdata.pick_y)
 *     glEnable(GL_DEPTH_TEST)
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "_glarea_es2.pyx":802
 *     cdef int index #px+
 * 
 *     if not (0 <= renderdata.pick_x < renderdata.width and 0 <= renderdata.pick_y < renderdata.height):             # <<<<<<<<<<<<<<
 *         return 0
 *     _set_picking_matrix(renderdata.pick_x, renderdata.pick_y)
 */
  }

  /* "_glarea_es2.pyx":804
 *     if not (0 <= renderdata.pick_x < renderdata.width and 0 <= renderdata.pick_y < renderdata.height):
 *         return 0
 *     _set_picking_matrix(renderdata.pick_x, renderdata.pick_y)             # <<<<<<<<<<<<<<
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE)
 */
  __pyx_f_11_glarea_es2__set_picking_matrix(__pyx_v_11_glarea_es2_renderdata.pick_x, __pyx_v_11_glarea_es2_renderdata.pick_y);

  /* "_glarea_es2.pyx":805
 *         return 0
 *     _set_picking_matrix(renderdata.pick_x, renderdata.pick_y)
 *     glEnable(GL_DEPTH_TEST)             # <<<<<<<<<<<<<<
 *     glEnable(GL_CULL_FACE)
 *     glCullFace(GL_BACK)
 */
  glEnable(GL_DEPTH_TEST);

  /* "_glarea_es2.pyx":806
 *     _set_picking_matrix(renderdata.pick_x, renderdata.pick_y)
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE)             # <<<<<<<<<<<<<<
 *     glCullFace(GL_BACK)
 *     glFrontFace(GL_CCW)
 */
  glEnable(GL_CULL_FACE);

  /* "_glarea_es2.pyx":807
 *     glEnable(GL_DEPTH_TEST)
 *     glEnable(GL_CULL_FACE)
 *     glCullFace(GL_BACK)             # <<<<<<<<<<<<<<
 *     glFrontFace(GL_CCW)
 *     gldraw.gl_enable_data()
 */
  glCullFace(GL_BACK);

  /* "_glarea_es2.pyx":808
 *     glEnable(GL_CULL_FACE)
 *     glCullFace(GL_BACK)
 *     glFrontFace(GL_CCW)             # <<<<<<<<<<<<<<
 *     gldraw.gl_enable_data()
 *     glViewport(0, 0, 1, 1)
 */
  glFrontFace(GL_CCW);

  /* "_glarea_es2.pyx":809
 *     glCullFace(GL_BACK)
 *     glFrontFace(GL_CCW)
 *     gldraw.gl_enable_data()             # <<<<<<<<<<<<<<
 *     glViewport(0, 0, 1, 1)
 *     _gl_render_pick()
 */
  __pyx_f_11_gldraw_es2_gl_enable_data();

  /* "_glarea_es2.pyx":810
 *     glFrontFace(GL_CCW)
 *     gldraw.gl_enable_data()
 *     glViewport(0, 0, 1, 1)             # <<<<<<<<<<<<<<
 *     _gl_render_pick()
 *     gldraw.gl_disable_data()
 */
  glViewport(0, 0, 1, 1);

  /* "_glarea_es2.pyx":811
 *     gldraw.gl_enable_data()
 *     glViewport(0, 0, 1, 1)
 *     _gl_render_pick()             # <<<<<<<<<<<<<<
 *     gldraw.gl_disable_data()
 *     glDisable(GL_CULL_FACE)
 */
  __pyx_f_11_glarea_es2__gl_render_pick();

  /* "_glarea_es2.pyx":812
 *     glViewport(0, 0, 1, 1)
 *     _gl_render_pick()
 *     gldraw.gl_disable_data()             # <<<<<<<<<<<<<<
 *     glDisable(GL_CULL_FACE)
 *     glDisable(GL_DEPTH_TEST)
 */
  __pyx_f_11_gldraw_es2_gl_disable_data();

  /* "_glarea_es2.pyx":813
 *     _gl_render_pick()
 *     gldraw.gl_disable_data()
 *     glDisable(GL_CULL_FACE)             # <<<<<<<<<<<<<<
 *     glDisable(GL_DEPTH_TEST)
 *     glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel) #px/
 */
  glDisable(GL_CULL_FACE);

  /* "_glarea_es2.pyx":814
 *     gldraw.gl_disable_data()
 *     glDisable(GL_CULL_FACE)
 *     glDisable(GL_DEPTH_TEST)             # <<<<<<<<<<<<<<
 *     glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel) #px/
 *     #pixel = glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, [[[0, 0, 0, 0]]])[0][0]
 */
  glDisable(GL_DEPTH_TEST);

  /* "_glarea_es2.pyx":815
 *     glDisable(GL_CULL_FACE)
 *     glDisable(GL_DEPTH_TEST)
 *     glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel) #px/             # <<<<<<<<<<<<<<
 *     #pixel = glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, [[[0, 0, 0, 0]]])[0][0]
 *     return pixel[0]<<4 | pixel[1] | pixel[2]>>4
 */
  glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, __pyx_v_pixel);

  /* "_glarea_es2.pyx":817
 *     glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel) #px/
 *     #pixel = glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, [[[0, 0, 0, 0]]])[0][0]
 *     return pixel[0]<<4 | pixel[1] | pixel[2]>>4             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  __pyx_r = ((((__pyx_v_pixel[0]) << 4) | (__pyx_v_pixel[1])) | ((__pyx_v_pixel[2]) >> 4));
  goto __pyx_L0;

  /* "_glarea_es2.pyx":798
 * 
 * ##pxm-FUNC PD nogil
 * cdef int gl_pick_polygons() nogil:             # <<<<<<<<<<<<<<
 *     cdef unsigned char pixel[4] #px+
 *     cdef int index #px+
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "_glarea_es2.pyx":820
 * 
 * ##pxm-FUNC P nogil
 * cdef void _modelview_to_viewport(float *vvect, int *mvect) nogil:             # <<<<<<<<<<<<<<
 *     cdef gldraw.vec4 *M #px+
 *     cdef gldraw.vec4 *P #px+
 */

static void __pyx_f_11_glarea_es2__modelview_to_viewport(float *__pyx_v_vvect, int *__pyx_v_mvect) {
  __pyx_t_11_gldraw_es2_vec4 *__pyx_v_M;
  __pyx_t_11_gldraw_es2_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;

  /* "_glarea_es2.pyx":825
 *     cdef float u0, u1, u2, v0, v1, v3 #px+
 * 
 *     M = <gldraw.vec4*>&renderdata.modelview_matrix[0][0] #px/             # <<<<<<<<<<<<<<
 *     #M = renderdata.modelview_matrix
 *     P = <gldraw.vec4*>&renderdata.projection_matrix[0][0] #px/
 */
  __pyx_v_M = ((__pyx_t_11_gldraw_es2_vec4 *)(&((__pyx_v_11_glarea_es2_renderdata.modelview_matrix[0])[0])));

  /* "_glarea_es2.pyx":827
 *     M = <gldraw.vec4*>&renderdata.modelview_matrix[0][0] #px/
 *     #M = renderdata.modelview_matrix
 *     P = <gldraw.vec4*>&renderdata.projection_matrix[0][0] #px/             # <<<<<<<<<<<<<<
 *     #P = renderdata.projection_matrix
 * 
 */
  __pyx_v_P = ((__pyx_t_11_gldraw_es2_vec4 *)(&((__pyx_v_11_glarea_es2_renderdata.projection_matrix[0])[0])));

  /* "_glarea_es2.pyx":832
 *     # 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_es2.pyx":833
 *     #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_es2.pyx":834
 *     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_es2.pyx":838
 * 
 *     # 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_es2.pyx":839
 *     # 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_es2.pyx":841
 *     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 * renderdata.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_es2.pyx":843
 *     v3 = P[0][3] * u0 + P[1][3] * u1 + P[2][3] * u2 + P[3][3] #* u3
 * 
 *     mvect[0] = int((v0 / v3 + 1) / 2 * renderdata.width)             # <<<<<<<<<<<<<<
 *     mvect[1] = int((v1 / v3 + 1) / 2 * renderdata.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_ERR(0, 843, __pyx_L1_error)
  }
  (__pyx_v_mvect[0]) = ((int)((((__pyx_v_v0 / __pyx_v_v3) + 1.0) / 2.0) * __pyx_v_11_glarea_es2_renderdata.width));

  /* "_glarea_es2.pyx":844
 * 
 *     mvect[0] = int((v0 / v3 + 1) / 2 * renderdata.width)
 *     mvect[1] = int((v1 / v3 + 1) / 2 * renderdata.height)             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  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_ERR(0, 844, __pyx_L1_error)
  }
  (__pyx_v_mvect[1]) = ((int)((((__pyx_v_v1 / __pyx_v_v3) + 1.0) / 2.0) * __pyx_v_11_glarea_es2_renderdata.height));

  /* "_glarea_es2.pyx":820
 * 
 * ##pxm-FUNC P nogil
 * cdef void _modelview_to_viewport(float *vvect, int *mvect) nogil:             # <<<<<<<<<<<<<<
 *     cdef gldraw.vec4 *M #px+
 *     cdef gldraw.vec4 *P #px+
 */

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

/* "_glarea_es2.pyx":847
 * 
 * ##pxm-FUNC P nogil
 * cdef void _viewport_to_modelview(int *vvect, float *mvect) nogil:             # <<<<<<<<<<<<<<
 *     cdef gldraw.vec4 *MT #px+
 *     cdef gldraw.vec4 *P #px+
 */

static void __pyx_f_11_glarea_es2__viewport_to_modelview(int *__pyx_v_vvect, float *__pyx_v_mvect) {
  __pyx_t_11_gldraw_es2_vec4 *__pyx_v_MT;
  __pyx_t_11_gldraw_es2_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;
  float __pyx_t_1;
  float __pyx_t_2;

  /* "_glarea_es2.pyx":852
 *     cdef float u0, u1, u2, u3, v0, v1, v2 #px+
 * 
 *     v0 = vvect[0] / renderdata.width * 2 - 1             # <<<<<<<<<<<<<<
 *     v1 = vvect[1] / renderdata.height * 2 - 1
 *     v2 = 0
 */
  if (unlikely(__pyx_v_11_glarea_es2_renderdata.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_ERR(0, 852, __pyx_L1_error)
  }
  __pyx_v_v0 = (((((double)(__pyx_v_vvect[0])) / ((double)__pyx_v_11_glarea_es2_renderdata.width)) * 2.0) - 1.0);

  /* "_glarea_es2.pyx":853
 * 
 *     v0 = vvect[0] / renderdata.width * 2 - 1
 *     v1 = vvect[1] / renderdata.height * 2 - 1             # <<<<<<<<<<<<<<
 *     v2 = 0
 *     #v3 = 1
 */
  if (unlikely(__pyx_v_11_glarea_es2_renderdata.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_ERR(0, 853, __pyx_L1_error)
  }
  __pyx_v_v1 = (((((double)(__pyx_v_vvect[1])) / ((double)__pyx_v_11_glarea_es2_renderdata.height)) * 2.0) - 1.0);

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

  /* "_glarea_es2.pyx":862
 *     # 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 = <gldraw.vec4*>&renderdata.projection_matrix[0][0] #px/             # <<<<<<<<<<<<<<
 *     #P = renderdata.projection_matrix
 *     # u = P^-1 * v
 */
  __pyx_v_P = ((__pyx_t_11_gldraw_es2_vec4 *)(&((__pyx_v_11_glarea_es2_renderdata.projection_matrix[0])[0])));

  /* "_glarea_es2.pyx":865
 *     #P = renderdata.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_ERR(0, 865, __pyx_L1_error)
  }
  __pyx_v_u0 = ((1.0 / ((__pyx_v_P[0])[0])) * __pyx_v_v0);

  /* "_glarea_es2.pyx":866
 *     # 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_ERR(0, 866, __pyx_L1_error)
  }
  __pyx_v_u1 = ((1.0 / ((__pyx_v_P[1])[1])) * __pyx_v_v1);

  /* "_glarea_es2.pyx":867
 *     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_ERR(0, 867, __pyx_L1_error)
  }
  __pyx_v_u2 = (1.0 / ((__pyx_v_P[2])[3]));

  /* "_glarea_es2.pyx":869
 *     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_ERR(0, 869, __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_ERR(0, 869, __pyx_L1_error)
  }
  __pyx_v_u3 = (__pyx_t_2 / ((__pyx_v_P[2])[3]));

  /* "_glarea_es2.pyx":876
 *     # 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 = <gldraw.vec4*>&renderdata.modelview_matrix[0][0] #px/             # <<<<<<<<<<<<<<
 *     #MT = renderdata.modelview_matrix
 *     # v = M^-1 * u
 */
  __pyx_v_MT = ((__pyx_t_11_gldraw_es2_vec4 *)(&((__pyx_v_11_glarea_es2_renderdata.modelview_matrix[0])[0])));

  /* "_glarea_es2.pyx":879
 *     #MT = renderdata.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_es2.pyx":880
 *     # 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_es2.pyx":881
 *     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_es2.pyx":884
 *     #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_ERR(0, 884, __pyx_L1_error)
  }
  (__pyx_v_mvect[0]) = (__pyx_v_v0 / __pyx_v_u3);

  /* "_glarea_es2.pyx":885
 * 
 *     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_ERR(0, 885, __pyx_L1_error)
  }
  (__pyx_v_mvect[1]) = (__pyx_v_v1 / __pyx_v_u3);

  /* "_glarea_es2.pyx":886
 *     mvect[0] = v0 / u3
 *     mvect[1] = v1 / u3
 *     mvect[2] = v2 / u3             # <<<<<<<<<<<<<<
 * 
 * def get_cursor_angle(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_ERR(0, 886, __pyx_L1_error)
  }
  (__pyx_v_mvect[2]) = (__pyx_v_v2 / __pyx_v_u3);

  /* "_glarea_es2.pyx":847
 * 
 * ##pxm-FUNC P nogil
 * cdef void _viewport_to_modelview(int *vvect, float *mvect) nogil:             # <<<<<<<<<<<<<<
 *     cdef gldraw.vec4 *MT #px+
 *     cdef gldraw.vec4 *P #px+
 */

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

/* "_glarea_es2.pyx":888
 *     mvect[2] = v2 / u3
 * 
 * def get_cursor_angle(d):             # <<<<<<<<<<<<<<
 *     cdef float angle #px+
 *     cdef int i #px+
 */

/* Python wrapper */
static PyObject *__pyx_pw_11_glarea_es2_33get_cursor_angle(PyObject *__pyx_self, PyObject *__pyx_v_d); /*proto*/
static PyMethodDef __pyx_mdef_11_glarea_es2_33get_cursor_angle = {"get_cursor_angle", (PyCFunction)__pyx_pw_11_glarea_es2_33get_cursor_angle, METH_O, 0};
static PyObject *__pyx_pw_11_glarea_es2_33get_cursor_angle(PyObject *__pyx_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_cursor_angle (wrapper)", 0);
  __pyx_r = __pyx_pf_11_glarea_es2_32get_cursor_angle(__pyx_self, ((PyObject *)__pyx_v_d));

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

static PyObject *__pyx_pf_11_glarea_es2_32get_cursor_angle(CYTHON_UNUSED PyObject *__pyx_self, 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;
  __Pyx_RefNannySetupContext("get_cursor_angle", 0);

  /* "_glarea_es2.pyx":892
 *     cdef int i #px+
 *     cdef float x, y #px+
 *     renderdata.debug_viewport1[0] = uidata.pick_x             # <<<<<<<<<<<<<<
 *     renderdata.debug_viewport1[1] = uidata.pick_y
 *     _viewport_to_modelview(renderdata.debug_viewport1, renderdata.debug_modelview1)
 */
  __pyx_t_1 = __pyx_v_11_glarea_es2_uidata.pick_x;
  (__pyx_v_11_glarea_es2_renderdata.debug_viewport1[0]) = __pyx_t_1;

  /* "_glarea_es2.pyx":893
 *     cdef float x, y #px+
 *     renderdata.debug_viewport1[0] = uidata.pick_x
 *     renderdata.debug_viewport1[1] = uidata.pick_y             # <<<<<<<<<<<<<<
 *     _viewport_to_modelview(renderdata.debug_viewport1, renderdata.debug_modelview1)
 *     for i in range(3):
 */
  __pyx_t_1 = __pyx_v_11_glarea_es2_uidata.pick_y;
  (__pyx_v_11_glarea_es2_renderdata.debug_viewport1[1]) = __pyx_t_1;

  /* "_glarea_es2.pyx":894
 *     renderdata.debug_viewport1[0] = uidata.pick_x
 *     renderdata.debug_viewport1[1] = uidata.pick_y
 *     _viewport_to_modelview(renderdata.debug_viewport1, renderdata.debug_modelview1)             # <<<<<<<<<<<<<<
 *     for i in range(3):
 *         renderdata.debug_modelview2[i] = d[i] + renderdata.debug_modelview1[i]
 */
  __pyx_f_11_glarea_es2__viewport_to_modelview(__pyx_v_11_glarea_es2_renderdata.debug_viewport1, __pyx_v_11_glarea_es2_renderdata.debug_modelview1);

  /* "_glarea_es2.pyx":895
 *     renderdata.debug_viewport1[1] = uidata.pick_y
 *     _viewport_to_modelview(renderdata.debug_viewport1, renderdata.debug_modelview1)
 *     for i in range(3):             # <<<<<<<<<<<<<<
 *         renderdata.debug_modelview2[i] = d[i] + renderdata.debug_modelview1[i]
 *     _modelview_to_viewport(renderdata.debug_modelview2, renderdata.debug_viewport2)
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "_glarea_es2.pyx":896
 *     _viewport_to_modelview(renderdata.debug_viewport1, renderdata.debug_modelview1)
 *     for i in range(3):
 *         renderdata.debug_modelview2[i] = d[i] + renderdata.debug_modelview1[i]             # <<<<<<<<<<<<<<
 *     _modelview_to_viewport(renderdata.debug_modelview2, renderdata.debug_viewport2)
 *     x = renderdata.debug_viewport1[0] - renderdata.debug_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)) __PYX_ERR(0, 896, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_11_glarea_es2_renderdata.debug_modelview1[__pyx_v_i])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __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_ERR(0, 896, __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_ERR(0, 896, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    (__pyx_v_11_glarea_es2_renderdata.debug_modelview2[__pyx_v_i]) = __pyx_t_5;
  }

  /* "_glarea_es2.pyx":897
 *     for i in range(3):
 *         renderdata.debug_modelview2[i] = d[i] + renderdata.debug_modelview1[i]
 *     _modelview_to_viewport(renderdata.debug_modelview2, renderdata.debug_viewport2)             # <<<<<<<<<<<<<<
 *     x = renderdata.debug_viewport1[0] - renderdata.debug_viewport2[0]
 *     y = renderdata.debug_viewport1[1] - renderdata.debug_viewport2[1]
 */
  __pyx_f_11_glarea_es2__modelview_to_viewport(__pyx_v_11_glarea_es2_renderdata.debug_modelview2, __pyx_v_11_glarea_es2_renderdata.debug_viewport2);

  /* "_glarea_es2.pyx":898
 *         renderdata.debug_modelview2[i] = d[i] + renderdata.debug_modelview1[i]
 *     _modelview_to_viewport(renderdata.debug_modelview2, renderdata.debug_viewport2)
 *     x = renderdata.debug_viewport1[0] - renderdata.debug_viewport2[0]             # <<<<<<<<<<<<<<
 *     y = renderdata.debug_viewport1[1] - renderdata.debug_viewport2[1]
 *     angle = atan2(x, y) * 180.0 / M_PI
 */
  __pyx_v_x = ((__pyx_v_11_glarea_es2_renderdata.debug_viewport1[0]) - (__pyx_v_11_glarea_es2_renderdata.debug_viewport2[0]));

  /* "_glarea_es2.pyx":899
 *     _modelview_to_viewport(renderdata.debug_modelview2, renderdata.debug_viewport2)
 *     x = renderdata.debug_viewport1[0] - renderdata.debug_viewport2[0]
 *     y = renderdata.debug_viewport1[1] - renderdata.debug_viewport2[1]             # <<<<<<<<<<<<<<
 *     angle = atan2(x, y) * 180.0 / M_PI
 *     return angle
 */
  __pyx_v_y = ((__pyx_v_11_glarea_es2_renderdata.debug_viewport1[1]) - (__pyx_v_11_glarea_es2_renderdata.debug_viewport2[1]));

  /* "_glarea_es2.pyx":900
 *     x = renderdata.debug_viewport1[0] - renderdata.debug_viewport2[0]
 *     y = renderdata.debug_viewport1[1] - renderdata.debug_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)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 900, __pyx_L1_error)
  }
  __pyx_v_angle = (__pyx_t_6 / M_PI);

  /* "_glarea_es2.pyx":901
 *     y = renderdata.debug_viewport1[1] - renderdata.debug_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_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "_glarea_es2.pyx":888
 *     mvect[2] = v2 / u3
 * 
 * def get_cursor_angle(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_es2.get_cursor_angle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "_glarea_es2.pyx":907
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_shader_log(GLuint shader) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint log_len #px+
 *     cdef GLsizei length #px+
 */

static void __pyx_f_11_glarea_es2__gl_print_shader_log(GLuint __pyx_v_shader) {
  GLint __pyx_v_log_len;
  GLsizei __pyx_v_length;
  char __pyx_v_log[0x400];
  int __pyx_t_1;

  /* "_glarea_es2.pyx":911
 *     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_es2.pyx":913
 *     glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_len) #px/
 *     #log_len = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:             # <<<<<<<<<<<<<<
 *         puts('==== shader info log:')
 *         glGetShaderInfoLog(shader, 1023, &length, log) #px/
 */
  __pyx_t_1 = ((__pyx_v_log_len > 0) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":914
 *     #log_len = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:
 *         puts('==== shader info log:')             # <<<<<<<<<<<<<<
 *         glGetShaderInfoLog(shader, 1023, &length, log) #px/
 *         #log = glGetShaderInfoLog(shader).decode('utf-8')
 */
    puts(((char const *)"==== shader info log:"));

    /* "_glarea_es2.pyx":915
 *     if log_len > 0:
 *         puts('==== shader info log:')
 *         glGetShaderInfoLog(shader, 1023, &length, log) #px/             # <<<<<<<<<<<<<<
 *         #log = glGetShaderInfoLog(shader).decode('utf-8')
 *         printf('%s', log)
 */
    glGetShaderInfoLog(__pyx_v_shader, 0x3FF, (&__pyx_v_length), __pyx_v_log);

    /* "_glarea_es2.pyx":917
 *         glGetShaderInfoLog(shader, 1023, &length, log) #px/
 *         #log = glGetShaderInfoLog(shader).decode('utf-8')
 *         printf('%s', log)             # <<<<<<<<<<<<<<
 *         puts('====')
 *     else:
 */
    printf(((char const *)"%s"), __pyx_v_log);

    /* "_glarea_es2.pyx":918
 *         #log = glGetShaderInfoLog(shader).decode('utf-8')
 *         printf('%s', log)
 *         puts('====')             # <<<<<<<<<<<<<<
 *     else:
 *         puts('==== empty shader info log')
 */
    puts(((char const *)"===="));

    /* "_glarea_es2.pyx":913
 *     glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_len) #px/
 *     #log_len = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:             # <<<<<<<<<<<<<<
 *         puts('==== shader info log:')
 *         glGetShaderInfoLog(shader, 1023, &length, log) #px/
 */
    goto __pyx_L3;
  }

  /* "_glarea_es2.pyx":920
 *         puts('====')
 *     else:
 *         puts('==== empty shader info log')             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  /*else*/ {
    puts(((char const *)"==== empty shader info log"));
  }
  __pyx_L3:;

  /* "_glarea_es2.pyx":907
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_shader_log(GLuint shader) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint log_len #px+
 *     cdef GLsizei length #px+
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":923
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_program_log(GLuint program) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint log_len #px+
 *     cdef GLsizei length #px+
 */

static void __pyx_f_11_glarea_es2__gl_print_program_log(GLuint __pyx_v_program) {
  GLint __pyx_v_log_len;
  GLsizei __pyx_v_length;
  char __pyx_v_log[0x400];
  int __pyx_t_1;

  /* "_glarea_es2.pyx":927
 *     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_es2.pyx":929
 *     glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_len) #px/
 *     #log_len = glGetProgramiv(program, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:             # <<<<<<<<<<<<<<
 *         puts('==== program info log:')
 *         glGetProgramInfoLog(program, 1023, &length, log) #px/
 */
  __pyx_t_1 = ((__pyx_v_log_len > 0) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":930
 *     #log_len = glGetProgramiv(program, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:
 *         puts('==== program info log:')             # <<<<<<<<<<<<<<
 *         glGetProgramInfoLog(program, 1023, &length, log) #px/
 *         #log = glGetProgramInfoLog(program).decode('utf-8')
 */
    puts(((char const *)"==== program info log:"));

    /* "_glarea_es2.pyx":931
 *     if log_len > 0:
 *         puts('==== program info log:')
 *         glGetProgramInfoLog(program, 1023, &length, log) #px/             # <<<<<<<<<<<<<<
 *         #log = glGetProgramInfoLog(program).decode('utf-8')
 *         printf('%s', log)
 */
    glGetProgramInfoLog(__pyx_v_program, 0x3FF, (&__pyx_v_length), __pyx_v_log);

    /* "_glarea_es2.pyx":933
 *         glGetProgramInfoLog(program, 1023, &length, log) #px/
 *         #log = glGetProgramInfoLog(program).decode('utf-8')
 *         printf('%s', log)             # <<<<<<<<<<<<<<
 *         puts('====')
 *     else:
 */
    printf(((char const *)"%s"), __pyx_v_log);

    /* "_glarea_es2.pyx":934
 *         #log = glGetProgramInfoLog(program).decode('utf-8')
 *         printf('%s', log)
 *         puts('====')             # <<<<<<<<<<<<<<
 *     else:
 *         puts('==== empty program info log')
 */
    puts(((char const *)"===="));

    /* "_glarea_es2.pyx":929
 *     glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_len) #px/
 *     #log_len = glGetProgramiv(program, GL_INFO_LOG_LENGTH)
 *     if log_len > 0:             # <<<<<<<<<<<<<<
 *         puts('==== program info log:')
 *         glGetProgramInfoLog(program, 1023, &length, log) #px/
 */
    goto __pyx_L3;
  }

  /* "_glarea_es2.pyx":936
 *         puts('====')
 *     else:
 *         puts('==== empty program info log')             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  /*else*/ {
    puts(((char const *)"==== empty program info log"));
  }
  __pyx_L3:;

  /* "_glarea_es2.pyx":923
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_print_program_log(GLuint program) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint log_len #px+
 *     cdef GLsizei length #px+
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":939
 * 
 * ##pxm-FUNC P nogil
 * cdef GLuint _gl_create_compiled_shader(GLenum shadertype, char *source) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLuint shader #px+
 *     cdef const_GLchar_ptr pchar #px+
 */

static GLuint __pyx_f_11_glarea_es2__gl_create_compiled_shader(GLenum __pyx_v_shadertype, char *__pyx_v_source) {
  GLuint __pyx_v_shader;
  const GLchar* __pyx_v_pchar;
  GLint __pyx_v_compile_status;
  GLuint __pyx_r;
  int __pyx_t_1;

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

  /* "_glarea_es2.pyx":945
 * 
 *     shader = glCreateShader(shadertype)
 *     if shader == 0:             # <<<<<<<<<<<<<<
 *         puts('Failed to create shader')
 *         return 0
 */
  __pyx_t_1 = ((__pyx_v_shader == 0) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":946
 *     shader = glCreateShader(shadertype)
 *     if shader == 0:
 *         puts('Failed to create shader')             # <<<<<<<<<<<<<<
 *         return 0
 *     pchar = <const_GLchar_ptr><char*>source #px+
 */
    puts(((char const *)"Failed to create shader"));

    /* "_glarea_es2.pyx":947
 *     if shader == 0:
 *         puts('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_es2.pyx":945
 * 
 *     shader = glCreateShader(shadertype)
 *     if shader == 0:             # <<<<<<<<<<<<<<
 *         puts('Failed to create shader')
 *         return 0
 */
  }

  /* "_glarea_es2.pyx":948
 *         puts('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_v_pchar = ((const GLchar*)((char *)__pyx_v_source));

  /* "_glarea_es2.pyx":949
 *         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_es2.pyx":951
 *     glShaderSource(shader, 1, &pchar, NULL) #px/
 *     #glShaderSource(shader, source.decode('utf-8')) # PyOpenGL needs str currently
 *     glCompileShader(shader)             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_MSGGL:
 *         glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &compile_status) #px/
 */
  glCompileShader(__pyx_v_shader);

  /* "_glarea_es2.pyx":952
 *     #glShaderSource(shader, source.decode('utf-8')) # PyOpenGL needs str currently
 *     glCompileShader(shader)
 *     if debug & DEBUG_MSGGL:             # <<<<<<<<<<<<<<
 *         glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &compile_status) #px/
 *         #compile_status = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_MSGGL) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":953
 *     glCompileShader(shader)
 *     if debug & DEBUG_MSGGL:
 *         glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &compile_status) #px/             # <<<<<<<<<<<<<<
 *         #compile_status = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 *         printf('GL_INFO_LOG_LENGTH %d\n', compile_status)
 */
    glGetShaderiv(__pyx_v_shader, GL_INFO_LOG_LENGTH, (&__pyx_v_compile_status));

    /* "_glarea_es2.pyx":955
 *         glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &compile_status) #px/
 *         #compile_status = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 *         printf('GL_INFO_LOG_LENGTH %d\n', compile_status)             # <<<<<<<<<<<<<<
 *         compile_status = compile_status <= 1
 *         if compile_status:
 */
    printf(((char const *)"GL_INFO_LOG_LENGTH %d\n"), __pyx_v_compile_status);

    /* "_glarea_es2.pyx":956
 *         #compile_status = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 *         printf('GL_INFO_LOG_LENGTH %d\n', compile_status)
 *         compile_status = compile_status <= 1             # <<<<<<<<<<<<<<
 *         if compile_status:
 *             glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) #px/
 */
    __pyx_v_compile_status = (__pyx_v_compile_status <= 1);

    /* "_glarea_es2.pyx":957
 *         printf('GL_INFO_LOG_LENGTH %d\n', compile_status)
 *         compile_status = compile_status <= 1
 *         if compile_status:             # <<<<<<<<<<<<<<
 *             glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) #px/
 *             #compile_status = glGetShaderiv(shader, GL_COMPILE_STATUS)
 */
    __pyx_t_1 = (__pyx_v_compile_status != 0);
    if (__pyx_t_1) {

      /* "_glarea_es2.pyx":958
 *         compile_status = compile_status <= 1
 *         if compile_status:
 *             glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) #px/             # <<<<<<<<<<<<<<
 *             #compile_status = glGetShaderiv(shader, GL_COMPILE_STATUS)
 *     else:
 */
      glGetShaderiv(__pyx_v_shader, GL_COMPILE_STATUS, (&__pyx_v_compile_status));

      /* "_glarea_es2.pyx":957
 *         printf('GL_INFO_LOG_LENGTH %d\n', compile_status)
 *         compile_status = compile_status <= 1
 *         if compile_status:             # <<<<<<<<<<<<<<
 *             glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) #px/
 *             #compile_status = glGetShaderiv(shader, GL_COMPILE_STATUS)
 */
    }

    /* "_glarea_es2.pyx":952
 *     #glShaderSource(shader, source.decode('utf-8')) # PyOpenGL needs str currently
 *     glCompileShader(shader)
 *     if debug & DEBUG_MSGGL:             # <<<<<<<<<<<<<<
 *         glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &compile_status) #px/
 *         #compile_status = glGetShaderiv(shader, GL_INFO_LOG_LENGTH)
 */
    goto __pyx_L4;
  }

  /* "_glarea_es2.pyx":961
 *             #compile_status = glGetShaderiv(shader, GL_COMPILE_STATUS)
 *     else:
 *         glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status) #px/             # <<<<<<<<<<<<<<
 *         #compile_status = glGetShaderiv(shader, GL_COMPILE_STATUS)
 *     if not compile_status:
 */
  /*else*/ {
    glGetShaderiv(__pyx_v_shader, GL_COMPILE_STATUS, (&__pyx_v_compile_status));
  }
  __pyx_L4:;

  /* "_glarea_es2.pyx":963
 *         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 shader
 */
  __pyx_t_1 = ((!(__pyx_v_compile_status != 0)) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":964
 *         #compile_status = glGetShaderiv(shader, GL_COMPILE_STATUS)
 *     if not compile_status:
 *         _gl_print_shader_log(shader)             # <<<<<<<<<<<<<<
 *     return shader
 * 
 */
    __pyx_f_11_glarea_es2__gl_print_shader_log(__pyx_v_shader);

    /* "_glarea_es2.pyx":963
 *         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 shader
 */
  }

  /* "_glarea_es2.pyx":965
 *     if not compile_status:
 *         _gl_print_shader_log(shader)
 *     return shader             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  __pyx_r = __pyx_v_shader;
  goto __pyx_L0;

  /* "_glarea_es2.pyx":939
 * 
 * ##pxm-FUNC P nogil
 * cdef GLuint _gl_create_compiled_shader(GLenum shadertype, char *source) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLuint shader #px+
 *     cdef const_GLchar_ptr pchar #px+
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "_glarea_es2.pyx":968
 * 
 * ##pxm-FUNC P nogil
 * cdef GLint _get_program_iv(GLuint program, GLenum pname) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint param #px+
 *     glGetProgramiv(program, pname, &param) #px/
 */

static GLint __pyx_f_11_glarea_es2__get_program_iv(GLuint __pyx_v_program, GLenum __pyx_v_pname) {
  GLint __pyx_v_param;
  GLint __pyx_r;

  /* "_glarea_es2.pyx":970
 * cdef GLint _get_program_iv(GLuint program, GLenum pname) nogil:
 *     cdef GLint param #px+
 *     glGetProgramiv(program, pname, &param) #px/             # <<<<<<<<<<<<<<
 *     #param = int(glGetProgramiv(program, pname))
 *     return param
 */
  glGetProgramiv(__pyx_v_program, __pyx_v_pname, (&__pyx_v_param));

  /* "_glarea_es2.pyx":972
 *     glGetProgramiv(program, pname, &param) #px/
 *     #param = int(glGetProgramiv(program, pname))
 *     return param             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  __pyx_r = __pyx_v_param;
  goto __pyx_L0;

  /* "_glarea_es2.pyx":968
 * 
 * ##pxm-FUNC P nogil
 * cdef GLint _get_program_iv(GLuint program, GLenum pname) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint param #px+
 *     glGetProgramiv(program, pname, &param) #px/
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "_glarea_es2.pyx":975
 * 
 * ##pxm-FUNC P nogil
 * cdef GLint _gl_print_program_info(GLuint program) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint link_status, info_log_length, param, aaml, auml #px+
 *     cdef int i #px+
 */

static GLint __pyx_f_11_glarea_es2__gl_print_program_info(GLuint __pyx_v_program) {
  GLint __pyx_v_link_status;
  GLint __pyx_v_info_log_length;
  GLint __pyx_v_param;
  GLint __pyx_v_aaml;
  GLint __pyx_v_auml;
  int __pyx_v_i;
  GLsizei __pyx_v_alength;
  GLint __pyx_v_asize;
  GLint __pyx_v_location;
  GLenum __pyx_v_atype;
  char __pyx_v_aname[0x400];
  GLint __pyx_r;
  GLint __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "_glarea_es2.pyx":983
 *     cdef char aname[1024] #px+
 * 
 *     printf('shader program info %d\n', program)             # <<<<<<<<<<<<<<
 *     glValidateProgram(program)
 *     printf('  delete status %d\n',   _get_program_iv(program, GL_DELETE_STATUS))
 */
  printf(((char const *)"shader program info %d\n"), __pyx_v_program);

  /* "_glarea_es2.pyx":984
 * 
 *     printf('shader program info %d\n', program)
 *     glValidateProgram(program)             # <<<<<<<<<<<<<<
 *     printf('  delete status %d\n',   _get_program_iv(program, GL_DELETE_STATUS))
 *     link_status = _get_program_iv(program, GL_LINK_STATUS)
 */
  glValidateProgram(__pyx_v_program);

  /* "_glarea_es2.pyx":985
 *     printf('shader program info %d\n', program)
 *     glValidateProgram(program)
 *     printf('  delete status %d\n',   _get_program_iv(program, GL_DELETE_STATUS))             # <<<<<<<<<<<<<<
 *     link_status = _get_program_iv(program, GL_LINK_STATUS)
 *     printf('  link status %d\n',     link_status)
 */
  printf(((char const *)"  delete status %d\n"), __pyx_f_11_glarea_es2__get_program_iv(__pyx_v_program, GL_DELETE_STATUS));

  /* "_glarea_es2.pyx":986
 *     glValidateProgram(program)
 *     printf('  delete status %d\n',   _get_program_iv(program, GL_DELETE_STATUS))
 *     link_status = _get_program_iv(program, GL_LINK_STATUS)             # <<<<<<<<<<<<<<
 *     printf('  link status %d\n',     link_status)
 *     printf('  validate status %d\n', _get_program_iv(program, GL_VALIDATE_STATUS))
 */
  __pyx_v_link_status = __pyx_f_11_glarea_es2__get_program_iv(__pyx_v_program, GL_LINK_STATUS);

  /* "_glarea_es2.pyx":987
 *     printf('  delete status %d\n',   _get_program_iv(program, GL_DELETE_STATUS))
 *     link_status = _get_program_iv(program, GL_LINK_STATUS)
 *     printf('  link status %d\n',     link_status)             # <<<<<<<<<<<<<<
 *     printf('  validate status %d\n', _get_program_iv(program, GL_VALIDATE_STATUS))
 *     info_log_length = _get_program_iv(program, GL_INFO_LOG_LENGTH)
 */
  printf(((char const *)"  link status %d\n"), __pyx_v_link_status);

  /* "_glarea_es2.pyx":988
 *     link_status = _get_program_iv(program, GL_LINK_STATUS)
 *     printf('  link status %d\n',     link_status)
 *     printf('  validate status %d\n', _get_program_iv(program, GL_VALIDATE_STATUS))             # <<<<<<<<<<<<<<
 *     info_log_length = _get_program_iv(program, GL_INFO_LOG_LENGTH)
 *     printf('  info log length %d\n', info_log_length)
 */
  printf(((char const *)"  validate status %d\n"), __pyx_f_11_glarea_es2__get_program_iv(__pyx_v_program, GL_VALIDATE_STATUS));

  /* "_glarea_es2.pyx":989
 *     printf('  link status %d\n',     link_status)
 *     printf('  validate status %d\n', _get_program_iv(program, GL_VALIDATE_STATUS))
 *     info_log_length = _get_program_iv(program, GL_INFO_LOG_LENGTH)             # <<<<<<<<<<<<<<
 *     printf('  info log length %d\n', info_log_length)
 *     printf('  attached shaders %d\n',_get_program_iv(program, GL_ATTACHED_SHADERS))
 */
  __pyx_v_info_log_length = __pyx_f_11_glarea_es2__get_program_iv(__pyx_v_program, GL_INFO_LOG_LENGTH);

  /* "_glarea_es2.pyx":990
 *     printf('  validate status %d\n', _get_program_iv(program, GL_VALIDATE_STATUS))
 *     info_log_length = _get_program_iv(program, GL_INFO_LOG_LENGTH)
 *     printf('  info log length %d\n', info_log_length)             # <<<<<<<<<<<<<<
 *     printf('  attached shaders %d\n',_get_program_iv(program, GL_ATTACHED_SHADERS))
 *     aaml = _get_program_iv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH)
 */
  printf(((char const *)"  info log length %d\n"), __pyx_v_info_log_length);

  /* "_glarea_es2.pyx":991
 *     info_log_length = _get_program_iv(program, GL_INFO_LOG_LENGTH)
 *     printf('  info log length %d\n', info_log_length)
 *     printf('  attached shaders %d\n',_get_program_iv(program, GL_ATTACHED_SHADERS))             # <<<<<<<<<<<<<<
 *     aaml = _get_program_iv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH)
 *     printf('  active attribute max length %d\n', aaml)
 */
  printf(((char const *)"  attached shaders %d\n"), __pyx_f_11_glarea_es2__get_program_iv(__pyx_v_program, GL_ATTACHED_SHADERS));

  /* "_glarea_es2.pyx":992
 *     printf('  info log length %d\n', info_log_length)
 *     printf('  attached shaders %d\n',_get_program_iv(program, GL_ATTACHED_SHADERS))
 *     aaml = _get_program_iv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH)             # <<<<<<<<<<<<<<
 *     printf('  active attribute max length %d\n', aaml)
 *     auml = _get_program_iv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH)
 */
  __pyx_v_aaml = __pyx_f_11_glarea_es2__get_program_iv(__pyx_v_program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH);

  /* "_glarea_es2.pyx":993
 *     printf('  attached shaders %d\n',_get_program_iv(program, GL_ATTACHED_SHADERS))
 *     aaml = _get_program_iv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH)
 *     printf('  active attribute max length %d\n', aaml)             # <<<<<<<<<<<<<<
 *     auml = _get_program_iv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH)
 *     printf('  active uniform max length %d\n', auml)
 */
  printf(((char const *)"  active attribute max length %d\n"), __pyx_v_aaml);

  /* "_glarea_es2.pyx":994
 *     aaml = _get_program_iv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH)
 *     printf('  active attribute max length %d\n', aaml)
 *     auml = _get_program_iv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH)             # <<<<<<<<<<<<<<
 *     printf('  active uniform max length %d\n', auml)
 * 
 */
  __pyx_v_auml = __pyx_f_11_glarea_es2__get_program_iv(__pyx_v_program, GL_ACTIVE_UNIFORM_MAX_LENGTH);

  /* "_glarea_es2.pyx":995
 *     printf('  active attribute max length %d\n', aaml)
 *     auml = _get_program_iv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH)
 *     printf('  active uniform max length %d\n', auml)             # <<<<<<<<<<<<<<
 * 
 *     glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &param) #px/
 */
  printf(((char const *)"  active uniform max length %d\n"), __pyx_v_auml);

  /* "_glarea_es2.pyx":997
 *     printf('  active uniform max length %d\n', auml)
 * 
 *     glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &param) #px/             # <<<<<<<<<<<<<<
 *     #param = glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES)
 *     printf('active attributes %d:\n', param)
 */
  glGetProgramiv(__pyx_v_program, GL_ACTIVE_ATTRIBUTES, (&__pyx_v_param));

  /* "_glarea_es2.pyx":999
 *     glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &param) #px/
 *     #param = glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES)
 *     printf('active attributes %d:\n', param)             # <<<<<<<<<<<<<<
 *     for i in range(param):
 *         glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) #px/
 */
  printf(((char const *)"active attributes %d:\n"), __pyx_v_param);

  /* "_glarea_es2.pyx":1000
 *     #param = glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES)
 *     printf('active attributes %d:\n', param)
 *     for i in range(param):             # <<<<<<<<<<<<<<
 *         glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) #px/
 *         #aname, asize, atype = glGetActiveAttrib(program, i); alength = len(aname)
 */
  __pyx_t_1 = __pyx_v_param;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "_glarea_es2.pyx":1001
 *     printf('active attributes %d:\n', param)
 *     for i in range(param):
 *         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, 0x3FF, (&__pyx_v_alength), (&__pyx_v_asize), (&__pyx_v_atype), __pyx_v_aname);

    /* "_glarea_es2.pyx":1003
 *         glGetActiveAttrib(program, i, 1023, &alength, &asize, &atype, aname) #px/
 *         #aname, asize, atype = glGetActiveAttrib(program, i); alength = len(aname)
 *         location = glGetAttribLocation(program, aname)             # <<<<<<<<<<<<<<
 *         printf('  %d %-*s length=%d size=%d type=%d location=%d\n', i, aaml+3, aname, alength, asize, atype, location)
 * 
 */
    __pyx_v_location = glGetAttribLocation(__pyx_v_program, __pyx_v_aname);

    /* "_glarea_es2.pyx":1004
 *         #aname, asize, atype = glGetActiveAttrib(program, i); alength = len(aname)
 *         location = glGetAttribLocation(program, aname)
 *         printf('  %d %-*s length=%d size=%d type=%d location=%d\n', i, aaml+3, aname, alength, asize, atype, location)             # <<<<<<<<<<<<<<
 * 
 *     glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &param) #px/
 */
    printf(((char const *)"  %d %-*s length=%d size=%d type=%d location=%d\n"), __pyx_v_i, (__pyx_v_aaml + 3), __pyx_v_aname, __pyx_v_alength, __pyx_v_asize, __pyx_v_atype, __pyx_v_location);
  }

  /* "_glarea_es2.pyx":1006
 *         printf('  %d %-*s length=%d size=%d type=%d location=%d\n', i, aaml+3, aname, alength, asize, atype, location)
 * 
 *     glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &param) #px/             # <<<<<<<<<<<<<<
 *     #param = glGetProgramiv(program, GL_ACTIVE_UNIFORMS)
 *     printf('active uniforms %d:\n', param)
 */
  glGetProgramiv(__pyx_v_program, GL_ACTIVE_UNIFORMS, (&__pyx_v_param));

  /* "_glarea_es2.pyx":1008
 *     glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &param) #px/
 *     #param = glGetProgramiv(program, GL_ACTIVE_UNIFORMS)
 *     printf('active uniforms %d:\n', param)             # <<<<<<<<<<<<<<
 *     for i in range(param):
 *         glGetActiveUniform(program, i, 1023, &alength, &asize, &atype, aname) #px/
 */
  printf(((char const *)"active uniforms %d:\n"), __pyx_v_param);

  /* "_glarea_es2.pyx":1009
 *     #param = glGetProgramiv(program, GL_ACTIVE_UNIFORMS)
 *     printf('active uniforms %d:\n', param)
 *     for i in range(param):             # <<<<<<<<<<<<<<
 *         glGetActiveUniform(program, i, 1023, &alength, &asize, &atype, aname) #px/
 *         #aname, asize, atype = glGetActiveUniform(program, i); alength = len(aname)
 */
  __pyx_t_1 = __pyx_v_param;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "_glarea_es2.pyx":1010
 *     printf('active uniforms %d:\n', param)
 *     for i in range(param):
 *         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, 0x3FF, (&__pyx_v_alength), (&__pyx_v_asize), (&__pyx_v_atype), __pyx_v_aname);

    /* "_glarea_es2.pyx":1012
 *         glGetActiveUniform(program, i, 1023, &alength, &asize, &atype, aname) #px/
 *         #aname, asize, atype = glGetActiveUniform(program, i); alength = len(aname)
 *         location = glGetUniformLocation(program, aname)             # <<<<<<<<<<<<<<
 *         printf('  %d %-*s length=%d size=%d type=%d location=%d\n', i, auml+3, aname, alength, asize, atype, location)
 *     return link_status and info_log_length <= 1
 */
    __pyx_v_location = glGetUniformLocation(__pyx_v_program, __pyx_v_aname);

    /* "_glarea_es2.pyx":1013
 *         #aname, asize, atype = glGetActiveUniform(program, i); alength = len(aname)
 *         location = glGetUniformLocation(program, aname)
 *         printf('  %d %-*s length=%d size=%d type=%d location=%d\n', i, auml+3, aname, alength, asize, atype, location)             # <<<<<<<<<<<<<<
 *     return link_status and info_log_length <= 1
 * 
 */
    printf(((char const *)"  %d %-*s length=%d size=%d type=%d location=%d\n"), __pyx_v_i, (__pyx_v_auml + 3), __pyx_v_aname, __pyx_v_alength, __pyx_v_asize, __pyx_v_atype, __pyx_v_location);
  }

  /* "_glarea_es2.pyx":1014
 *         location = glGetUniformLocation(program, aname)
 *         printf('  %d %-*s length=%d size=%d type=%d location=%d\n', i, auml+3, aname, alength, asize, atype, location)
 *     return link_status and info_log_length <= 1             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
  if (__pyx_v_link_status) {
  } else {
    __pyx_t_1 = __pyx_v_link_status;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_info_log_length <= 1);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L7_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "_glarea_es2.pyx":975
 * 
 * ##pxm-FUNC P nogil
 * cdef GLint _gl_print_program_info(GLuint program) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint link_status, info_log_length, param, aaml, auml #px+
 *     cdef int i #px+
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "_glarea_es2.pyx":1017
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_program_add_shaders(GLuint program, char *vertex_source, char *fragment_source) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLuint vertex_shader = 0, fragment_shader = 0 #px+
 *     cdef GLint link_status #px+
 */

static void __pyx_f_11_glarea_es2__gl_program_add_shaders(GLuint __pyx_v_program, char *__pyx_v_vertex_source, char *__pyx_v_fragment_source) {
  GLuint __pyx_v_vertex_shader;
  GLuint __pyx_v_fragment_shader;
  GLint __pyx_v_link_status;
  int __pyx_t_1;

  /* "_glarea_es2.pyx":1018
 * ##pxm-FUNC P nogil
 * cdef void _gl_program_add_shaders(GLuint program, char *vertex_source, char *fragment_source) nogil:
 *     cdef GLuint vertex_shader = 0, fragment_shader = 0 #px+             # <<<<<<<<<<<<<<
 *     cdef GLint link_status #px+
 * 
 */
  __pyx_v_vertex_shader = 0;
  __pyx_v_fragment_shader = 0;

  /* "_glarea_es2.pyx":1021
 *     cdef GLint link_status #px+
 * 
 *     if debug & DEBUG_MSGGL: puts('  creating vertex shader')             # <<<<<<<<<<<<<<
 *     vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *     if vertex_shader:
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_MSGGL) != 0);
  if (__pyx_t_1) {
    puts(((char const *)"  creating vertex shader"));
  }

  /* "_glarea_es2.pyx":1022
 * 
 *     if debug & DEBUG_MSGGL: puts('  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_11_glarea_es2__gl_create_compiled_shader(GL_VERTEX_SHADER, __pyx_v_vertex_source);

  /* "_glarea_es2.pyx":1023
 *     if debug & DEBUG_MSGGL: puts('  creating vertex shader')
 *     vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *     if vertex_shader:             # <<<<<<<<<<<<<<
 *         glAttachShader(program, vertex_shader)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_vertex_shader != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1024
 *     vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *     if vertex_shader:
 *         glAttachShader(program, vertex_shader)             # <<<<<<<<<<<<<<
 *     else:
 *         puts('error: no vertex shader')
 */
    glAttachShader(__pyx_v_program, __pyx_v_vertex_shader);

    /* "_glarea_es2.pyx":1023
 *     if debug & DEBUG_MSGGL: puts('  creating vertex shader')
 *     vertex_shader = _gl_create_compiled_shader(GL_VERTEX_SHADER, vertex_source)
 *     if vertex_shader:             # <<<<<<<<<<<<<<
 *         glAttachShader(program, vertex_shader)
 *     else:
 */
    goto __pyx_L4;
  }

  /* "_glarea_es2.pyx":1026
 *         glAttachShader(program, vertex_shader)
 *     else:
 *         puts('error: no vertex shader')             # <<<<<<<<<<<<<<
 * 
 *     if debug & DEBUG_MSGGL: puts('  creating fragment shader')
 */
  /*else*/ {
    puts(((char const *)"error: no vertex shader"));
  }
  __pyx_L4:;

  /* "_glarea_es2.pyx":1028
 *         puts('error: no vertex shader')
 * 
 *     if debug & DEBUG_MSGGL: puts('  creating fragment shader')             # <<<<<<<<<<<<<<
 *     fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *     if fragment_shader:
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_MSGGL) != 0);
  if (__pyx_t_1) {
    puts(((char const *)"  creating fragment shader"));
  }

  /* "_glarea_es2.pyx":1029
 * 
 *     if debug & DEBUG_MSGGL: puts('  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_11_glarea_es2__gl_create_compiled_shader(GL_FRAGMENT_SHADER, __pyx_v_fragment_source);

  /* "_glarea_es2.pyx":1030
 *     if debug & DEBUG_MSGGL: puts('  creating fragment shader')
 *     fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *     if fragment_shader:             # <<<<<<<<<<<<<<
 *         glAttachShader(program, fragment_shader)
 *     else:
 */
  __pyx_t_1 = (__pyx_v_fragment_shader != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1031
 *     fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *     if fragment_shader:
 *         glAttachShader(program, fragment_shader)             # <<<<<<<<<<<<<<
 *     else:
 *         puts('error: no fragment shader')
 */
    glAttachShader(__pyx_v_program, __pyx_v_fragment_shader);

    /* "_glarea_es2.pyx":1030
 *     if debug & DEBUG_MSGGL: puts('  creating fragment shader')
 *     fragment_shader = _gl_create_compiled_shader(GL_FRAGMENT_SHADER, fragment_source)
 *     if fragment_shader:             # <<<<<<<<<<<<<<
 *         glAttachShader(program, fragment_shader)
 *     else:
 */
    goto __pyx_L6;
  }

  /* "_glarea_es2.pyx":1033
 *         glAttachShader(program, fragment_shader)
 *     else:
 *         puts('error: no fragment shader')             # <<<<<<<<<<<<<<
 * 
 *     glLinkProgram(program)
 */
  /*else*/ {
    puts(((char const *)"error: no fragment shader"));
  }
  __pyx_L6:;

  /* "_glarea_es2.pyx":1035
 *         puts('error: no fragment shader')
 * 
 *     glLinkProgram(program)             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_MSGGL:
 *         link_status = _gl_print_program_info(program)
 */
  glLinkProgram(__pyx_v_program);

  /* "_glarea_es2.pyx":1036
 * 
 *     glLinkProgram(program)
 *     if debug & DEBUG_MSGGL:             # <<<<<<<<<<<<<<
 *         link_status = _gl_print_program_info(program)
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_MSGGL) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1037
 *     glLinkProgram(program)
 *     if debug & DEBUG_MSGGL:
 *         link_status = _gl_print_program_info(program)             # <<<<<<<<<<<<<<
 *     else:
 *         glGetProgramiv(program, GL_LINK_STATUS, &link_status) #px/
 */
    __pyx_v_link_status = __pyx_f_11_glarea_es2__gl_print_program_info(__pyx_v_program);

    /* "_glarea_es2.pyx":1036
 * 
 *     glLinkProgram(program)
 *     if debug & DEBUG_MSGGL:             # <<<<<<<<<<<<<<
 *         link_status = _gl_print_program_info(program)
 *     else:
 */
    goto __pyx_L7;
  }

  /* "_glarea_es2.pyx":1039
 *         link_status = _gl_print_program_info(program)
 *     else:
 *         glGetProgramiv(program, GL_LINK_STATUS, &link_status) #px/             # <<<<<<<<<<<<<<
 *         #link_status = glGetProgramiv(program, GL_LINK_STATUS)
 *     if not link_status:
 */
  /*else*/ {
    glGetProgramiv(__pyx_v_program, GL_LINK_STATUS, (&__pyx_v_link_status));
  }
  __pyx_L7:;

  /* "_glarea_es2.pyx":1041
 *         glGetProgramiv(program, GL_LINK_STATUS, &link_status) #px/
 *         #link_status = glGetProgramiv(program, GL_LINK_STATUS)
 *     if not link_status:             # <<<<<<<<<<<<<<
 *         printf('link status %d\n', link_status)
 *         _gl_print_program_log(program)
 */
  __pyx_t_1 = ((!(__pyx_v_link_status != 0)) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1042
 *         #link_status = glGetProgramiv(program, GL_LINK_STATUS)
 *     if not link_status:
 *         printf('link status %d\n', link_status)             # <<<<<<<<<<<<<<
 *         _gl_print_program_log(program)
 *     if vertex_shader:
 */
    printf(((char const *)"link status %d\n"), __pyx_v_link_status);

    /* "_glarea_es2.pyx":1043
 *     if not link_status:
 *         printf('link status %d\n', link_status)
 *         _gl_print_program_log(program)             # <<<<<<<<<<<<<<
 *     if vertex_shader:
 *         glDetachShader(program, vertex_shader)
 */
    __pyx_f_11_glarea_es2__gl_print_program_log(__pyx_v_program);

    /* "_glarea_es2.pyx":1041
 *         glGetProgramiv(program, GL_LINK_STATUS, &link_status) #px/
 *         #link_status = glGetProgramiv(program, GL_LINK_STATUS)
 *     if not link_status:             # <<<<<<<<<<<<<<
 *         printf('link status %d\n', link_status)
 *         _gl_print_program_log(program)
 */
  }

  /* "_glarea_es2.pyx":1044
 *         printf('link status %d\n', link_status)
 *         _gl_print_program_log(program)
 *     if vertex_shader:             # <<<<<<<<<<<<<<
 *         glDetachShader(program, vertex_shader)
 *         glDeleteShader(vertex_shader)
 */
  __pyx_t_1 = (__pyx_v_vertex_shader != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1045
 *         _gl_print_program_log(program)
 *     if vertex_shader:
 *         glDetachShader(program, vertex_shader)             # <<<<<<<<<<<<<<
 *         glDeleteShader(vertex_shader)
 *     if fragment_shader:
 */
    glDetachShader(__pyx_v_program, __pyx_v_vertex_shader);

    /* "_glarea_es2.pyx":1046
 *     if vertex_shader:
 *         glDetachShader(program, vertex_shader)
 *         glDeleteShader(vertex_shader)             # <<<<<<<<<<<<<<
 *     if fragment_shader:
 *         glDetachShader(program, fragment_shader)
 */
    glDeleteShader(__pyx_v_vertex_shader);

    /* "_glarea_es2.pyx":1044
 *         printf('link status %d\n', link_status)
 *         _gl_print_program_log(program)
 *     if vertex_shader:             # <<<<<<<<<<<<<<
 *         glDetachShader(program, vertex_shader)
 *         glDeleteShader(vertex_shader)
 */
  }

  /* "_glarea_es2.pyx":1047
 *         glDetachShader(program, vertex_shader)
 *         glDeleteShader(vertex_shader)
 *     if fragment_shader:             # <<<<<<<<<<<<<<
 *         glDetachShader(program, fragment_shader)
 *         glDeleteShader(fragment_shader)
 */
  __pyx_t_1 = (__pyx_v_fragment_shader != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1048
 *         glDeleteShader(vertex_shader)
 *     if fragment_shader:
 *         glDetachShader(program, fragment_shader)             # <<<<<<<<<<<<<<
 *         glDeleteShader(fragment_shader)
 * 
 */
    glDetachShader(__pyx_v_program, __pyx_v_fragment_shader);

    /* "_glarea_es2.pyx":1049
 *     if fragment_shader:
 *         glDetachShader(program, fragment_shader)
 *         glDeleteShader(fragment_shader)             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC PD nogil
 */
    glDeleteShader(__pyx_v_fragment_shader);

    /* "_glarea_es2.pyx":1047
 *         glDetachShader(program, vertex_shader)
 *         glDeleteShader(vertex_shader)
 *     if fragment_shader:             # <<<<<<<<<<<<<<
 *         glDetachShader(program, fragment_shader)
 *         glDeleteShader(fragment_shader)
 */
  }

  /* "_glarea_es2.pyx":1017
 * 
 * ##pxm-FUNC P nogil
 * cdef void _gl_program_add_shaders(GLuint program, char *vertex_source, char *fragment_source) nogil:             # <<<<<<<<<<<<<<
 *     cdef GLuint vertex_shader = 0, fragment_shader = 0 #px+
 *     cdef GLint link_status #px+
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":1052
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_create_render_program() nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint location #px+
 *     if debug & DEBUG_MSGGL:  puts('Creating render shaders:')
 */

static void __pyx_f_11_glarea_es2_gl_create_render_program(void) {
  GLint __pyx_v_location;
  int __pyx_t_1;

  /* "_glarea_es2.pyx":1054
 * cdef void gl_create_render_program() nogil:
 *     cdef GLint location #px+
 *     if debug & DEBUG_MSGGL:  puts('Creating render shaders:')             # <<<<<<<<<<<<<<
 *     if renderdata.prog_render > 0:
 *         glDeleteProgram(renderdata.prog_render)
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_MSGGL) != 0);
  if (__pyx_t_1) {
    puts(((char const *)"Creating render shaders:"));
  }

  /* "_glarea_es2.pyx":1055
 *     cdef GLint location #px+
 *     if debug & DEBUG_MSGGL:  puts('Creating render shaders:')
 *     if renderdata.prog_render > 0:             # <<<<<<<<<<<<<<
 *         glDeleteProgram(renderdata.prog_render)
 *     renderdata.prog_render = glCreateProgram()
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_renderdata.prog_render > 0) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1056
 *     if debug & DEBUG_MSGGL:  puts('Creating render shaders:')
 *     if renderdata.prog_render > 0:
 *         glDeleteProgram(renderdata.prog_render)             # <<<<<<<<<<<<<<
 *     renderdata.prog_render = glCreateProgram()
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+0, b'vertex_attr')
 */
    glDeleteProgram(__pyx_v_11_glarea_es2_renderdata.prog_render);

    /* "_glarea_es2.pyx":1055
 *     cdef GLint location #px+
 *     if debug & DEBUG_MSGGL:  puts('Creating render shaders:')
 *     if renderdata.prog_render > 0:             # <<<<<<<<<<<<<<
 *         glDeleteProgram(renderdata.prog_render)
 *     renderdata.prog_render = glCreateProgram()
 */
  }

  /* "_glarea_es2.pyx":1057
 *     if renderdata.prog_render > 0:
 *         glDeleteProgram(renderdata.prog_render)
 *     renderdata.prog_render = glCreateProgram()             # <<<<<<<<<<<<<<
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+0, b'vertex_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+1, b'normal_attr')
 */
  __pyx_v_11_glarea_es2_renderdata.prog_render = glCreateProgram();

  /* "_glarea_es2.pyx":1058
 *         glDeleteProgram(renderdata.prog_render)
 *     renderdata.prog_render = glCreateProgram()
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+0, b'vertex_attr')             # <<<<<<<<<<<<<<
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+1, b'normal_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+2, b'color_attr')
 */
  glBindAttribLocation(__pyx_v_11_glarea_es2_renderdata.prog_render, (__pyx_e_11_gldraw_es2_ATTRIB_LOCATION + 0), ((GLchar *)"vertex_attr"));

  /* "_glarea_es2.pyx":1059
 *     renderdata.prog_render = glCreateProgram()
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+0, b'vertex_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+1, b'normal_attr')             # <<<<<<<<<<<<<<
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+2, b'color_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+3, b'texcoord_attr')
 */
  glBindAttribLocation(__pyx_v_11_glarea_es2_renderdata.prog_render, (__pyx_e_11_gldraw_es2_ATTRIB_LOCATION + 1), ((GLchar *)"normal_attr"));

  /* "_glarea_es2.pyx":1060
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+0, b'vertex_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+1, b'normal_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+2, b'color_attr')             # <<<<<<<<<<<<<<
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+3, b'texcoord_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+4, b'barycentric_attr')
 */
  glBindAttribLocation(__pyx_v_11_glarea_es2_renderdata.prog_render, (__pyx_e_11_gldraw_es2_ATTRIB_LOCATION + 2), ((GLchar *)"color_attr"));

  /* "_glarea_es2.pyx":1061
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+1, b'normal_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+2, b'color_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+3, b'texcoord_attr')             # <<<<<<<<<<<<<<
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+4, b'barycentric_attr')
 *     _gl_program_add_shaders(renderdata.prog_render, renderdata.shader_vertsrc, renderdata.shader_fragsrc)
 */
  glBindAttribLocation(__pyx_v_11_glarea_es2_renderdata.prog_render, (__pyx_e_11_gldraw_es2_ATTRIB_LOCATION + 3), ((GLchar *)"texcoord_attr"));

  /* "_glarea_es2.pyx":1062
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+2, b'color_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+3, b'texcoord_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+4, b'barycentric_attr')             # <<<<<<<<<<<<<<
 *     _gl_program_add_shaders(renderdata.prog_render, renderdata.shader_vertsrc, renderdata.shader_fragsrc)
 *     if renderdata.prog_render > 0:
 */
  glBindAttribLocation(__pyx_v_11_glarea_es2_renderdata.prog_render, (__pyx_e_11_gldraw_es2_ATTRIB_LOCATION + 4), ((GLchar *)"barycentric_attr"));

  /* "_glarea_es2.pyx":1063
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+3, b'texcoord_attr')
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+4, b'barycentric_attr')
 *     _gl_program_add_shaders(renderdata.prog_render, renderdata.shader_vertsrc, renderdata.shader_fragsrc)             # <<<<<<<<<<<<<<
 *     if renderdata.prog_render > 0:
 *         glUseProgram(renderdata.prog_render)
 */
  __pyx_f_11_glarea_es2__gl_program_add_shaders(__pyx_v_11_glarea_es2_renderdata.prog_render, __pyx_v_11_glarea_es2_renderdata.shader_vertsrc, __pyx_v_11_glarea_es2_renderdata.shader_fragsrc);

  /* "_glarea_es2.pyx":1064
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+4, b'barycentric_attr')
 *     _gl_program_add_shaders(renderdata.prog_render, renderdata.shader_vertsrc, renderdata.shader_fragsrc)
 *     if renderdata.prog_render > 0:             # <<<<<<<<<<<<<<
 *         glUseProgram(renderdata.prog_render)
 *         location = glGetUniformLocation(renderdata.prog_render, b'tex')
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_renderdata.prog_render > 0) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1065
 *     _gl_program_add_shaders(renderdata.prog_render, renderdata.shader_vertsrc, renderdata.shader_fragsrc)
 *     if renderdata.prog_render > 0:
 *         glUseProgram(renderdata.prog_render)             # <<<<<<<<<<<<<<
 *         location = glGetUniformLocation(renderdata.prog_render, b'tex')
 *         glUniform1i(location, 0) # 0 is the texture unit (-> glActiveTexture)
 */
    glUseProgram(__pyx_v_11_glarea_es2_renderdata.prog_render);

    /* "_glarea_es2.pyx":1066
 *     if renderdata.prog_render > 0:
 *         glUseProgram(renderdata.prog_render)
 *         location = glGetUniformLocation(renderdata.prog_render, b'tex')             # <<<<<<<<<<<<<<
 *         glUniform1i(location, 0) # 0 is the texture unit (-> glActiveTexture)
 *         renderdata.modelview_location = glGetUniformLocation(renderdata.prog_render, b'modelview')
 */
    __pyx_v_location = glGetUniformLocation(__pyx_v_11_glarea_es2_renderdata.prog_render, ((GLchar *)"tex"));

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

    /* "_glarea_es2.pyx":1068
 *         location = glGetUniformLocation(renderdata.prog_render, b'tex')
 *         glUniform1i(location, 0) # 0 is the texture unit (-> glActiveTexture)
 *         renderdata.modelview_location = glGetUniformLocation(renderdata.prog_render, b'modelview')             # <<<<<<<<<<<<<<
 *         renderdata.projection_location = glGetUniformLocation(renderdata.prog_render, b'projection')
 *         location = glGetUniformLocation(renderdata.prog_render, b'object')
 */
    __pyx_v_11_glarea_es2_renderdata.modelview_location = glGetUniformLocation(__pyx_v_11_glarea_es2_renderdata.prog_render, ((GLchar *)"modelview"));

    /* "_glarea_es2.pyx":1069
 *         glUniform1i(location, 0) # 0 is the texture unit (-> glActiveTexture)
 *         renderdata.modelview_location = glGetUniformLocation(renderdata.prog_render, b'modelview')
 *         renderdata.projection_location = glGetUniformLocation(renderdata.prog_render, b'projection')             # <<<<<<<<<<<<<<
 *         location = glGetUniformLocation(renderdata.prog_render, b'object')
 *         gldraw.gl_init_object_location(location)
 */
    __pyx_v_11_glarea_es2_renderdata.projection_location = glGetUniformLocation(__pyx_v_11_glarea_es2_renderdata.prog_render, ((GLchar *)"projection"));

    /* "_glarea_es2.pyx":1070
 *         renderdata.modelview_location = glGetUniformLocation(renderdata.prog_render, b'modelview')
 *         renderdata.projection_location = glGetUniformLocation(renderdata.prog_render, b'projection')
 *         location = glGetUniformLocation(renderdata.prog_render, b'object')             # <<<<<<<<<<<<<<
 *         gldraw.gl_init_object_location(location)
 * 
 */
    __pyx_v_location = glGetUniformLocation(__pyx_v_11_glarea_es2_renderdata.prog_render, ((GLchar *)"object"));

    /* "_glarea_es2.pyx":1071
 *         renderdata.projection_location = glGetUniformLocation(renderdata.prog_render, b'projection')
 *         location = glGetUniformLocation(renderdata.prog_render, b'object')
 *         gldraw.gl_init_object_location(location)             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
    __pyx_f_11_gldraw_es2_gl_init_object_location(__pyx_v_location);

    /* "_glarea_es2.pyx":1064
 *     glBindAttribLocation(renderdata.prog_render, gldraw.ATTRIB_LOCATION+4, b'barycentric_attr')
 *     _gl_program_add_shaders(renderdata.prog_render, renderdata.shader_vertsrc, renderdata.shader_fragsrc)
 *     if renderdata.prog_render > 0:             # <<<<<<<<<<<<<<
 *         glUseProgram(renderdata.prog_render)
 *         location = glGetUniformLocation(renderdata.prog_render, b'tex')
 */
  }

  /* "_glarea_es2.pyx":1052
 * 
 * ##pxm-FUNC PD nogil
 * cdef void gl_create_render_program() nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint location #px+
 *     if debug & DEBUG_MSGGL:  puts('Creating render shaders:')
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":1074
 * 
 * ##pxm-FUNC P nogil
 * cdef void gl_create_hud_program() nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint location #px+
 *     if debug & DEBUG_MSGGL: puts('Creating "hud" shaders:')
 */

static void __pyx_f_11_glarea_es2_gl_create_hud_program(void) {
  int __pyx_t_1;

  /* "_glarea_es2.pyx":1076
 * cdef void gl_create_hud_program() nogil:
 *     cdef GLint location #px+
 *     if debug & DEBUG_MSGGL: puts('Creating "hud" shaders:')             # <<<<<<<<<<<<<<
 *     if renderdata.prog_hud > 0:
 *         glDeleteProgram(renderdata.prog_hud)
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_MSGGL) != 0);
  if (__pyx_t_1) {
    puts(((char const *)"Creating \"hud\" shaders:"));
  }

  /* "_glarea_es2.pyx":1077
 *     cdef GLint location #px+
 *     if debug & DEBUG_MSGGL: puts('Creating "hud" shaders:')
 *     if renderdata.prog_hud > 0:             # <<<<<<<<<<<<<<
 *         glDeleteProgram(renderdata.prog_hud)
 *     renderdata.prog_hud = glCreateProgram()
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_renderdata.prog_hud > 0) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1078
 *     if debug & DEBUG_MSGGL: puts('Creating "hud" shaders:')
 *     if renderdata.prog_hud > 0:
 *         glDeleteProgram(renderdata.prog_hud)             # <<<<<<<<<<<<<<
 *     renderdata.prog_hud = glCreateProgram()
 *     glBindAttribLocation(renderdata.prog_hud, gldraw.ATTRIB_LOCATION+0, b'vertex_attr')
 */
    glDeleteProgram(__pyx_v_11_glarea_es2_renderdata.prog_hud);

    /* "_glarea_es2.pyx":1077
 *     cdef GLint location #px+
 *     if debug & DEBUG_MSGGL: puts('Creating "hud" shaders:')
 *     if renderdata.prog_hud > 0:             # <<<<<<<<<<<<<<
 *         glDeleteProgram(renderdata.prog_hud)
 *     renderdata.prog_hud = glCreateProgram()
 */
  }

  /* "_glarea_es2.pyx":1079
 *     if renderdata.prog_hud > 0:
 *         glDeleteProgram(renderdata.prog_hud)
 *     renderdata.prog_hud = glCreateProgram()             # <<<<<<<<<<<<<<
 *     glBindAttribLocation(renderdata.prog_hud, gldraw.ATTRIB_LOCATION+0, b'vertex_attr')
 *     glBindAttribLocation(renderdata.prog_hud, gldraw.ATTRIB_LOCATION+2, b'color_attr')
 */
  __pyx_v_11_glarea_es2_renderdata.prog_hud = glCreateProgram();

  /* "_glarea_es2.pyx":1080
 *         glDeleteProgram(renderdata.prog_hud)
 *     renderdata.prog_hud = glCreateProgram()
 *     glBindAttribLocation(renderdata.prog_hud, gldraw.ATTRIB_LOCATION+0, b'vertex_attr')             # <<<<<<<<<<<<<<
 *     glBindAttribLocation(renderdata.prog_hud, gldraw.ATTRIB_LOCATION+2, b'color_attr')
 *     _gl_program_add_shaders(renderdata.prog_hud, renderdata.hud_vertsrc, renderdata.hud_fragsrc)
 */
  glBindAttribLocation(__pyx_v_11_glarea_es2_renderdata.prog_hud, (__pyx_e_11_gldraw_es2_ATTRIB_LOCATION + 0), ((GLchar *)"vertex_attr"));

  /* "_glarea_es2.pyx":1081
 *     renderdata.prog_hud = glCreateProgram()
 *     glBindAttribLocation(renderdata.prog_hud, gldraw.ATTRIB_LOCATION+0, b'vertex_attr')
 *     glBindAttribLocation(renderdata.prog_hud, gldraw.ATTRIB_LOCATION+2, b'color_attr')             # <<<<<<<<<<<<<<
 *     _gl_program_add_shaders(renderdata.prog_hud, renderdata.hud_vertsrc, renderdata.hud_fragsrc)
 *     if renderdata.prog_hud > 0:
 */
  glBindAttribLocation(__pyx_v_11_glarea_es2_renderdata.prog_hud, (__pyx_e_11_gldraw_es2_ATTRIB_LOCATION + 2), ((GLchar *)"color_attr"));

  /* "_glarea_es2.pyx":1082
 *     glBindAttribLocation(renderdata.prog_hud, gldraw.ATTRIB_LOCATION+0, b'vertex_attr')
 *     glBindAttribLocation(renderdata.prog_hud, gldraw.ATTRIB_LOCATION+2, b'color_attr')
 *     _gl_program_add_shaders(renderdata.prog_hud, renderdata.hud_vertsrc, renderdata.hud_fragsrc)             # <<<<<<<<<<<<<<
 *     if renderdata.prog_hud > 0:
 *         glUseProgram(renderdata.prog_hud)
 */
  __pyx_f_11_glarea_es2__gl_program_add_shaders(__pyx_v_11_glarea_es2_renderdata.prog_hud, __pyx_v_11_glarea_es2_renderdata.hud_vertsrc, __pyx_v_11_glarea_es2_renderdata.hud_fragsrc);

  /* "_glarea_es2.pyx":1083
 *     glBindAttribLocation(renderdata.prog_hud, gldraw.ATTRIB_LOCATION+2, b'color_attr')
 *     _gl_program_add_shaders(renderdata.prog_hud, renderdata.hud_vertsrc, renderdata.hud_fragsrc)
 *     if renderdata.prog_hud > 0:             # <<<<<<<<<<<<<<
 *         glUseProgram(renderdata.prog_hud)
 * 
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_renderdata.prog_hud > 0) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1084
 *     _gl_program_add_shaders(renderdata.prog_hud, renderdata.hud_vertsrc, renderdata.hud_fragsrc)
 *     if renderdata.prog_hud > 0:
 *         glUseProgram(renderdata.prog_hud)             # <<<<<<<<<<<<<<
 * 
 * ##pxm-FUNC P nogil
 */
    glUseProgram(__pyx_v_11_glarea_es2_renderdata.prog_hud);

    /* "_glarea_es2.pyx":1083
 *     glBindAttribLocation(renderdata.prog_hud, gldraw.ATTRIB_LOCATION+2, b'color_attr')
 *     _gl_program_add_shaders(renderdata.prog_hud, renderdata.hud_vertsrc, renderdata.hud_fragsrc)
 *     if renderdata.prog_hud > 0:             # <<<<<<<<<<<<<<
 *         glUseProgram(renderdata.prog_hud)
 * 
 */
  }

  /* "_glarea_es2.pyx":1074
 * 
 * ##pxm-FUNC P nogil
 * cdef void gl_create_hud_program() nogil:             # <<<<<<<<<<<<<<
 *     cdef GLint location #px+
 *     if debug & DEBUG_MSGGL: puts('Creating "hud" shaders:')
 */

  /* function exit code */
}

/* "_glarea_es2.pyx":1087
 * 
 * ##pxm-FUNC P nogil
 * cdef void gl_create_pick_program() nogil:             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_MSGGL: puts('Creating "pick" shaders:')
 *     if renderdata.prog_pick > 0:
 */

static void __pyx_f_11_glarea_es2_gl_create_pick_program(void) {
  int __pyx_t_1;

  /* "_glarea_es2.pyx":1088
 * ##pxm-FUNC P nogil
 * cdef void gl_create_pick_program() nogil:
 *     if debug & DEBUG_MSGGL: puts('Creating "pick" shaders:')             # <<<<<<<<<<<<<<
 *     if renderdata.prog_pick > 0:
 *         glDeleteProgram(renderdata.prog_pick)
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_debug & __pyx_e_11_glarea_es2_DEBUG_MSGGL) != 0);
  if (__pyx_t_1) {
    puts(((char const *)"Creating \"pick\" shaders:"));
  }

  /* "_glarea_es2.pyx":1089
 * cdef void gl_create_pick_program() nogil:
 *     if debug & DEBUG_MSGGL: puts('Creating "pick" shaders:')
 *     if renderdata.prog_pick > 0:             # <<<<<<<<<<<<<<
 *         glDeleteProgram(renderdata.prog_pick)
 *     renderdata.prog_pick = glCreateProgram()
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_renderdata.prog_pick > 0) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1090
 *     if debug & DEBUG_MSGGL: puts('Creating "pick" shaders:')
 *     if renderdata.prog_pick > 0:
 *         glDeleteProgram(renderdata.prog_pick)             # <<<<<<<<<<<<<<
 *     renderdata.prog_pick = glCreateProgram()
 *     glBindAttribLocation(renderdata.prog_pick, gldraw.PICKATTRIB_LOCATION+0, b'vertex_attr')
 */
    glDeleteProgram(__pyx_v_11_glarea_es2_renderdata.prog_pick);

    /* "_glarea_es2.pyx":1089
 * cdef void gl_create_pick_program() nogil:
 *     if debug & DEBUG_MSGGL: puts('Creating "pick" shaders:')
 *     if renderdata.prog_pick > 0:             # <<<<<<<<<<<<<<
 *         glDeleteProgram(renderdata.prog_pick)
 *     renderdata.prog_pick = glCreateProgram()
 */
  }

  /* "_glarea_es2.pyx":1091
 *     if renderdata.prog_pick > 0:
 *         glDeleteProgram(renderdata.prog_pick)
 *     renderdata.prog_pick = glCreateProgram()             # <<<<<<<<<<<<<<
 *     glBindAttribLocation(renderdata.prog_pick, gldraw.PICKATTRIB_LOCATION+0, b'vertex_attr')
 *     glBindAttribLocation(renderdata.prog_pick, gldraw.PICKATTRIB_LOCATION+1, b'color_attr')
 */
  __pyx_v_11_glarea_es2_renderdata.prog_pick = glCreateProgram();

  /* "_glarea_es2.pyx":1092
 *         glDeleteProgram(renderdata.prog_pick)
 *     renderdata.prog_pick = glCreateProgram()
 *     glBindAttribLocation(renderdata.prog_pick, gldraw.PICKATTRIB_LOCATION+0, b'vertex_attr')             # <<<<<<<<<<<<<<
 *     glBindAttribLocation(renderdata.prog_pick, gldraw.PICKATTRIB_LOCATION+1, b'color_attr')
 *     _gl_program_add_shaders(renderdata.prog_pick, renderdata.pick_vertsrc, renderdata.pick_fragsrc)
 */
  glBindAttribLocation(__pyx_v_11_glarea_es2_renderdata.prog_pick, (__pyx_e_11_gldraw_es2_PICKATTRIB_LOCATION + 0), ((GLchar *)"vertex_attr"));

  /* "_glarea_es2.pyx":1093
 *     renderdata.prog_pick = glCreateProgram()
 *     glBindAttribLocation(renderdata.prog_pick, gldraw.PICKATTRIB_LOCATION+0, b'vertex_attr')
 *     glBindAttribLocation(renderdata.prog_pick, gldraw.PICKATTRIB_LOCATION+1, b'color_attr')             # <<<<<<<<<<<<<<
 *     _gl_program_add_shaders(renderdata.prog_pick, renderdata.pick_vertsrc, renderdata.pick_fragsrc)
 *     if renderdata.prog_pick > 0:
 */
  glBindAttribLocation(__pyx_v_11_glarea_es2_renderdata.prog_pick, (__pyx_e_11_gldraw_es2_PICKATTRIB_LOCATION + 1), ((GLchar *)"color_attr"));

  /* "_glarea_es2.pyx":1094
 *     glBindAttribLocation(renderdata.prog_pick, gldraw.PICKATTRIB_LOCATION+0, b'vertex_attr')
 *     glBindAttribLocation(renderdata.prog_pick, gldraw.PICKATTRIB_LOCATION+1, b'color_attr')
 *     _gl_program_add_shaders(renderdata.prog_pick, renderdata.pick_vertsrc, renderdata.pick_fragsrc)             # <<<<<<<<<<<<<<
 *     if renderdata.prog_pick > 0:
 *         glUseProgram(renderdata.prog_pick)
 */
  __pyx_f_11_glarea_es2__gl_program_add_shaders(__pyx_v_11_glarea_es2_renderdata.prog_pick, __pyx_v_11_glarea_es2_renderdata.pick_vertsrc, __pyx_v_11_glarea_es2_renderdata.pick_fragsrc);

  /* "_glarea_es2.pyx":1095
 *     glBindAttribLocation(renderdata.prog_pick, gldraw.PICKATTRIB_LOCATION+1, b'color_attr')
 *     _gl_program_add_shaders(renderdata.prog_pick, renderdata.pick_vertsrc, renderdata.pick_fragsrc)
 *     if renderdata.prog_pick > 0:             # <<<<<<<<<<<<<<
 *         glUseProgram(renderdata.prog_pick)
 *         renderdata.picking_location = glGetUniformLocation(renderdata.prog_pick, b'picking')
 */
  __pyx_t_1 = ((__pyx_v_11_glarea_es2_renderdata.prog_pick > 0) != 0);
  if (__pyx_t_1) {

    /* "_glarea_es2.pyx":1096
 *     _gl_program_add_shaders(renderdata.prog_pick, renderdata.pick_vertsrc, renderdata.pick_fragsrc)
 *     if renderdata.prog_pick > 0:
 *         glUseProgram(renderdata.prog_pick)             # <<<<<<<<<<<<<<
 *         renderdata.picking_location = glGetUniformLocation(renderdata.prog_pick, b'picking')
 *         renderdata.projection_pick_location = glGetUniformLocation(renderdata.prog_pick, b'projection')
 */
    glUseProgram(__pyx_v_11_glarea_es2_renderdata.prog_pick);

    /* "_glarea_es2.pyx":1097
 *     if renderdata.prog_pick > 0:
 *         glUseProgram(renderdata.prog_pick)
 *         renderdata.picking_location = glGetUniformLocation(renderdata.prog_pick, b'picking')             # <<<<<<<<<<<<<<
 *         renderdata.projection_pick_location = glGetUniformLocation(renderdata.prog_pick, b'projection')
 *         renderdata.modelview_pick_location = glGetUniformLocation(renderdata.prog_pick, b'modelview')
 */
    __pyx_v_11_glarea_es2_renderdata.picking_location = glGetUniformLocation(__pyx_v_11_glarea_es2_renderdata.prog_pick, ((GLchar *)"picking"));

    /* "_glarea_es2.pyx":1098
 *         glUseProgram(renderdata.prog_pick)
 *         renderdata.picking_location = glGetUniformLocation(renderdata.prog_pick, b'picking')
 *         renderdata.projection_pick_location = glGetUniformLocation(renderdata.prog_pick, b'projection')             # <<<<<<<<<<<<<<
 *         renderdata.modelview_pick_location = glGetUniformLocation(renderdata.prog_pick, b'modelview')
 * 
 */
    __pyx_v_11_glarea_es2_renderdata.projection_pick_location = glGetUniformLocation(__pyx_v_11_glarea_es2_renderdata.prog_pick, ((GLchar *)"projection"));

    /* "_glarea_es2.pyx":1099
 *         renderdata.picking_location = glGetUniformLocation(renderdata.prog_pick, b'picking')
 *         renderdata.projection_pick_location = glGetUniformLocation(renderdata.prog_pick, b'projection')
 *         renderdata.modelview_pick_location = glGetUniformLocation(renderdata.prog_pick, b'modelview')             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_11_glarea_es2_renderdata.modelview_pick_location = glGetUniformLocation(__pyx_v_11_glarea_es2_renderdata.prog_pick, ((GLchar *)"modelview"));

    /* "_glarea_es2.pyx":1095
 *     glBindAttribLocation(renderdata.prog_pick, gldraw.PICKATTRIB_LOCATION+1, b'color_attr')
 *     _gl_program_add_shaders(renderdata.prog_pick, renderdata.pick_vertsrc, renderdata.pick_fragsrc)
 *     if renderdata.prog_pick > 0:             # <<<<<<<<<<<<<<
 *         glUseProgram(renderdata.prog_pick)
 *         renderdata.picking_location = glGetUniformLocation(renderdata.prog_pick, b'picking')
 */
  }

  /* "_glarea_es2.pyx":1087
 * 
 * ##pxm-FUNC P nogil
 * cdef void gl_create_pick_program() nogil:             # <<<<<<<<<<<<<<
 *     if debug & DEBUG_MSGGL: puts('Creating "pick" shaders:')
 *     if renderdata.prog_pick > 0:
 */

  /* function exit code */
}

static PyMethodDef __pyx_methods[] = {
  {"set_animation_start", (PyCFunction)__pyx_pw_11_glarea_es2_17set_animation_start, METH_VARARGS|METH_KEYWORDS, 0},
  {"set_atlas_data", (PyCFunction)__pyx_pw_11_glarea_es2_31set_atlas_data, 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_es2",
    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_DRAW, __pyx_k_DEBUG_DRAW, sizeof(__pyx_k_DEBUG_DRAW), 0, 0, 1, 1},
  {&__pyx_n_s_DEBUG_MSGEXT, __pyx_k_DEBUG_MSGEXT, sizeof(__pyx_k_DEBUG_MSGEXT), 0, 0, 1, 1},
  {&__pyx_n_s_DEBUG_MSGGL, __pyx_k_DEBUG_MSGGL, sizeof(__pyx_k_DEBUG_MSGGL), 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_GL_type_es2, __pyx_k_GL_type_es2, sizeof(__pyx_k_GL_type_es2), 0, 1, 0, 0},
  {&__pyx_kp_u_OFFSCREEN, __pyx_k_OFFSCREEN, sizeof(__pyx_k_OFFSCREEN), 0, 1, 0, 0},
  {&__pyx_kp_b__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 0, 0},
  {&__pyx_n_s_angle, __pyx_k_angle, sizeof(__pyx_k_angle), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_atlasdata, __pyx_k_atlasdata, sizeof(__pyx_k_atlasdata), 0, 0, 1, 1},
  {&__pyx_n_s_axisx, __pyx_k_axisx, sizeof(__pyx_k_axisx), 0, 0, 1, 1},
  {&__pyx_n_s_axisy, __pyx_k_axisy, sizeof(__pyx_k_axisy), 0, 0, 1, 1},
  {&__pyx_n_s_axisz, __pyx_k_axisz, sizeof(__pyx_k_axisz), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_blocks, __pyx_k_blocks, sizeof(__pyx_k_blocks), 0, 0, 1, 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_s_cnts_block, __pyx_k_cnts_block, sizeof(__pyx_k_cnts_block), 0, 0, 1, 1},
  {&__pyx_kp_u_compiled, __pyx_k_compiled, sizeof(__pyx_k_compiled), 0, 1, 0, 0},
  {&__pyx_n_s_compiled_2, __pyx_k_compiled_2, sizeof(__pyx_k_compiled_2), 0, 0, 1, 1},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_fixedshaders, __pyx_k_fixedshaders, sizeof(__pyx_k_fixedshaders), 0, 0, 1, 1},
  {&__pyx_n_u_fixedshaders, __pyx_k_fixedshaders, sizeof(__pyx_k_fixedshaders), 0, 1, 0, 1},
  {&__pyx_n_s_fovy_angle, __pyx_k_fovy_angle, sizeof(__pyx_k_fovy_angle), 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_glarea_es2, __pyx_k_glarea_es2, sizeof(__pyx_k_glarea_es2), 0, 0, 1, 1},
  {&__pyx_n_s_green, __pyx_k_green, sizeof(__pyx_k_green), 0, 0, 1, 1},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 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_init_engine, __pyx_k_init_engine, sizeof(__pyx_k_init_engine), 0, 0, 1, 1},
  {&__pyx_kp_u_init_module, __pyx_k_init_module, sizeof(__pyx_k_init_module), 0, 1, 0, 0},
  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_module_2, __pyx_k_module_2, sizeof(__pyx_k_module_2), 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_s_nblocks, __pyx_k_nblocks, sizeof(__pyx_k_nblocks), 0, 0, 1, 1},
  {&__pyx_n_s_nxy, __pyx_k_nxy, sizeof(__pyx_k_nxy), 0, 0, 1, 1},
  {&__pyx_n_s_package, __pyx_k_package, sizeof(__pyx_k_package), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
  {&__pyx_n_s_pydata, __pyx_k_pydata, sizeof(__pyx_k_pydata), 0, 0, 1, 1},
  {&__pyx_n_s_pydata_backed, __pyx_k_pydata_backed, sizeof(__pyx_k_pydata_backed), 0, 0, 1, 1},
  {&__pyx_n_s_pydata_postsync, __pyx_k_pydata_postsync, sizeof(__pyx_k_pydata_postsync), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_quat, __pyx_k_quat, sizeof(__pyx_k_quat), 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_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_data, __pyx_k_set_data, sizeof(__pyx_k_set_data), 0, 0, 1, 1},
  {&__pyx_n_s_set_debug_flags, __pyx_k_set_debug_flags, sizeof(__pyx_k_set_debug_flags), 0, 0, 1, 1},
  {&__pyx_n_s_set_fixedshaders, __pyx_k_set_fixedshaders, sizeof(__pyx_k_set_fixedshaders), 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_pick_position, __pyx_k_set_pick_position, sizeof(__pyx_k_set_pick_position), 0, 0, 1, 1},
  {&__pyx_n_s_set_rotation_rel, __pyx_k_set_rotation_rel, sizeof(__pyx_k_set_rotation_rel), 0, 0, 1, 1},
  {&__pyx_n_s_set_rotation_xy, __pyx_k_set_rotation_xy, sizeof(__pyx_k_set_rotation_xy), 0, 0, 1, 1},
  {&__pyx_n_s_set_shaders, __pyx_k_set_shaders, sizeof(__pyx_k_set_shaders), 0, 0, 1, 1},
  {&__pyx_n_s_set_transformations, __pyx_k_set_transformations, sizeof(__pyx_k_set_transformations), 0, 0, 1, 1},
  {&__pyx_n_s_shader_fragsrc, __pyx_k_shader_fragsrc, sizeof(__pyx_k_shader_fragsrc), 0, 0, 1, 1},
  {&__pyx_n_u_shader_fragsrc, __pyx_k_shader_fragsrc, sizeof(__pyx_k_shader_fragsrc), 0, 1, 0, 1},
  {&__pyx_n_s_shader_src, __pyx_k_shader_src, sizeof(__pyx_k_shader_src), 0, 0, 1, 1},
  {&__pyx_n_s_shader_vertsrc, __pyx_k_shader_vertsrc, sizeof(__pyx_k_shader_vertsrc), 0, 0, 1, 1},
  {&__pyx_n_u_shader_vertsrc, __pyx_k_shader_vertsrc, sizeof(__pyx_k_shader_vertsrc), 0, 1, 0, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
  {&__pyx_n_s_syncpydata, __pyx_k_syncpydata, sizeof(__pyx_k_syncpydata), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_transformations, __pyx_k_transformations, sizeof(__pyx_k_transformations), 0, 0, 1, 1},
  {&__pyx_n_s_uipydata, __pyx_k_uipydata, sizeof(__pyx_k_uipydata), 0, 0, 1, 1},
  {&__pyx_n_s_unused, __pyx_k_unused, sizeof(__pyx_k_unused), 0, 0, 1, 1},
  {&__pyx_n_s_update_shader_version, __pyx_k_update_shader_version, sizeof(__pyx_k_update_shader_version), 0, 0, 1, 1},
  {&__pyx_kp_b_version_100, __pyx_k_version_100, sizeof(__pyx_k_version_100), 0, 0, 0, 0},
  {&__pyx_kp_b_version_120, __pyx_k_version_120, sizeof(__pyx_k_version_120), 0, 0, 0, 0},
  {&__pyx_n_s_vertexdata, __pyx_k_vertexdata, sizeof(__pyx_k_vertexdata), 0, 0, 1, 1},
  {&__pyx_n_u_vertexdata, __pyx_k_vertexdata, sizeof(__pyx_k_vertexdata), 0, 1, 0, 1},
  {&__pyx_n_s_vertexinfo, __pyx_k_vertexinfo, sizeof(__pyx_k_vertexinfo), 0, 0, 1, 1},
  {&__pyx_n_s_vertexpointers, __pyx_k_vertexpointers, sizeof(__pyx_k_vertexpointers), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_zoom, __pyx_k_zoom, sizeof(__pyx_k_zoom), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 272, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 482, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 505, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

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

  /* "_glarea_es2.pyx":275
 *         print('  from package:', __package__)
 *         print('  compiled:', __compiled)
 *         print('  GL-type: es2') #px+             # <<<<<<<<<<<<<<
 *         print('  OFFSCREEN:', OFFSCREEN)
 * 
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_GL_type_es2); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "_glarea_es2.pyx":276
 *         print('  compiled:', __compiled)
 *         print('  GL-type: es2') #px+
 *         print('  OFFSCREEN:', OFFSCREEN)             # <<<<<<<<<<<<<<
 * 
 *     uidata.synced = False
 */
  __pyx_tuple__2 = PyTuple_Pack(2, __pyx_kp_u_OFFSCREEN, Py_False); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "_glarea_es2.pyx":526
 * 
 * def update_shader_version(shader_src):
 *     assert shader_src.startswith(b'#version 120\n')             # <<<<<<<<<<<<<<
 *     IF 'es2' == 'es2': #px/
 *     #if False:
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_b_version_120); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "_glarea_es2.pyx":529
 *     IF 'es2' == 'es2': #px/
 *     #if False:
 *         shader_src = b'#version 100\n' + shader_src.split(b'\n', 1)[1]             # <<<<<<<<<<<<<<
 *     return shader_src
 * 
 */
  __pyx_tuple__5 = PyTuple_Pack(2, __pyx_kp_b__4, __pyx_int_1); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "_glarea_es2.pyx":64
 * debug = 0
 * 
 * def set_debug_flags(module):             # <<<<<<<<<<<<<<
 *     global debug
 *     if module.DEBUG_MSGGL: debug |= DEBUG_MSGGL
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_module); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);
  __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_debug_flags, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 64, __pyx_L1_error)

  /* "_glarea_es2.pyx":269
 * ### module state
 * 
 * def init_engine():             # <<<<<<<<<<<<<<
 *     gldraw.init_gldraw()
 *     if debug & DEBUG_MSGEXT:
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_fovy_angle); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);
  __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_init_engine, 269, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 269, __pyx_L1_error)

  /* "_glarea_es2.pyx":352
 *     M[0][2] = -m11 * m20;   M[1][2] = m12;  M[2][2] =  m00 * m11
 * 
 * def set_rotation_rel(x, y):             # <<<<<<<<<<<<<<
 *     cdef gldraw.vec4 quat #px+
 *     cdef float nxy #px+
 */
  __pyx_tuple__10 = PyTuple_Pack(4, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_quat, __pyx_n_s_nxy); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);
  __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_rotation_rel, 352, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 352, __pyx_L1_error)

  /* "_glarea_es2.pyx":440
 *     renderdata.picking_matrix[1][1] = 1.
 * 
 * def set_frustum(bounding_sphere_radius, zoom):             # <<<<<<<<<<<<<<
 *     uidata.frustum_changed = True
 *     if bounding_sphere_radius > 0:
 */
  __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_bounding_sphere_radius, __pyx_n_s_zoom); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);
  __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_frustum, 440, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 440, __pyx_L1_error)

  /* "_glarea_es2.pyx":446
 *     uidata.fovy_radius_zoom = uidata.fovy_radius / zoom
 * 
 * def set_background_color(red, green, blue):             # <<<<<<<<<<<<<<
 *     uidata.background_changed = True
 *     uidata.bg_red = red
 */
  __pyx_tuple__14 = PyTuple_Pack(3, __pyx_n_s_red, __pyx_n_s_green, __pyx_n_s_blue); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);
  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_background_color, 446, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 446, __pyx_L1_error)

  /* "_glarea_es2.pyx":452
 *     uidata.bg_blue = blue
 * 
 * def set_antialiasing(multisample):             # <<<<<<<<<<<<<<
 *     uidata.multisample_changed = 2 if multisample else 1
 * 
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_multisample); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);
  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_antialiasing, 452, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 452, __pyx_L1_error)

  /* "_glarea_es2.pyx":455
 *     uidata.multisample_changed = 2 if multisample else 1
 * 
 * def set_rotation_xy(x, y):             # <<<<<<<<<<<<<<
 *     x %= 360
 *     # pylint: disable=C0321
 */
  __pyx_tuple__18 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_y); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);
  __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_rotation_xy, 455, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 455, __pyx_L1_error)

  /* "_glarea_es2.pyx":472
 *     uidata.viewport_changed = True
 * 
 * def set_transformations(blocks):             # <<<<<<<<<<<<<<
 *     assert uidata.nblocks == len(blocks)
 *     cdef int i #px+
 */
  __pyx_tuple__20 = PyTuple_Pack(4, __pyx_n_s_blocks, __pyx_n_s_i, __pyx_n_s_b, __pyx_n_s_unused); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);
  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_transformations, 472, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 472, __pyx_L1_error)

  /* "_glarea_es2.pyx":496
 *     uidata.animation_changed = 2
 * 
 * def set_data(nblocks, vertexdata, vertexpointers, vertexinfo, transformations):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     cdef int t,i,j #px+
 */
  __pyx_tuple__22 = PyTuple_Pack(9, __pyx_n_s_nblocks, __pyx_n_s_vertexdata, __pyx_n_s_vertexpointers, __pyx_n_s_vertexinfo, __pyx_n_s_transformations, __pyx_n_s_t, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_cnts_block); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);
  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(5, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_data, 496, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 496, __pyx_L1_error)

  /* "_glarea_es2.pyx":519
 *     uidata.data_changed = True
 * 
 * def pydata_postsync():             # <<<<<<<<<<<<<<
 *     global pydata_backed
 *     if uidata.synced:
 */
  __pyx_codeobj__24 = (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_pydata_postsync, 519, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 519, __pyx_L1_error)

  /* "_glarea_es2.pyx":525
 *         uidata.synced = False
 * 
 * def update_shader_version(shader_src):             # <<<<<<<<<<<<<<
 *     assert shader_src.startswith(b'#version 120\n')
 *     IF 'es2' == 'es2': #px/
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_shader_src); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);
  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_update_shader_version, 525, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 525, __pyx_L1_error)

  /* "_glarea_es2.pyx":532
 *     return shader_src
 * 
 * def set_shaders(shader_vertsrc, shader_fragsrc):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     shader_vertsrc = update_shader_version(shader_vertsrc)
 */
  __pyx_tuple__27 = PyTuple_Pack(2, __pyx_n_s_shader_vertsrc, __pyx_n_s_shader_fragsrc); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);
  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_shaders, 532, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 532, __pyx_L1_error)

  /* "_glarea_es2.pyx":542
 *     uidata.shaders_changed = True
 * 
 * def set_fixedshaders(fixedshaders):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     fixedshaders = [update_shader_version(s) for s in fixedshaders]
 */
  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_fixedshaders); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_fixedshaders, 542, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 542, __pyx_L1_error)

  /* "_glarea_es2.pyx":560
 *         renderdata.hud_fragsrc = uidata.hud_fragsrc
 * 
 * def set_pick_position(x, y):             # <<<<<<<<<<<<<<
 *     uidata.pick_x = x
 *     uidata.pick_y = y
 */
  __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_y); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);
  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp, __pyx_n_s_set_pick_position, 560, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 560, __pyx_L1_error)

  /* "_glarea_es2.pyx":888
 *     mvect[2] = v2 / u3
 * 
 * def get_cursor_angle(d):             # <<<<<<<<<<<<<<
 *     cdef float angle #px+
 *     cdef int i #px+
 */
  __pyx_tuple__33 = PyTuple_Pack(5, __pyx_n_s_d, __pyx_n_s_angle, __pyx_n_s_i, __pyx_n_s_x, __pyx_n_s_y); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);
  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 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_get_cursor_angle, 888, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 888, __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_ERR(0, 1, __pyx_L1_error);
  __pyx_float_360_0 = PyFloat_FromDouble(360.0); if (unlikely(!__pyx_float_360_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_120 = PyInt_FromLong(120); if (unlikely(!__pyx_int_120)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_360 = PyInt_FromLong(360); if (unlikely(!__pyx_int_360)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_neg_120 = PyInt_FromLong(-120); if (unlikely(!__pyx_int_neg_120)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_glarea_es2(void); /*proto*/
PyMODINIT_FUNC init_glarea_es2(void)
#else
PyMODINIT_FUNC PyInit__glarea_es2(void); /*proto*/
PyMODINIT_FUNC PyInit__glarea_es2(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__glarea_es2(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __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_es2", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __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_ERR(0, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main__glarea_es2) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "_glarea_es2")) {
      if (unlikely(PyDict_SetItemString(modules, "_glarea_es2", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("render_resize", (void (*)(void))__pyx_f_11_glarea_es2_render_resize, "void (int, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("set_animation_next", (void (*)(void))__pyx_f_11_glarea_es2_set_animation_next, "void (float)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("sync_set_fixedshaders", (void (*)(void))__pyx_f_11_glarea_es2_sync_set_fixedshaders, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("sync_set_pick_position", (void (*)(void))__pyx_f_11_glarea_es2_sync_set_pick_position, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("sync_set_atlas_data", (void (*)(void))__pyx_f_11_glarea_es2_sync_set_atlas_data, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("sync", (void (*)(void))__pyx_f_11_glarea_es2_sync, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("gl_init", (void (*)(void))__pyx_f_11_glarea_es2_gl_init, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("gl_exit", (void (*)(void))__pyx_f_11_glarea_es2_gl_exit, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("gl_set_atlas_texture", (void (*)(void))__pyx_f_11_glarea_es2_gl_set_atlas_texture, "void (int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("gl_render", (void (*)(void))__pyx_f_11_glarea_es2_gl_render, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("gl_render_select_debug", (void (*)(void))__pyx_f_11_glarea_es2_gl_render_select_debug, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("gl_pick_polygons", (void (*)(void))__pyx_f_11_glarea_es2_gl_pick_polygons, "int (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("gl_create_render_program", (void (*)(void))__pyx_f_11_glarea_es2_gl_create_render_program, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Type init code ---*/
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  __pyx_t_1 = __Pyx_ImportModule("_gldraw_es2"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "matrix_set_identity", (void (**)(void))&__pyx_f_11_gldraw_es2_matrix_set_identity, "void (__pyx_t_11_gldraw_es2_vec4 *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "init_gldraw", (void (**)(void))&__pyx_f_11_gldraw_es2_init_gldraw, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "sync_block_transformations", (void (**)(void))&__pyx_f_11_gldraw_es2_sync_block_transformations, "void (short *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "sync_animation_start", (void (**)(void))&__pyx_f_11_gldraw_es2_sync_animation_start, "void (int, short *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "sync_animation_next", (void (**)(void))&__pyx_f_11_gldraw_es2_sync_animation_next, "void (float, float, float, float)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_draw_cube", (void (**)(void))&__pyx_f_11_gldraw_es2_gl_draw_cube, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_pick_cube", (void (**)(void))&__pyx_f_11_gldraw_es2_gl_pick_cube, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_init_buffers", (void (**)(void))&__pyx_f_11_gldraw_es2_gl_init_buffers, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_delete_buffers", (void (**)(void))&__pyx_f_11_gldraw_es2_gl_delete_buffers, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "sync_blocks", (void (**)(void))&__pyx_f_11_gldraw_es2_sync_blocks, "void (int, short *, int, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "sync_vertexdata", (void (**)(void))&__pyx_f_11_gldraw_es2_sync_vertexdata, "void (int, char *, long *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "sync_transformations", (void (**)(void))&__pyx_f_11_gldraw_es2_sync_transformations, "void (int, __pyx_t_11_gldraw_es2_mat4 *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_enable_data", (void (**)(void))&__pyx_f_11_gldraw_es2_gl_enable_data, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_disable_data", (void (**)(void))&__pyx_f_11_gldraw_es2_gl_disable_data, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_draw_cube_debug", (void (**)(void))&__pyx_f_11_gldraw_es2_gl_draw_cube_debug, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_draw_select_debug", (void (**)(void))&__pyx_f_11_gldraw_es2_gl_draw_select_debug, "void (GLfloat *, GLsizeiptr, GLuint)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction(__pyx_t_1, "gl_init_object_location", (void (**)(void))&__pyx_f_11_gldraw_es2_gl_init_object_location, "void (GLuint)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif

  /* "_glarea_es2.pyx":25
 * # This line makes cython happy
 * global __name__, __package__    # pylint: disable=W0604
 * __compiled = True #px/             # <<<<<<<<<<<<<<
 * #__compiled = False
 * DEF OFFSCREEN = False #px/
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_compiled_2, Py_True) < 0) __PYX_ERR(0, 25, __pyx_L1_error)

  /* "_glarea_es2.pyx":62
 *     DEBUG_PICK = 0x20
 * cdef long debug #px+
 * debug = 0             # <<<<<<<<<<<<<<
 * 
 * def set_debug_flags(module):
 */
  __pyx_v_11_glarea_es2_debug = 0;

  /* "_glarea_es2.pyx":64
 * debug = 0
 * 
 * def set_debug_flags(module):             # <<<<<<<<<<<<<<
 *     global debug
 *     if module.DEBUG_MSGGL: debug |= DEBUG_MSGGL
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_1set_debug_flags, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_debug_flags, __pyx_t_2) < 0) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":195
 * cdef UIData uidata #px+
 * 
 * class syncpydata: pass             # <<<<<<<<<<<<<<
 * class uipydata: pass
 * pydata = {}
 */
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_syncpydata, __pyx_n_s_syncpydata, (PyObject *) NULL, __pyx_n_s_glarea_es2, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_syncpydata, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_syncpydata, __pyx_t_3) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":196
 * 
 * class syncpydata: pass
 * class uipydata: pass             # <<<<<<<<<<<<<<
 * pydata = {}
 * 
 */
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_uipydata, __pyx_n_s_uipydata, (PyObject *) NULL, __pyx_n_s_glarea_es2, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_uipydata, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_uipydata, __pyx_t_3) < 0) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":197
 * class syncpydata: pass
 * class uipydata: pass
 * pydata = {}             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pydata, __pyx_t_2) < 0) __PYX_ERR(0, 197, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":269
 * ### module state
 * 
 * def init_engine():             # <<<<<<<<<<<<<<
 *     gldraw.init_gldraw()
 *     if debug & DEBUG_MSGEXT:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_3init_engine, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_engine, __pyx_t_2) < 0) __PYX_ERR(0, 269, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":352
 *     M[0][2] = -m11 * m20;   M[1][2] = m12;  M[2][2] =  m00 * m11
 * 
 * def set_rotation_rel(x, y):             # <<<<<<<<<<<<<<
 *     cdef gldraw.vec4 quat #px+
 *     cdef float nxy #px+
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_5set_rotation_rel, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_rotation_rel, __pyx_t_2) < 0) __PYX_ERR(0, 352, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":440
 *     renderdata.picking_matrix[1][1] = 1.
 * 
 * def set_frustum(bounding_sphere_radius, zoom):             # <<<<<<<<<<<<<<
 *     uidata.frustum_changed = True
 *     if bounding_sphere_radius > 0:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_7set_frustum, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_frustum, __pyx_t_2) < 0) __PYX_ERR(0, 440, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":446
 *     uidata.fovy_radius_zoom = uidata.fovy_radius / zoom
 * 
 * def set_background_color(red, green, blue):             # <<<<<<<<<<<<<<
 *     uidata.background_changed = True
 *     uidata.bg_red = red
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_9set_background_color, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_background_color, __pyx_t_2) < 0) __PYX_ERR(0, 446, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":452
 *     uidata.bg_blue = blue
 * 
 * def set_antialiasing(multisample):             # <<<<<<<<<<<<<<
 *     uidata.multisample_changed = 2 if multisample else 1
 * 
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_11set_antialiasing, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_antialiasing, __pyx_t_2) < 0) __PYX_ERR(0, 452, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":455
 *     uidata.multisample_changed = 2 if multisample else 1
 * 
 * def set_rotation_xy(x, y):             # <<<<<<<<<<<<<<
 *     x %= 360
 *     # pylint: disable=C0321
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_13set_rotation_xy, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_rotation_xy, __pyx_t_2) < 0) __PYX_ERR(0, 455, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":472
 *     uidata.viewport_changed = True
 * 
 * def set_transformations(blocks):             # <<<<<<<<<<<<<<
 *     assert uidata.nblocks == len(blocks)
 *     cdef int i #px+
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_15set_transformations, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_transformations, __pyx_t_2) < 0) __PYX_ERR(0, 472, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":496
 *     uidata.animation_changed = 2
 * 
 * def set_data(nblocks, vertexdata, vertexpointers, vertexinfo, transformations):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     cdef int t,i,j #px+
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_19set_data, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_data, __pyx_t_2) < 0) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":519
 *     uidata.data_changed = True
 * 
 * def pydata_postsync():             # <<<<<<<<<<<<<<
 *     global pydata_backed
 *     if uidata.synced:
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_21pydata_postsync, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pydata_postsync, __pyx_t_2) < 0) __PYX_ERR(0, 519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":525
 *         uidata.synced = False
 * 
 * def update_shader_version(shader_src):             # <<<<<<<<<<<<<<
 *     assert shader_src.startswith(b'#version 120\n')
 *     IF 'es2' == 'es2': #px/
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_23update_shader_version, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_update_shader_version, __pyx_t_2) < 0) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":532
 *     return shader_src
 * 
 * def set_shaders(shader_vertsrc, shader_fragsrc):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     shader_vertsrc = update_shader_version(shader_vertsrc)
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_25set_shaders, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_shaders, __pyx_t_2) < 0) __PYX_ERR(0, 532, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":542
 *     uidata.shaders_changed = True
 * 
 * def set_fixedshaders(fixedshaders):             # <<<<<<<<<<<<<<
 *     pydata_postsync()
 *     fixedshaders = [update_shader_version(s) for s in fixedshaders]
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_27set_fixedshaders, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_fixedshaders, __pyx_t_2) < 0) __PYX_ERR(0, 542, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":560
 *         renderdata.hud_fragsrc = uidata.hud_fragsrc
 * 
 * def set_pick_position(x, y):             # <<<<<<<<<<<<<<
 *     uidata.pick_x = x
 *     uidata.pick_y = y
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_29set_pick_position, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_pick_position, __pyx_t_2) < 0) __PYX_ERR(0, 560, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":888
 *     mvect[2] = v2 / u3
 * 
 * def get_cursor_angle(d):             # <<<<<<<<<<<<<<
 *     cdef float angle #px+
 *     cdef int i #px+
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_11_glarea_es2_33get_cursor_angle, NULL, __pyx_n_s_glarea_es2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_cursor_angle, __pyx_t_2) < 0) __PYX_ERR(0, 888, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "_glarea_es2.pyx":1
 * #-*- coding:utf-8 -*-             # <<<<<<<<<<<<<<
 * # cython: profile=False
 * 
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __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);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init _glarea_es2", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init _glarea_es2");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#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

/* GetBuiltinName */
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;
}

/* PyErrFetchRestore */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    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);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __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);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* GetModuleGlobalName */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
    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;
}

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

/* RaiseArgTupleInvalid */
  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);
}

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

/* ParseKeywords */
  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;
}

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = a % b;
            x += ((x != 0) & ((x ^ b) < 0)) * b;
            return PyInt_FromLong(x);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                default: return PyLong_Type.tp_as_number->nb_remainder(op1, op2);
            }
        }
                x = a % b;
                x += ((x != 0) & ((x ^ b) < 0)) * b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla % llb;
                llx += ((llx != 0) & ((llx ^ llb) < 0)) * llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    return (inplace ? PyNumber_InPlaceRemainder : PyNumber_Remainder)(op1, op2);
}
#endif

/* PyFloatBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
    const double b = floatval;
    double a, result;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) (1L<<53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
        }
    } else {
        return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
    }
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* RaiseTooManyValuesToUnpack */
    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);
}

/* RaiseNeedMoreValuesToUnpack */
    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");
}

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

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

/* PyIntBinop */
    #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* None */
    static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* PyCFunctionFastCall */
    #if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
}
#endif  // CYTHON_FAST_PYCCALL

/* PyFunctionFastCall */
    #if CYTHON_FAST_PYCALL
#include "frameobject.h"
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = PyThreadState_GET();
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = f->f_localsplus;
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif  // CPython < 3.6
#endif  // CYTHON_FAST_PYCALL

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

/* PyObjectCallOneArg */
    #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) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
#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);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyObjectCallNoArg */
      #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#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

/* GetItemInt */
        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,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    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,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    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))
                        return NULL;
                    PyErr_Clear();
                }
            }
            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));
}

/* pyobject_as_double */
        static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
#if !CYTHON_USE_TYPE_SLOTS
    float_value = PyNumber_Float(obj);  if (0) goto bad;
#else
    PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
    if (likely(nb) && likely(nb->nb_float)) {
        float_value = nb->nb_float(obj);
        if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
            PyErr_Format(PyExc_TypeError,
                "__float__ returned non-float (type %.200s)",
                Py_TYPE(float_value)->tp_name);
            Py_DECREF(float_value);
            goto bad;
        }
    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
        float_value = PyFloat_FromString(obj);
#else
        float_value = PyFloat_FromString(obj, 0);
#endif
    } else {
        PyObject* args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        PyTuple_SET_ITEM(args, 0, obj);
        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
        PyTuple_SET_ITEM(args, 0, 0);
        Py_DECREF(args);
    }
#endif
    if (likely(float_value)) {
        double value = PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
bad:
    return (double)-1;
}

/* PyObjectCallMethod1 */
        static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto done;
#if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyCFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            args = PyTuple_New(2);
            if (unlikely(!args)) goto done;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            Py_DECREF(method); method = NULL;
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
done:
    Py_XDECREF(method);
    return result;
}

/* append */
        static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* ArgTypeTest */
        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;
}

/* CalculateMetaclass */
        static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
        static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module_2, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* CodeObjectCache */
        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 - start) / 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);
}

/* AddTraceback */
        #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;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

/* CIntFromPyVerify */
        #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        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 (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
        static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = (int) 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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
        static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = (long) 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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
        static CYTHON_INLINE PyObject* __Pyx_PyInt_From_GLint(GLint value) {
    const GLint neg_one = (GLint) -1, const_zero = (GLint) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(GLint) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(GLint) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(GLint) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(GLint) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(GLint) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(GLint),
                                     little, !is_unsigned);
    }
}

/* CIntFromPy */
        static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = (int) 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_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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_IntOrLong(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_IntOrLong(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;
}

/* CIntFromPy */
        static CYTHON_INLINE short __Pyx_PyInt_As_short(PyObject *x) {
    const short neg_one = (short) -1, const_zero = (short) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(short) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(short, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (short) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (short) 0;
                case  1: __PYX_VERIFY_RETURN_INT(short, digit, digits[0])
                case 2:
                    if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) >= 2 * PyLong_SHIFT) {
                            return (short) (((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) >= 3 * PyLong_SHIFT) {
                            return (short) (((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) >= 4 * PyLong_SHIFT) {
                            return (short) (((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (short) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(short) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (short) 0;
                case -1: __PYX_VERIFY_RETURN_INT(short, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(short,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(short) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(short) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                            return (short) ((((((short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(short) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(short) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                            return (short) ((((((((short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(short) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 4 * PyLong_SHIFT) {
                            return (short) (((short)-1)*(((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(short) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(short, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(short) - 1 > 4 * PyLong_SHIFT) {
                            return (short) ((((((((((short)digits[3]) << PyLong_SHIFT) | (short)digits[2]) << PyLong_SHIFT) | (short)digits[1]) << PyLong_SHIFT) | (short)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(short) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(short, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            short val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(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 (short) -1;
        }
    } else {
        short val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (short) -1;
        val = __Pyx_PyInt_As_short(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to short");
    return (short) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to short");
    return (short) -1;
}

/* CIntFromPy */
        static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = (long) 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_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#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_IntOrLong(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_IntOrLong(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;
}

/* CheckBinaryVersion */
        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;
}

/* FunctionExport */
        static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

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

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

/* InitStrings */
        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 CYTHON_COMPILING_IN_CPYTHON && (__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) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    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_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  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 __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  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
#else
  res = PyNumber_Int(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))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(x);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
      }
    }
    #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 */
