Hi! I'm Nicolas and I'm interested in information visualization, JavaScript and web standards.
I currently work as a Data Visualization Scientist at Twitter. I wrote PhiloGL, the JavaScript InfoVis Toolkit and V8-GL.
I've been doing a couple of changes to the JavaScript InfoVis Tookit lately, which I'll describe in some other post, but most important I've been working on a new project I'm really excited about that's called V8-GL.
What's V8-GL?
[V8-GL](http://github.com/philogb/v8-gl/tree/master#readme) intends to provide a high-level JavaScript API for creating 2D/3D hardware accelerated desktop graphics.
In other words, you can hack some JavaScript code that opens a desktop window and renders some 3D hardware accelerated graphics. Bindings are made using the V8 JavaScript engine.
Example
I wrote a small example that animates a rotating Icosahedron. This example uses timers, colors and lighting among other things:
//Add array iteration methodArray.prototype.each=function(f){varlen=this.length;for(vari=0;i<len;i++)f(this[i]);};//Initializes 3D renderingfunctioninitRendering(){"DEPTH_TEST COLOR_MATERIAL LIGHTING LIGHT0 NORMALIZE COLOR_MATERIAL".split(" ").each(function(elem){Gl.Enable(Gl[elem]);});}//angle variablevarangle=0;//Draws the 3D scenefunctiondrawScene(){//Set global color and drawing propertiesGl.Clear(Gl.COLOR_BUFFER_BIT|Gl.DEPTH_BUFFER_BIT);Gl.MatrixMode(Gl.MODELVIEW);Gl.LoadIdentity();Gl.Translatef(0.0,0.0,-5.0);//Set diffuse and positioned lightsGl.LightModelfv(Gl.LIGHT_MODEL_AMBIENT,[0.3,0.3,0.3,1.0]);Gl.Lightfv(Gl.LIGHT0,Gl.DIFFUSE,[0.4,0.4,0.4,1.0]);Gl.Lightfv(Gl.LIGHT0,Gl.POSITION,[5.0,5.0,5.0,1.0]);//Rotate and plot IcosahedronGl.Rotatef(angle,1.0,1.0,1.0);Gl.Color3f(0.5,0.0,0.8);Glut.SolidIcosahedron(2.5);//RenderGlut.SwapBuffers();}(function(){//Initialize GlutGlut.Init();Glut.InitDisplayMode(Glut.DOUBLE|Glut.RGB|Glut.DEPTH);Glut.InitWindowSize(400,400);//Set the window size//Create the windowGlut.CreateWindow("OpenGL on V8 baby!");initRendering();//Set drawing callbackGlut.DisplayFunc(drawScene);//Set resize window callbackGlut.ReshapeFunc(function(w,h){vargl={'Viewport':[0,0,w,h],'MatrixMode':[Gl.PROJECTION],'LoadIdentity':[]};for(variingl)Gl[i].apply(this,gl[i]);Glu.Perspective(45.0,w/h,1.0,200.0);});//Set timeout callbackGlut.TimerFunc(25,function(){angle+=2.0;if(angle>360)angle-=360;Glut.PostRedisplay();Glut.TimerFunc(25,arguments.callee,0);},0);//Start the main loop.Glut.MainLoop();})();
OpenGL devs. might recognize the API exposed through the Gl, Glu and Glut objects.
Status
Currently 80% of the OpenGL API is implemented. OpenGL APIs are exposed through the Gl, Glu and Glut global objects.
However, like I said before, this project is not just about making OpenGL bindings for JavaScript through V8, but to provide a higher level API.
Although this project is in current development you can already clone the repo and follow the Download instructions at the V8-GL project page for creating some cool examples.
Hope you like it :)