/* Generated by Pyrex 0.9.5.1a on Thu Aug  2 17:00:41 2007 */

#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
__PYX_EXTERN_C double pow(double, double);
#include "math.h"
#include "GL/gl.h"
#include "GL/glu.h"


typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/

static PyObject *__pyx_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
static char **__pyx_f;

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static PyObject *__Pyx_UnpackItem(PyObject *); /*proto*/
static int __Pyx_EndUnpack(PyObject *); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/

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

static void __Pyx_AddTraceback(char *funcname); /*proto*/

/* Declarations from rabbyt._rabbyt */

static PyObject *__pyx_k3;
static PyObject *__pyx_k5;
static PyObject *__pyx_k6;
static PyObject *__pyx_k7;
static PyObject *__pyx_k9;
static PyObject *__pyx_k10;
static PyObject *__pyx_k11;
static PyObject *__pyx_k12;


/* Implementation of rabbyt._rabbyt */

static char (__pyx_k1[]) = "\nCopyright (C) 2007  Matthew Marshall\n\nThis library is free software; you can redistribute it and/or\nmodify it under the terms of the GNU Library General Public\nLicense as published by the Free Software Foundation; either\nversion 2 of the License, or (at your option) any later version.\n\nThis library is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nLibrary General Public License for more details.\n\nYou should have received a copy of the GNU Library General Public\nLicense along with this library; if not, write to the Free\nFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n";
static char (__pyx_k2[]) = "Matthew Marshall <matthew@matthewmarshall.org>";

static PyObject *__pyx_n___credits__;
static PyObject *__pyx_n___author__;
static PyObject *__pyx_n_load_texture_file_hook;
static PyObject *__pyx_n_set_load_texture_file_hook;
static PyObject *__pyx_n_render_unsorted;
static PyObject *__pyx_n_render_sorted;
static PyObject *__pyx_n_set_viewport;
static PyObject *__pyx_n_set_default_attribs;
static PyObject *__pyx_n_set_gl_color;
static PyObject *__pyx_n_get_gl_vendor;
static PyObject *__pyx_n_load_texture;
static PyObject *__pyx_n_update_texture;
static PyObject *__pyx_n_unload_texture;
static PyObject *__pyx_n_clear;
static PyObject *__pyx_n_RGBA;
static PyObject *__pyx_n_True;

static PyObject *__pyx_k1p;
static PyObject *__pyx_k2p;

static PyObject *__pyx_f_6rabbyt_7_rabbyt_set_load_texture_file_hook(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6rabbyt_7_rabbyt_set_load_texture_file_hook[] = "\n    ``set_load_texture_file_hook(callback)``\n\n    This sets the ``callback`` that is used to load a texture from a file.\n    (It is called when you give a string for the first argument of\n    ``Sprite``.)\n\n    The default is ``rabbyt.pygame_load_texture``, which will use pygame to\n    load the file.  You may write your own callback if you don\'t want to use\n    pygame.\n\n    The ``callback`` should take the filename as a single argument, and return\n    a tuple of the form ``(texture_id, (width, height))``.\n    ";
static PyObject *__pyx_f_6rabbyt_7_rabbyt_set_load_texture_file_hook(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_callback = 0;
  PyObject *__pyx_r;
  static char *__pyx_argnames[] = {"callback",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_callback)) return 0;
  Py_INCREF(__pyx_v_callback);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":115 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_load_texture_file_hook, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("rabbyt._rabbyt.set_load_texture_file_hook");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_callback);
  return __pyx_r;
}

static PyObject *__pyx_n_render;

static PyObject *__pyx_f_6rabbyt_7_rabbyt_render_unsorted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6rabbyt_7_rabbyt_render_unsorted[] = "\n    ``render_unsorted(sprites)``\n\n    Renders a list of sprites.\n\n    Since this function is implemented in Pyrex, it should be a little faster\n    than looping through the sprites in Python.\n    ";
static PyObject *__pyx_f_6rabbyt_7_rabbyt_render_unsorted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sprites = 0;
  PyObject *__pyx_v_s;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  static char *__pyx_argnames[] = {"sprites",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_sprites)) return 0;
  Py_INCREF(__pyx_v_sprites);
  __pyx_v_s = Py_None; Py_INCREF(Py_None);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":128 */
  __pyx_1 = PyObject_GetIter(__pyx_v_sprites); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; goto __pyx_L1;}
  for (;;) {
    __pyx_2 = PyIter_Next(__pyx_1);
    if (!__pyx_2) {
      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; goto __pyx_L1;}
      break;
    }
    Py_DECREF(__pyx_v_s);
    __pyx_v_s = __pyx_2;
    __pyx_2 = 0;

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":129 */
    __pyx_2 = PyObject_GetAttr(__pyx_v_s, __pyx_n_render); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
    __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
  }
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("rabbyt._rabbyt.render_unsorted");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_s);
  Py_DECREF(__pyx_v_sprites);
  return __pyx_r;
}

static PyObject *__pyx_n_list;
static PyObject *__pyx_n_sort;

static PyObject *__pyx_f_6rabbyt_7_rabbyt_render_sorted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6rabbyt_7_rabbyt_render_sorted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sprites = 0;
  PyObject *__pyx_v_ss;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  static char *__pyx_argnames[] = {"sprites",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_sprites)) return 0;
  Py_INCREF(__pyx_v_sprites);
  __pyx_v_ss = Py_None; Py_INCREF(Py_None);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":133 */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
  Py_INCREF(__pyx_v_sprites);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_sprites);
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_v_ss);
  __pyx_v_ss = __pyx_3;
  __pyx_3 = 0;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":134 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_ss, __pyx_n_sort); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":135 */
  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_render_unsorted); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L1;}
  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L1;}
  Py_INCREF(__pyx_v_ss);
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_ss);
  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("rabbyt._rabbyt.render_sorted");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_ss);
  Py_DECREF(__pyx_v_sprites);
  return __pyx_r;
}

static PyObject *__pyx_n_len;

static PyObject *__pyx_f_6rabbyt_7_rabbyt_set_viewport(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6rabbyt_7_rabbyt_set_viewport[] = "\n    ``set_viewport(viewport, [projection])``\n\n    Sets how coordinates map to the screen.\n\n    ``viewport`` gives the screen coordinates that will be drawn to.  It\n    should be in either the form ``(width, height)`` or\n    ``(left, top, right, bottom)``\n\n    ``projection`` gives the sprite coordinates that will be mapped to the\n    screen coordinates given by ``viewport``.  It too should be in one of the\n    two forms accepted by ``viewport``.  If ``projection`` is not given, it\n    will default to the width and height of ``viewport``.  If only the width\n    and height are given, ``(0, 0)`` will be the center point.\n    ";
static PyObject *__pyx_f_6rabbyt_7_rabbyt_set_viewport(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_viewport = 0;
  PyObject *__pyx_v_projection = 0;
  PyObject *__pyx_v_l;
  PyObject *__pyx_v_t;
  PyObject *__pyx_v_r;
  PyObject *__pyx_v_b;
  PyObject *__pyx_v_w;
  PyObject *__pyx_v_h;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  GLint __pyx_5;
  GLint __pyx_6;
  GLsizei __pyx_7;
  GLsizei __pyx_8;
  PyObject *__pyx_9 = 0;
  PyObject *__pyx_10 = 0;
  GLint __pyx_11;
  GLint __pyx_12;
  static char *__pyx_argnames[] = {"viewport","projection",0};
  __pyx_v_projection = __pyx_k3;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_viewport, &__pyx_v_projection)) return 0;
  Py_INCREF(__pyx_v_viewport);
  Py_INCREF(__pyx_v_projection);
  __pyx_v_l = Py_None; Py_INCREF(Py_None);
  __pyx_v_t = Py_None; Py_INCREF(Py_None);
  __pyx_v_r = Py_None; Py_INCREF(Py_None);
  __pyx_v_b = Py_None; Py_INCREF(Py_None);
  __pyx_v_w = Py_None; Py_INCREF(Py_None);
  __pyx_v_h = Py_None; Py_INCREF(Py_None);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":154 */
  glMatrixMode(GL_PROJECTION);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":155 */
  glLoadIdentity();

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":156 */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
  Py_INCREF(__pyx_v_viewport);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_viewport);
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_1 = PyInt_FromLong(4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
  __pyx_4 = __pyx_4 == 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (__pyx_4) {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":157 */
    __pyx_2 = PyObject_GetIter(__pyx_v_viewport); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L1;}
    __pyx_3 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L1;}
    Py_DECREF(__pyx_v_l);
    __pyx_v_l = __pyx_3;
    __pyx_3 = 0;
    __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L1;}
    Py_DECREF(__pyx_v_t);
    __pyx_v_t = __pyx_1;
    __pyx_1 = 0;
    __pyx_3 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L1;}
    Py_DECREF(__pyx_v_r);
    __pyx_v_r = __pyx_3;
    __pyx_3 = 0;
    __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L1;}
    Py_DECREF(__pyx_v_b);
    __pyx_v_b = __pyx_1;
    __pyx_1 = 0;
    if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    goto __pyx_L2;
  }
  /*else*/ {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":159 */
    __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}
    __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}
    Py_DECREF(__pyx_v_l);
    __pyx_v_l = __pyx_3;
    __pyx_3 = 0;
    Py_DECREF(__pyx_v_t);
    __pyx_v_t = __pyx_1;
    __pyx_1 = 0;

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":160 */
    __pyx_2 = PyObject_GetIter(__pyx_v_viewport); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}
    __pyx_3 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}
    Py_DECREF(__pyx_v_r);
    __pyx_v_r = __pyx_3;
    __pyx_3 = 0;
    __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}
    Py_DECREF(__pyx_v_b);
    __pyx_v_b = __pyx_1;
    __pyx_1 = 0;
    if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
  }
  __pyx_L2:;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":161 */
  __pyx_5 = PyInt_AsLong(__pyx_v_l); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
  __pyx_6 = PyInt_AsLong(__pyx_v_t); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
  __pyx_3 = PyNumber_Subtract(__pyx_v_r, __pyx_v_l); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
  __pyx_7 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_1 = PyNumber_Subtract(__pyx_v_b, __pyx_v_t); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
  __pyx_8 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  glViewport(__pyx_5,__pyx_6,__pyx_7,__pyx_8);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":163 */
  __pyx_4 = __pyx_v_projection != Py_None;
  if (__pyx_4) {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":164 */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
    Py_INCREF(__pyx_v_projection);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_projection);
    __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_2 = PyInt_FromLong(4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
    __pyx_4 = __pyx_4 == 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    if (__pyx_4) {

      /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":165 */
      __pyx_3 = PyObject_GetIter(__pyx_v_projection); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
      __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
      Py_DECREF(__pyx_v_l);
      __pyx_v_l = __pyx_1;
      __pyx_1 = 0;
      __pyx_2 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
      Py_DECREF(__pyx_v_t);
      __pyx_v_t = __pyx_2;
      __pyx_2 = 0;
      __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
      Py_DECREF(__pyx_v_r);
      __pyx_v_r = __pyx_1;
      __pyx_1 = 0;
      __pyx_2 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
      Py_DECREF(__pyx_v_b);
      __pyx_v_b = __pyx_2;
      __pyx_2 = 0;
      if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":167 */
      __pyx_1 = PyObject_GetIter(__pyx_v_projection); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
      __pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
      Py_DECREF(__pyx_v_w);
      __pyx_v_w = __pyx_2;
      __pyx_2 = 0;
      __pyx_3 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
      Py_DECREF(__pyx_v_h);
      __pyx_v_h = __pyx_3;
      __pyx_3 = 0;
      if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;

      /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":168 */
      __pyx_2 = PyNumber_Negative(__pyx_v_w); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
      __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
      __pyx_1 = PyNumber_Divide(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
      __pyx_3 = PyNumber_Divide(__pyx_v_w, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      __pyx_2 = PyNumber_Negative(__pyx_v_h); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
      __pyx_9 = PyInt_FromLong(2); if (!__pyx_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
      __pyx_10 = PyNumber_Divide(__pyx_2, __pyx_9); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_9); __pyx_9 = 0;
      __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
      __pyx_9 = PyNumber_Divide(__pyx_v_h, __pyx_2); if (!__pyx_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_v_l);
      __pyx_v_l = __pyx_1;
      __pyx_1 = 0;
      Py_DECREF(__pyx_v_r);
      __pyx_v_r = __pyx_3;
      __pyx_3 = 0;
      Py_DECREF(__pyx_v_t);
      __pyx_v_t = __pyx_10;
      __pyx_10 = 0;
      Py_DECREF(__pyx_v_b);
      __pyx_v_b = __pyx_9;
      __pyx_9 = 0;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":170 */
    __pyx_2 = PyNumber_Subtract(__pyx_v_r, __pyx_v_l); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; goto __pyx_L1;}
    __pyx_1 = PyNumber_Subtract(__pyx_v_b, __pyx_v_t); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; goto __pyx_L1;}
    Py_DECREF(__pyx_v_w);
    __pyx_v_w = __pyx_2;
    __pyx_2 = 0;
    Py_DECREF(__pyx_v_h);
    __pyx_v_h = __pyx_1;
    __pyx_1 = 0;

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":171 */
    __pyx_3 = PyNumber_Negative(__pyx_v_w); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    __pyx_10 = PyInt_FromLong(2); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    __pyx_9 = PyNumber_Divide(__pyx_3, __pyx_10); if (!__pyx_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_10); __pyx_10 = 0;
    __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    __pyx_1 = PyNumber_Divide(__pyx_v_w, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_3 = PyNumber_Negative(__pyx_v_h); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    __pyx_10 = PyInt_FromLong(2); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    __pyx_2 = PyNumber_Divide(__pyx_3, __pyx_10); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_10); __pyx_10 = 0;
    __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    __pyx_10 = PyNumber_Divide(__pyx_v_h, __pyx_3); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_v_l);
    __pyx_v_l = __pyx_9;
    __pyx_9 = 0;
    Py_DECREF(__pyx_v_r);
    __pyx_v_r = __pyx_1;
    __pyx_1 = 0;
    Py_DECREF(__pyx_v_b);
    __pyx_v_b = __pyx_2;
    __pyx_2 = 0;
    Py_DECREF(__pyx_v_t);
    __pyx_v_t = __pyx_10;
    __pyx_10 = 0;
  }
  __pyx_L3:;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":172 */
  __pyx_5 = PyInt_AsLong(__pyx_v_l); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
  __pyx_6 = PyInt_AsLong(__pyx_v_r); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
  __pyx_11 = PyInt_AsLong(__pyx_v_b); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
  __pyx_12 = PyInt_AsLong(__pyx_v_t); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
  glOrtho(__pyx_5,__pyx_6,__pyx_11,__pyx_12,(-1),1);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":173 */
  glMatrixMode(GL_MODELVIEW);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":174 */
  glLoadIdentity();

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_9);
  Py_XDECREF(__pyx_10);
  __Pyx_AddTraceback("rabbyt._rabbyt.set_viewport");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_l);
  Py_DECREF(__pyx_v_t);
  Py_DECREF(__pyx_v_r);
  Py_DECREF(__pyx_v_b);
  Py_DECREF(__pyx_v_w);
  Py_DECREF(__pyx_v_h);
  Py_DECREF(__pyx_v_viewport);
  Py_DECREF(__pyx_v_projection);
  return __pyx_r;
}

static PyObject *__pyx_f_6rabbyt_7_rabbyt_set_default_attribs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6rabbyt_7_rabbyt_set_default_attribs[] = "\n    ``set_default_attribs()``\n\n    Sets a few of the OpenGL attributes that sprites expect.\n\n    Unless you know what you are doing, you should call this at least once\n    before rendering any sprites.  (It is called automatically in\n    ``rabbyt.init_display()``)\n    ";
static PyObject *__pyx_f_6rabbyt_7_rabbyt_set_default_attribs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":186 */
  glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":187 */
  glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":188 */
  glEnable(GL_BLEND);

  __pyx_r = Py_None; Py_INCREF(Py_None);
  return __pyx_r;
}

static PyObject *__pyx_f_6rabbyt_7_rabbyt_set_gl_color(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6rabbyt_7_rabbyt_set_gl_color[] = "\n    ``set_gl_color(rgba)``\n\n    This is a thin wrapper around ``glColor4f()``.\n    ";
static PyObject *__pyx_f_6rabbyt_7_rabbyt_set_gl_color(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rgba = 0;
  float __pyx_v_r;
  float __pyx_v_g;
  float __pyx_v_b;
  float __pyx_v_a;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  float __pyx_3;
  static char *__pyx_argnames[] = {"rgba",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_rgba)) return 0;
  Py_INCREF(__pyx_v_rgba);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":199 */
  __pyx_1 = PyObject_GetIter(__pyx_v_rgba); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
  __pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
  __pyx_3 = PyFloat_AsDouble(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_v_r = __pyx_3;
  __pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
  __pyx_3 = PyFloat_AsDouble(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_v_g = __pyx_3;
  __pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
  __pyx_3 = PyFloat_AsDouble(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_v_b = __pyx_3;
  __pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
  __pyx_3 = PyFloat_AsDouble(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_v_a = __pyx_3;
  if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":200 */
  glColor4f(__pyx_v_r,__pyx_v_g,__pyx_v_b,__pyx_v_a);

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("rabbyt._rabbyt.set_gl_color");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_rgba);
  return __pyx_r;
}

static PyObject *__pyx_f_6rabbyt_7_rabbyt_get_gl_vendor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6rabbyt_7_rabbyt_get_gl_vendor[] = "\n    ``gl_get_vendor()``\n\n    Returns the OpenGL vendor string.  Returns None if there is no context.\n    ";
static PyObject *__pyx_f_6rabbyt_7_rabbyt_get_gl_vendor(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  char (*__pyx_v_string);
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":209 */
  __pyx_v_string = ((char (*))glGetString(GL_VENDOR));

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":210 */
  __pyx_1 = (((int )__pyx_v_string) == 0);
  if (__pyx_1) {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":211 */
    Py_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  /*else*/ {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":213 */
    __pyx_2 = PyString_FromString(__pyx_v_string); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L2:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("rabbyt._rabbyt.get_gl_vendor");
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

static PyObject *__pyx_f_6rabbyt_7_rabbyt_load_texture(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6rabbyt_7_rabbyt_load_texture[] = "\n    ``load_texture(byte_string, size, type=\'RGBA\', filter=True, mipmap=True)``\n\n    Load a texture and return it.\n    ";
static PyObject *__pyx_f_6rabbyt_7_rabbyt_load_texture(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_byte_string = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_type = 0;
  PyObject *__pyx_v_filter = 0;
  PyObject *__pyx_v_mipmap = 0;
  GLuint (__pyx_v_textures[1]);
  GLuint __pyx_v_id;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  static char *__pyx_argnames[] = {"byte_string","size","type","filter","mipmap",0};
  __pyx_v_type = __pyx_k5;
  __pyx_v_filter = __pyx_k6;
  __pyx_v_mipmap = __pyx_k7;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|OOO", __pyx_argnames, &__pyx_v_byte_string, &__pyx_v_size, &__pyx_v_type, &__pyx_v_filter, &__pyx_v_mipmap)) return 0;
  Py_INCREF(__pyx_v_byte_string);
  Py_INCREF(__pyx_v_size);
  Py_INCREF(__pyx_v_type);
  Py_INCREF(__pyx_v_filter);
  Py_INCREF(__pyx_v_mipmap);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":226 */
  glGenTextures(1,__pyx_v_textures);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":227 */
  __pyx_v_id = (__pyx_v_textures[0]);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":228 */
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_update_texture); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
  __pyx_2 = PyLong_FromUnsignedLong(__pyx_v_id); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  Py_INCREF(__pyx_v_byte_string);
  PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_byte_string);
  Py_INCREF(__pyx_v_size);
  PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_size);
  Py_INCREF(__pyx_v_type);
  PyTuple_SET_ITEM(__pyx_3, 3, __pyx_v_type);
  Py_INCREF(__pyx_v_filter);
  PyTuple_SET_ITEM(__pyx_3, 4, __pyx_v_filter);
  Py_INCREF(__pyx_v_mipmap);
  PyTuple_SET_ITEM(__pyx_3, 5, __pyx_v_mipmap);
  __pyx_2 = 0;
  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":229 */
  __pyx_1 = PyLong_FromUnsignedLong(__pyx_v_id); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("rabbyt._rabbyt.load_texture");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_byte_string);
  Py_DECREF(__pyx_v_size);
  Py_DECREF(__pyx_v_type);
  Py_DECREF(__pyx_v_filter);
  Py_DECREF(__pyx_v_mipmap);
  return __pyx_r;
}

static PyObject *__pyx_n_RuntimeError;
static PyObject *__pyx_n_RGB;
static PyObject *__pyx_n_ValueError;

static PyObject *__pyx_k13p;
static PyObject *__pyx_k16p;
static PyObject *__pyx_k17p;

static char (__pyx_k13[]) = "Trying to load a texture without an OpenGL context";
static char (__pyx_k16[]) = "type must be \"RGBA\" or \"RGB\"";
static char (__pyx_k17[]) = "byte_string is an unexpected size.";

static PyObject *__pyx_f_6rabbyt_7_rabbyt_update_texture(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6rabbyt_7_rabbyt_update_texture[] = "\n    ``update_texture(texture_id, byte_string, size, type=\'RGBA\', filter=True,\n    mipmap=True)``\n\n    Update a texture with a different byte_string.\n    ";
static PyObject *__pyx_f_6rabbyt_7_rabbyt_update_texture(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_texture_id = 0;
  PyObject *__pyx_v_byte_string = 0;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_v_type = 0;
  PyObject *__pyx_v_filter = 0;
  PyObject *__pyx_v_mipmap = 0;
  char (*__pyx_v_data);
  PyObject *__pyx_v_ptype;
  PyObject *__pyx_v_channels;
  PyObject *__pyx_v_filter_type;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  int __pyx_3;
  int __pyx_4;
  PyObject *__pyx_5 = 0;
  char (*__pyx_6);
  PyObject *__pyx_7 = 0;
  GLuint __pyx_8;
  GLint __pyx_9;
  GLsizei __pyx_10;
  GLsizei __pyx_11;
  GLenum __pyx_12;
  static char *__pyx_argnames[] = {"texture_id","byte_string","size","type","filter","mipmap",0};
  __pyx_v_type = __pyx_k9;
  __pyx_v_filter = __pyx_k10;
  __pyx_v_mipmap = __pyx_k11;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|OOO", __pyx_argnames, &__pyx_v_texture_id, &__pyx_v_byte_string, &__pyx_v_size, &__pyx_v_type, &__pyx_v_filter, &__pyx_v_mipmap)) return 0;
  Py_INCREF(__pyx_v_texture_id);
  Py_INCREF(__pyx_v_byte_string);
  Py_INCREF(__pyx_v_size);
  Py_INCREF(__pyx_v_type);
  Py_INCREF(__pyx_v_filter);
  Py_INCREF(__pyx_v_mipmap);
  __pyx_v_ptype = Py_None; Py_INCREF(Py_None);
  __pyx_v_channels = Py_None; Py_INCREF(Py_None);
  __pyx_v_filter_type = Py_None; Py_INCREF(Py_None);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":240 */
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_get_gl_vendor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; goto __pyx_L1;}
  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_3 = PyObject_IsTrue(__pyx_2); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = (!__pyx_3);
  if (__pyx_4) {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":241 */
    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
    Py_INCREF(__pyx_k13p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k13p);
    __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_5, 0, 0);
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":244 */
  __pyx_6 = PyString_AsString(__pyx_v_byte_string); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; goto __pyx_L1;}
  __pyx_v_data = __pyx_6;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":245 */
  if (PyObject_Cmp(__pyx_v_type, __pyx_n_RGBA, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; goto __pyx_L1;}
  __pyx_3 = __pyx_3 == 0;
  if (__pyx_3) {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":246 */
    __pyx_1 = PyInt_FromLong(GL_RGBA); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; goto __pyx_L1;}
    Py_DECREF(__pyx_v_ptype);
    __pyx_v_ptype = __pyx_1;
    __pyx_1 = 0;

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":247 */
    __pyx_2 = PyInt_FromLong(4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;}
    Py_DECREF(__pyx_v_channels);
    __pyx_v_channels = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L3;
  }
  if (PyObject_Cmp(__pyx_v_type, __pyx_n_RGB, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; goto __pyx_L1;}
  __pyx_4 = __pyx_4 == 0;
  if (__pyx_4) {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":249 */
    __pyx_5 = PyInt_FromLong(GL_RGB); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
    Py_DECREF(__pyx_v_ptype);
    __pyx_v_ptype = __pyx_5;
    __pyx_5 = 0;

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":250 */
    __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; goto __pyx_L1;}
    Py_DECREF(__pyx_v_channels);
    __pyx_v_channels = __pyx_1;
    __pyx_1 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":252 */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
    Py_INCREF(__pyx_k16p);
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k16p);
    __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __Pyx_Raise(__pyx_1, 0, 0);
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
  }
  __pyx_L3:;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":254 */
  __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
  __pyx_5 = PyObject_GetItem(__pyx_v_size, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
  __pyx_2 = PyObject_GetItem(__pyx_v_size, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyNumber_Multiply(__pyx_5, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_5 = PyNumber_Multiply(__pyx_1, __pyx_v_channels); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
  Py_INCREF(__pyx_v_byte_string);
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_byte_string);
  __pyx_7 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (PyObject_Cmp(__pyx_5, __pyx_7, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
  __pyx_3 = __pyx_3 != 0;
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  Py_DECREF(__pyx_7); __pyx_7 = 0;
  if (__pyx_3) {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":255 */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;}
    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;}
    Py_INCREF(__pyx_k17p);
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k17p);
    __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __Pyx_Raise(__pyx_5, 0, 0);
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":257 */
  __pyx_7 = PyInt_FromLong(GL_NEAREST); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; goto __pyx_L1;}
  Py_DECREF(__pyx_v_filter_type);
  __pyx_v_filter_type = __pyx_7;
  __pyx_7 = 0;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":258 */
  __pyx_4 = PyObject_IsTrue(__pyx_v_filter); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; goto __pyx_L1;}
  if (__pyx_4) {
    __pyx_2 = PyInt_FromLong(GL_LINEAR); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; goto __pyx_L1;}
    Py_DECREF(__pyx_v_filter_type);
    __pyx_v_filter_type = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":259 */
  __pyx_8 = PyInt_AsUnsignedLongMask(__pyx_v_texture_id); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; goto __pyx_L1;}
  glBindTexture(GL_TEXTURE_2D,__pyx_8);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":260 */
  __pyx_9 = PyInt_AsLong(__pyx_v_filter_type); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; goto __pyx_L1;}
  glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,__pyx_9);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":261 */
  __pyx_3 = PyObject_IsTrue(__pyx_v_mipmap); if (__pyx_3 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; goto __pyx_L1;}
  if (__pyx_3) {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":262 */
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":263 */
    __pyx_9 = PyInt_AsLong(__pyx_v_channels); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; goto __pyx_L1;}
    __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; goto __pyx_L1;}
    __pyx_5 = PyObject_GetItem(__pyx_v_size, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_10 = PyInt_AsLong(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_7 = PyInt_FromLong(1); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; goto __pyx_L1;}
    __pyx_2 = PyObject_GetItem(__pyx_v_size, __pyx_7); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; goto __pyx_L1;}
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    __pyx_11 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_12 = PyInt_AsUnsignedLongMask(__pyx_v_ptype); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; goto __pyx_L1;}
    gluBuild2DMipmaps(GL_TEXTURE_2D,__pyx_9,__pyx_10,__pyx_11,__pyx_12,GL_UNSIGNED_BYTE,__pyx_v_data);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":265 */
    __pyx_9 = PyInt_AsLong(__pyx_v_filter_type); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,__pyx_9);

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":266 */
    __pyx_9 = PyInt_AsLong(__pyx_v_ptype); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
    __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
    __pyx_5 = PyObject_GetItem(__pyx_v_size, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_10 = PyInt_AsLong(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_7 = PyInt_FromLong(1); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
    __pyx_2 = PyObject_GetItem(__pyx_v_size, __pyx_7); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    __pyx_11 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_12 = PyInt_AsUnsignedLongMask(__pyx_v_ptype); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
    glTexImage2D(GL_TEXTURE_2D,0,__pyx_9,__pyx_10,__pyx_11,0,__pyx_12,GL_UNSIGNED_BYTE,__pyx_v_data);
  }
  __pyx_L6:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_7);
  __Pyx_AddTraceback("rabbyt._rabbyt.update_texture");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_ptype);
  Py_DECREF(__pyx_v_channels);
  Py_DECREF(__pyx_v_filter_type);
  Py_DECREF(__pyx_v_texture_id);
  Py_DECREF(__pyx_v_byte_string);
  Py_DECREF(__pyx_v_size);
  Py_DECREF(__pyx_v_type);
  Py_DECREF(__pyx_v_filter);
  Py_DECREF(__pyx_v_mipmap);
  return __pyx_r;
}

static PyObject *__pyx_f_6rabbyt_7_rabbyt_unload_texture(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6rabbyt_7_rabbyt_unload_texture[] = "\n    ``unload_texture(texture_id)``\n\n    Unload a texture from memory.\n    ";
static PyObject *__pyx_f_6rabbyt_7_rabbyt_unload_texture(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_texture_id = 0;
  GLuint (__pyx_v_textures[1]);
  PyObject *__pyx_r;
  GLuint __pyx_1;
  static char *__pyx_argnames[] = {"texture_id",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_texture_id)) return 0;
  Py_INCREF(__pyx_v_texture_id);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":275 */
  __pyx_1 = PyInt_AsUnsignedLongMask(__pyx_v_texture_id); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; goto __pyx_L1;}
  (__pyx_v_textures[0]) = __pyx_1;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":276 */
  glDeleteTextures(1,__pyx_v_textures);

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("rabbyt._rabbyt.unload_texture");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_texture_id);
  return __pyx_r;
}

static PyObject *__pyx_n_tuple;

static PyObject *__pyx_f_6rabbyt_7_rabbyt_clear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6rabbyt_7_rabbyt_clear[] = "\n    ``clear(rgba=(0.0,0.0,0.0,1.0))``\n\n    Clear the screen to a background color.\n    ";
static PyObject *__pyx_f_6rabbyt_7_rabbyt_clear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rgba = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  GLclampf __pyx_5;
  GLclampf __pyx_6;
  GLclampf __pyx_7;
  GLclampf __pyx_8;
  static char *__pyx_argnames[] = {"rgba",0};
  __pyx_v_rgba = __pyx_k12;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_rgba)) return 0;
  Py_INCREF(__pyx_v_rgba);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":284 */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}
  Py_INCREF(__pyx_v_rgba);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_rgba);
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;}
  __pyx_4 = __pyx_4 == 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (__pyx_4) {

    /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":285 */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
    Py_INCREF(__pyx_v_rgba);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_rgba);
    __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_2 = PyFloat_FromDouble(1.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_2 = PyNumber_Add(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_v_rgba);
    __pyx_v_rgba = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":286 */
  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  __pyx_3 = PyObject_GetItem(__pyx_v_rgba, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_5 = PyFloat_AsDouble(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  __pyx_1 = PyObject_GetItem(__pyx_v_rgba, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_6 = PyFloat_AsDouble(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  __pyx_2 = PyObject_GetItem(__pyx_v_rgba, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_7 = PyFloat_AsDouble(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_1 = PyInt_FromLong(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  __pyx_3 = PyObject_GetItem(__pyx_v_rgba, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_8 = PyFloat_AsDouble(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  glClearColor(__pyx_5,__pyx_6,__pyx_7,__pyx_8);

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":287 */
  glClear(GL_COLOR_BUFFER_BIT);

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("rabbyt._rabbyt.clear");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_rgba);
  return __pyx_r;
}

static __Pyx_InternTabEntry __pyx_intern_tab[] = {
  {&__pyx_n_RGB, "RGB"},
  {&__pyx_n_RGBA, "RGBA"},
  {&__pyx_n_RuntimeError, "RuntimeError"},
  {&__pyx_n_True, "True"},
  {&__pyx_n_ValueError, "ValueError"},
  {&__pyx_n___author__, "__author__"},
  {&__pyx_n___credits__, "__credits__"},
  {&__pyx_n_clear, "clear"},
  {&__pyx_n_get_gl_vendor, "get_gl_vendor"},
  {&__pyx_n_len, "len"},
  {&__pyx_n_list, "list"},
  {&__pyx_n_load_texture, "load_texture"},
  {&__pyx_n_load_texture_file_hook, "load_texture_file_hook"},
  {&__pyx_n_render, "render"},
  {&__pyx_n_render_sorted, "render_sorted"},
  {&__pyx_n_render_unsorted, "render_unsorted"},
  {&__pyx_n_set_default_attribs, "set_default_attribs"},
  {&__pyx_n_set_gl_color, "set_gl_color"},
  {&__pyx_n_set_load_texture_file_hook, "set_load_texture_file_hook"},
  {&__pyx_n_set_viewport, "set_viewport"},
  {&__pyx_n_sort, "sort"},
  {&__pyx_n_tuple, "tuple"},
  {&__pyx_n_unload_texture, "unload_texture"},
  {&__pyx_n_update_texture, "update_texture"},
  {0, 0}
};

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_k1p, __pyx_k1, sizeof(__pyx_k1)},
  {&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2)},
  {&__pyx_k13p, __pyx_k13, sizeof(__pyx_k13)},
  {&__pyx_k16p, __pyx_k16, sizeof(__pyx_k16)},
  {&__pyx_k17p, __pyx_k17, sizeof(__pyx_k17)},
  {0, 0, 0}
};

static struct PyMethodDef __pyx_methods[] = {
  {"set_load_texture_file_hook", (PyCFunction)__pyx_f_6rabbyt_7_rabbyt_set_load_texture_file_hook, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6rabbyt_7_rabbyt_set_load_texture_file_hook},
  {"render_unsorted", (PyCFunction)__pyx_f_6rabbyt_7_rabbyt_render_unsorted, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6rabbyt_7_rabbyt_render_unsorted},
  {"render_sorted", (PyCFunction)__pyx_f_6rabbyt_7_rabbyt_render_sorted, METH_VARARGS|METH_KEYWORDS, 0},
  {"set_viewport", (PyCFunction)__pyx_f_6rabbyt_7_rabbyt_set_viewport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6rabbyt_7_rabbyt_set_viewport},
  {"set_default_attribs", (PyCFunction)__pyx_f_6rabbyt_7_rabbyt_set_default_attribs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6rabbyt_7_rabbyt_set_default_attribs},
  {"set_gl_color", (PyCFunction)__pyx_f_6rabbyt_7_rabbyt_set_gl_color, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6rabbyt_7_rabbyt_set_gl_color},
  {"get_gl_vendor", (PyCFunction)__pyx_f_6rabbyt_7_rabbyt_get_gl_vendor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6rabbyt_7_rabbyt_get_gl_vendor},
  {"load_texture", (PyCFunction)__pyx_f_6rabbyt_7_rabbyt_load_texture, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6rabbyt_7_rabbyt_load_texture},
  {"update_texture", (PyCFunction)__pyx_f_6rabbyt_7_rabbyt_update_texture, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6rabbyt_7_rabbyt_update_texture},
  {"unload_texture", (PyCFunction)__pyx_f_6rabbyt_7_rabbyt_unload_texture, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6rabbyt_7_rabbyt_unload_texture},
  {"clear", (PyCFunction)__pyx_f_6rabbyt_7_rabbyt_clear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6rabbyt_7_rabbyt_clear},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

PyMODINIT_FUNC init_rabbyt(void); /*proto*/
PyMODINIT_FUNC init_rabbyt(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  PyObject *__pyx_5 = 0;
  PyObject *__pyx_6 = 0;
  PyObject *__pyx_7 = 0;
  PyObject *__pyx_8 = 0;
  PyObject *__pyx_9 = 0;
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("_rabbyt", __pyx_methods, 0, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":2 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n___credits__, __pyx_k1p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":20 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n___author__, __pyx_k2p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":98 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_load_texture_file_hook, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":138 */
  Py_INCREF(Py_None);
  __pyx_k3 = Py_None;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":218 */
  Py_INCREF(__pyx_n_RGBA);
  __pyx_k5 = __pyx_n_RGBA;
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_True); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
  __pyx_k6 = __pyx_1;
  __pyx_1 = 0;
  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_True); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
  __pyx_k7 = __pyx_2;
  __pyx_2 = 0;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":231 */
  Py_INCREF(__pyx_n_RGBA);
  __pyx_k9 = __pyx_n_RGBA;
  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_True); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
  __pyx_k10 = __pyx_3;
  __pyx_3 = 0;
  __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_True); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
  __pyx_k11 = __pyx_4;
  __pyx_4 = 0;

  /* "/home/mmarshall/projects/rabbyt/rabbyt/rabbyt._rabbyt.pyx":278 */
  __pyx_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
  __pyx_6 = PyFloat_FromDouble(0.0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
  __pyx_7 = PyFloat_FromDouble(0.0); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
  __pyx_8 = PyFloat_FromDouble(1.0); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
  __pyx_9 = PyTuple_New(4); if (!__pyx_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_9, 0, __pyx_5);
  PyTuple_SET_ITEM(__pyx_9, 1, __pyx_6);
  PyTuple_SET_ITEM(__pyx_9, 2, __pyx_7);
  PyTuple_SET_ITEM(__pyx_9, 3, __pyx_8);
  __pyx_5 = 0;
  __pyx_6 = 0;
  __pyx_7 = 0;
  __pyx_8 = 0;
  __pyx_k12 = __pyx_9;
  __pyx_9 = 0;
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_6);
  Py_XDECREF(__pyx_7);
  Py_XDECREF(__pyx_8);
  Py_XDECREF(__pyx_9);
  __Pyx_AddTraceback("rabbyt._rabbyt");
}

static char *__pyx_filenames[] = {
  "rabbyt._rabbyt.pyx",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static void __Pyx_UnpackError(void) {
    PyErr_SetString(PyExc_ValueError, "unpack sequence of wrong size");
}

static PyObject *__Pyx_UnpackItem(PyObject *iter) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred())
            __Pyx_UnpackError();
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        __Pyx_UnpackError();
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    /* Next, repeatedly, replace a tuple exception with its first item */
    while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
        PyObject *tmp = type;
        type = PyTuple_GET_ITEM(type, 0);
        Py_INCREF(type);
        Py_DECREF(tmp);
    }
    if (PyString_Check(type)) {
        if (PyErr_Warn(PyExc_DeprecationWarning,
                "raising a string exception is deprecated"))
            goto raise_error;
    }
    else if (PyType_Check(type) || PyClass_Check(type))
        ; /*PyErr_NormalizeException(&type, &value, &tb);*/
    else {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        if (PyInstance_Check(type))
            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
        else
            type = (PyObject*) type->ob_type;
        Py_INCREF(type);
    }
    PyErr_Restore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
    while (t->p) {
        *t->p = PyString_InternFromString(t->s);
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_tuple = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    
    py_srcfile = PyString_FromString(__pyx_filename);
    if (!py_srcfile) goto bad;
    py_funcname = PyString_FromString(funcname);
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    empty_tuple = PyTuple_New(0);
    if (!empty_tuple) goto bad;
    empty_string = PyString_FromString("");
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        empty_tuple,  /*PyObject *consts,*/
        empty_tuple,  /*PyObject *names,*/
        empty_tuple,  /*PyObject *varnames,*/
        empty_tuple,  /*PyObject *freevars,*/
        empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_Get(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_tuple);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
