Giter VIP home page Giter VIP logo

lux's Introduction

Lux: the DSL for WebGL Graphics

Lux provides a set of primitives that make WebGL programming easier and cleaner.

Using Lux

Lux is under heavy development, so the current state of documentation is less than ideal. Still, I make a serious effort to keep all the Lux demos working, and you can see them live here.

If you cloned the Lux repo, you can find the demos in the demos/ directory. Because of AJAX security restrictions, you will probably want to run a local webserver instead of accessing the files through the file:// scheme (files in the file:/// scheme are considered all as being different domains, to prevent malicious scripts from trolling your hard drive). The easiest way to do this if you run any modern Unix is to chdir to the local Lux repository and run

python -m SimpleHTTPServer 8888

Then simply point your browser at http://localhost:8888/demos.

Development Setup

If you want to fix a bug on Lux or extend it somehow, you'll need node.js and npm. They're used to build Lux. On Ubuntu 11.04 and later, you can say

sudo apt-get install nodejs

to get node.js, but as far as I'm aware you're on your own to install npm. On OS X, I like homebrew:

brew install node
brew install npm

After you have installed node and npm, chdir to the base lux directory and type

npm install

You should now be able to use Lux's makefile to build lux.js, lux.min.js, and data.js.

Acknowledgments

The build infrastructure of Lux is completely based on Mike Bostock's excellent d3.

lux's People

Contributors

cscheid avatar seanastephens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lux's Issues

Graphing Calculator demo borked

Uncaught TypeError: Object # has no method 'indexOf' lux.js:16909

Looks like the remove function is treating scene as an array instead of an object. I was going to send a pull request, but I don't see a list of actors anywhere.

I'd love to see the graphing calculator working!

performance vs. convenience in API (to type-check or not to type-check?)

Since Javascript is dynamically checked, if a user passes a bad value into a function, the error might only manifest itself much further down the code. Tracking this error down is a slow and opaque problem: the error message will typically come from the innards of Facet, which will confuse users that are not intimately familiar with the library (at present, anyone but me).

The easy way to solve this problem is to add a strict layer of type-checking into every function. This works, but carries a runtime penalty, and good code pays the cost of debugging over and over again. This is not a problem if the API call is not on the application hot path, but some calls are unavoidable: anything that happens per-frame on WebGL should be considered on the hotpath, since spare cycles can be used for more features.

The easy way to solve this problem is to add a strict layer of type-checking into every function. This works, but carries a runtime penalty, and good code pays the cost of debugging over and over again. This is not a problem if the API call is not on the application hot path, but some calls are unavoidable: anything that happens per-frame on WebGL should be considered on the hotpath, since spare cycles can be used for more features. The canonical example of this type of thing is in https://github.com/cscheid/facet/blob/master/src/shade/parameter.js .

I'm leaning towards creating two sets of methods, the slow, type-checked method, and the fast, non-type-checked version.
But what's the best way to expose this in an API? Is it even hopeful to do something like this robustly and effectively?

global namespace pollution

Should review the code so that only a minimal number of global objects are exposed. Ideally, only Lux and Shade should exist. (I could put Shade inside Lux, but I think a lot of code would look bad. The same goes for vec* and mat*)

Shade() should check for multiple parameters

I've been bitten by typing Shade(x, y, z) instead of Shade.vec(x, y, z). We should either check for multiple parameters or actually just call Shade.vec() in case we get more than one parameter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.