|
1 | | -NodeBox for OpenGL 1.6 |
2 | | -http://cityinabottle.org/nodebox |
| 1 | +NodeBox for OpenGL |
| 2 | +================== |
| 3 | + |
| 4 | +NodeBox for OpenGL is a Python module for creating 2D interactive visuals using OpenGL. It is based on the command set of the classic NodeBox for Mac OS X (http://nodebox.net). It has support for Bezier paths, text, image filters (blur, bloom, ...), offscreen rendering, animation & motion tweening, and simple 2D physics. Its purpose is to implement a small game engine for "City In A Bottle" (http://cityinabottle.org). |
| 5 | + |
| 6 | +VERSION |
| 7 | +======= |
| 8 | + |
| 9 | +1.6 |
| 10 | + |
| 11 | +LICENSE |
| 12 | +======= |
| 13 | + |
| 14 | +BSD, see LICENSE.txt for further details. |
| 15 | + |
| 16 | +REQUIREMENTS |
| 17 | +============ |
| 18 | + |
| 19 | +NodeBox for OpenGL is built on the excellent Pyglet module. It works on all platforms if you have Python and Pyglet installed. Note: on Mac OS 10.5, Python is already installed. On Mac OS X 10.6+ (Snow Leopard), you need to install a 32-bit version of Python (Pyglet won't work as expected with the preinstalled 64-bit version). |
| 20 | + |
| 21 | +- Python 2.5-6 : an installer can be downloaded from http://www.python.org/download/ |
| 22 | +- Pyglet 1.4+ : an installer can be downloaded from http://www.pyglet.org/ |
| 23 | + |
| 24 | +Your video hardware needs support for OpenGL 2.0. |
| 25 | +If this is not the case, try updating to a new driver. |
| 26 | + |
| 27 | +INSTALLATION |
| 28 | +============ |
| 29 | + |
| 30 | +To be able to import NodeBox in your scripts, Python needs to know where the module is located. |
| 31 | +There are three basic ways to accomplish this: |
| 32 | + |
| 33 | +- Put the nodebox/ folder in the same folder as your script. |
| 34 | +- Put the nodebox/ folder in the standard location for modules so it is available to all scripts. |
| 35 | + The standard location depends on your operating system, for example: |
| 36 | + /Library/Python/2.5/site-packages/ on Mac, |
| 37 | + /usr/lib/python2.5/site-packages/ on Unix, |
| 38 | + c:\python25\Lib\site-packages\ on Windows. |
| 39 | +- In your script, add the location of NodeBox to sys.path, before importing it: |
| 40 | + >>> MODULE = '/users/tom/python/nodebox' |
| 41 | + >>> import sys; if MODULE not in sys.path: sys.path.append(MODULE) |
| 42 | + >>> import nodebox |
| 43 | + |
| 44 | +If you get an "import pyglet" error, make sure that Pyglet is installed in site-packages/ too. |
| 45 | + |
| 46 | +Binaries: |
| 47 | +NodeBox contains C extensions for faster mathematics. |
| 48 | +These are precompiled for Mac, on other systems you need to execute "python setup.py" in nodebox/ext/ manually. |
| 49 | +Psyco (http://psyco.sourceforge.net/) can boost performance as well (if you use a 32-bit Python). |
| 50 | +A version precompiled for Mac is included in nodebox/ext/. |
| 51 | + |
| 52 | +USAGE |
| 53 | +===== |
| 54 | + |
| 55 | +- For users coming from NodeBox for Mac OS X, or NodeBox 2: this NodeBox for OpenGL does not have a built-in code editor. You can use the IDLE editor bundled with Python. On Mac OS X, we prefer TextMate (http://macromates.com). |
| 56 | +- From the command line, you can run a script with: python example.py (or command-R in TextMate) |
| 57 | +- This will open an application window with the output of your script. |
| 58 | + |
| 59 | +Here is a simple NodeBox script: |
| 60 | + |
| 61 | +>>> from nodebox.graphics import * |
| 62 | +>>> def draw(canvas): |
| 63 | +>>> canvas.clear() |
| 64 | +>>> translate(250, 250) |
| 65 | +>>> rotate(canvas.frame) |
| 66 | +>>> rect(x=-50, y=-50, width=100, height=100) |
| 67 | +>>> canvas.size = 500, 500 |
| 68 | +>>> canvas.run(draw) |
| 69 | + |
| 70 | +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(). |
| 71 | + |
| 72 | +DOCUMENTATION |
| 73 | +============= |
| 74 | + |
| 75 | +http://cityinabottle.org/nodebox |
| 76 | + |
| 77 | +ACKNOWLEDGEMENTS |
| 78 | +================ |
| 79 | + |
| 80 | +Authors: |
| 81 | +- Tom De Smedt (tom@organisms.be) |
| 82 | +- Frederik De Bleser (frederik@burocrazy.com) |
| 83 | + |
| 84 | +Contributing authors: |
| 85 | +- Lieven Menschaert |
| 86 | +- Giorgio Olivero |
| 87 | + |
| 88 | +City In A Bottle: |
| 89 | +- Nicolas Marinus |
| 90 | +- Ludivine Lechat |
| 91 | +- Tim Vets |
| 92 | +- Frederik De Bleser |
| 93 | +- Tom De Smedt |
| 94 | + |
| 95 | +Copyright (c) 2008 City In A Bottle |
0 commit comments