NodeBox for OpenGL

BSD

Description

NodeBox for OpenGL (NOGL) is a free, cross-platform library for generating 2D animations with Python programming code. It is based on Pyglet (Python OpenGL toolkit) and augmented with a simple API of drawing commands, near-identical to NodeBox for Mac OS X. Unlike NodeBox for Mac OS X, it does not have an extensive repository of plug-in libraries. However, motion tweening, layers, hardware-accelerated pixel effects (GLSL shaders on-the-fly), geometry & Bézier path interpolation, tesselation and simple physics algorithms have been bundled into the core.

NodeBox for OpenGL handles 3D if one is willing to call OpenGL functions directly. Using VertexArrays it is possible to achieve a decent 3D performance.

NodeBox for OpenGL does not have a GUI. Users can work with an external editor of their own choice (we use TextMate).

Example

This example demonstrates a simple NOGL script. It assumes NOGL, Pyglet and Python are installed on your system. It imports the nodebox.graphics module with the standard set of drawing commands. It defines a draw() function and attaches it to the canvas, so that it will be drawn each animation frame. It opens the main application window with canvas.run().

from nodebox.graphics import *

def draw(canvas):
    canvas.clear()
    translate(250, 250)
    rotate(canvas.frame)
    rect(-200, -200, 400, 400, fill=(1,0,0,1))

canvas.size = 500, 500
canvas.draw = draw
canvas.run()