pocketwatch


An opengl graphics library for python.

Pocketwatch

is...

Pocket watch is an OpenGL graphics library for python, intended to be used in a manor which makes sense to people who typically work with 2d graphics. Pocketwatch makes use of C++ to do some basic memory management, and uses this to do the bulk of the opengl calls for drawing your objects and things. Pocketwatch features an api for writing plugins to extend the backend, so that you can easily write more advanced code if you need to, and distribute it separately.

Pocketwatch provides a simple api to make use of this backend to write simple 3d programs.

why!?

Because I want to write python programs that can render opengl graphics with reasonable performance. Somewhere along the way someone told me a dirty dirty lie, which is to say that pyopengl can do this. Despite what your mother may have told you, using ctypes to do lots of opengl calls is actually very SLOW. So instead, I took all of the code that I could, and wrote a simple C++ library to do all the nitty gritty stuff, and wrote a python state-sorter which could render all of the objects with a single ctypes call.

what about pyglet?

Pyglet is awesome, and pocketwatch uses pyglet to do some specific things like window management, rendering text, and opening images. Pyglet now supports some features that may have been useful to solving the problems I had when I started writing pocketwatch. But even then, said features didn't seem flexible enough to do what I wanted. Maybe this is different now, maybe not.

also

Pocketwatch is in a 'beta' phase, so the api is prone to change, some code is not as clean as I'd like it to be, and not all of the features I want are implemented yet. However, there is only a little bit of work left needed before it can be considered stable. None the less, use at your own risk.

features

  • simple, intuitive api
  • model loading
  • state sorting
  • color based mouse picking
  • extendable in C++ and python
  • cross platform support
  • rudimentary GLSL support!

Project Information

Labels:
python pyglet opengl