-
Notifications
You must be signed in to change notification settings - Fork 0
TODO
Cyrille Rossant edited this page Aug 24, 2013
·
7 revisions
This repository will contain a proof of concept for a possible WebGL backend for VisPy.
The general idea is to stream GL commands from Python to Javascript through WebSockets and a custom JSON-based messaging protocol. Javascript acquires a GL context, and Python handles the conversion from a visualization application written by the user to a stream of OpenGL commands responding to user input.
We try to design an architecture that is close to the IPython notebook architecture.
This is just a proof of concept, to see if this idea is feasible.
Things to do:
- [DONE] Install Tornado and look at the documentation.
- [DONE] Write a toy example with bidirectional communication between Javascript and Tornado, through WebSockets, to get a feeling about how Python and Javascript can play with each other.
- [DONE] Building on this example, write a toy WebGL example with a simple object moving in response to commands sent by Python.
- Design a simple JSON-based messaging protocol, containing a GL command with arguments and data. It should also be able to contain user events (see event system in VisPy).
- Write standalone Python/Javascript libraries that can exchange NumPy arrays through JSON & base64.
- Four things:
- From NumPy to a JSON string
- From a Javascript buffer to a JSON string
- From a JSON string to a Javascript buffer
- From a JSON string to a NumPy array
- This library should support arbitrary complex datatypes.
- Relevant links:
- http://stackoverflow.com/questions/16887278/webgl-vertex-buffer-with-more-than-4-dimensional-coordinates
- https://developer.mozilla.org/en-US/docs/Code_snippets/StringView
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays?redirectlocale=en-US&redirectslug=JavaScript%2FTyped_arrays
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Base64_encoding_and_decoding#Appendix.3A_Decode_a_Base64_string_to_Uint8Array_or_ArrayBuffer
- https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes?redirectlocale=en-US&redirectslug=js-ctypes
- Four things:
- Javascript can be executed from Python with pyv8, might be useful for unit tests.
- Final goal: Write a Python library that takes GL commands as input and sends them to Javascript, which executes them in a WebGL canvas.