<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Overfloater &#187; V8-GL</title>
	<atom:link href="http://blog.thejit.org/category/v8-gl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thejit.org</link>
	<description>Data Visualization, JavaScript and Computer Science related stuff</description>
	<lastBuildDate>Sun, 18 Jul 2010 13:38:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>V8-GL Update</title>
		<link>http://blog.thejit.org/2009/07/13/v8-gl-update/</link>
		<comments>http://blog.thejit.org/2009/07/13/v8-gl-update/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 17:36:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[V8]]></category>
		<category><![CDATA[V8-GL]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[opengl]]></category>

		<guid isPermaLink="false">http://blog.thejit.org/?p=951</guid>
		<description><![CDATA[I&#8217;ve been quite busy these days. 
I&#8217;ve been answering questions at the JavaScript InfoVis Toolkit Google Group, fixing a couple of bugs for the JIT and putting a lot of effort in V8-GL.
Oh right, I was almost forgetting that I have a day job also :S
Anyway, V8-GL kind of took another direction. I&#8217;ve been working [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been quite busy these days. </p>
<p>I&#8217;ve been answering questions at the <a href="http://groups.google.com/group/javascript-information-visualization-toolkit">JavaScript InfoVis Toolkit Google Group</a>, fixing a couple of bugs for the <a href="http://thejit.org">JIT</a> and putting a lot of effort in <a href="http://github.com/philogb/v8-gl/tree/master/#readme">V8-GL</a>.</p>
<p>Oh right, I was almost forgetting that I have a day job also :S</p>
<p>Anyway, V8-GL kind of took another direction. I&#8217;ve been working on OpenGL ES 2.0 and OpenGL 2.1 bindings. </p>
<p>OpenGL ES 2.0 bindings are almost complete. Other bindings (like OpenGL 2.1, GLUT and GLU) need some extra work, but they are functional.</p>
<p><a href="http://github.com/deanm">Dean</a> helped a lot also. He just translated <a href="http://blog.vlad1.com/2007/11/26/canvas-3d-gl-power-web-style/">Vlad&#8217;s</a> metatunnel example to work with the new OpenGL ES 2.0 bindings. The result&#8217;s pretty impressive:</p>
<p><img src="/wp-content/metatunnel.png" title="Metatunnel on V8-GL!" style="width:500px;" /></p>
<p>You can find some videos of &#8220;Metatunnel&#8221; implemented in Processing or Canvas3D at <a href="http://www.youtube.com/watch?v=qryxLDujyVk">Youtube</a>. </p>
<p>The good thing about the <em>V8-GL example</em> is that&#8217;s a Desktop app coded in JavaScript using V8.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thejit.org/2009/07/13/v8-gl-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>V8-GL</title>
		<link>http://blog.thejit.org/2009/06/21/v8-gl/</link>
		<comments>http://blog.thejit.org/2009/06/21/v8-gl/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 22:35:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[V8]]></category>
		<category><![CDATA[V8-GL]]></category>
		<category><![CDATA[v8 javascript opengl v8-gl]]></category>

		<guid isPermaLink="false">http://blog.thejit.org/?p=925</guid>
		<description><![CDATA[I&#8217;ve been doing a couple of changes to the JavaScript InfoVis Tookit lately, which I&#8217;ll describe in some other post, but most important I&#8217;ve been working on a new project I&#8217;m really excited about that&#8217;s called V8-GL.
What&#8217;s V8-GL?

V8-GL intends to provide a high-level JavaScript API for creating 2D/3D hardware accelerated desktop graphics.
In other words, you [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a couple of changes to the <a href="http://thejit.org">JavaScript InfoVis Tookit</a> lately, which I&#8217;ll describe in some other post, but most important I&#8217;ve been working on a new project I&#8217;m really excited about that&#8217;s called <a href="http://github.com/philogb/v8-gl/tree/master#readme">V8-GL</a>.</p>
<h4>What&#8217;s V8-GL?</h4>
<p><img src="/wp-content/v8gl2.png" style="width:500px" title="2D and 3D Desktop Hardware Accelerated Graphics in JS" /></p>
<p><a href="http://github.com/philogb/v8-gl/tree/master#readme">V8-GL</a> intends to provide a high-level JavaScript API for creating 2D/3D hardware accelerated desktop graphics.</p>
<p>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 <a href="http://code.google.com/p/v8/">V8 JavaScript engine</a>.</p>
<h4>Example</h4>
<p>I wrote a small example that animates a rotating Icosahedron. This example uses timers, colors and lighting among other things:</p>
<pre name="code" class="js:nogutter:nocontrols">
//Add array iteration method
Array.prototype.each = function(f) {
	var len = this.length;
	for ( var i = 0; i < len; i++) f(this[i]);
};

//Initializes 3D rendering
function initRendering() {
	"DEPTH_TEST COLOR_MATERIAL LIGHTING LIGHT0 NORMALIZE COLOR_MATERIAL"
		.split(" ").each(function(elem) {
		Gl.Enable(Gl[elem]);
	});
}

//angle variable
var angle = 0;

//Draws the 3D scene
function drawScene() {
	//Set global color and drawing properties
	Gl.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 lights
	Gl.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 Icosahedron
	Gl.Rotatef(angle, 1.0, 1.0, 1.0);
	Gl.Color3f(0.5, 0.0, 0.8);
	Glut.SolidIcosahedron(2.5);
	//Render
	Glut.SwapBuffers();
}

(function() {
	//Initialize Glut
	Glut.Init();
	Glut.InitDisplayMode(Glut.DOUBLE | Glut.RGB | Glut.DEPTH);
	Glut.InitWindowSize(400, 400); //Set the window size
	//Create the window
	Glut.CreateWindow("OpenGL on V8 baby!");
	initRendering();
	//Set drawing callback
	Glut.DisplayFunc(drawScene);
	//Set resize window callback
	Glut.ReshapeFunc(function(w, h) {
		var gl = { 'Viewport': [0, 0, w, h], 'MatrixMode': [Gl.PROJECTION], 'LoadIdentity': [] };
		for (var i in gl) Gl[i].apply(this, gl[i]);
		Glu.Perspective(45.0, w / h, 1.0, 200.0);
	});
	//Set timeout callback
	Glut.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();
})();
</pre>
<p>OpenGL devs. might recognize the API exposed through the Gl, Glu and Glut objects.</p>
<h4>Status</h4>
<p>Currently 80% of the OpenGL API is implemented. OpenGL APIs are exposed through the Gl, Glu and Glut global objects.</p>
<p>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.</p>
<p>Although this project is in current development you can already clone the repo and follow the <em>Download</em> instructions at the <a href="http://github.com/philogb/v8-gl/tree/master#readme">V8-GL project page</a> for creating some cool examples.</p>
<p>Hope you like it <img src='http://blog.thejit.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thejit.org/2009/06/21/v8-gl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
