<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:planet="http://planet.intertwingly.net/" xmlns:indexing="urn:atom-extension:indexing" indexing:index="no"><access:restriction xmlns:access="http://www.bloglines.com/about/specs/fac-1.0" relationship="deny"/>
  <title>Planet WebGL</title>
  <updated>2010-03-11T05:40:08Z</updated>
  <generator uri="http://intertwingly.net/code/venus/">Venus</generator>
  <author>
    <name>Christopher Blizzard</name>
    <email>blizzard@mozilla.com</email>
  </author>
  <id>http://planet-webgl.com/atom.xml</id>
  <link href="http://planet-webgl.com/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://planet-webgl.com/" rel="alternate"/>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1894</id>
    <link href="http://learningwebgl.com/blog/?p=1894" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 9 March 2010</title>
    <summary>Things are moving fast in the WebGL world — I took a few days’ break, and look what happened:

GLGE has reached version 0.2, with a very impressive feature list.  Check out the demo!
…and, even better, you can also try out a real-world application with it; Katalabs have built a virtual museum, which has been [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>Things are moving fast in the WebGL world — I took a few days’ break, and look what happened:</p>
<ul>
<li><a href="http://www.glge.org/glge-v0-2/">GLGE has reached version 0.2</a>, with a very impressive feature list.  Check out the demo!</li>
<li>…and, even better, you can also try out a real-world application with it; <a href="http://www.katalabs.com/">Katalabs have built a virtual museum</a>, which has been getting some pretty <a href="http://nwn.blogs.com/nwn/2010/03/is-web-the-future-of-3d-worlds-a-stanford-researcher-with-second-life-background-gambles-on-just-tha.html">good</a> <a href="http://www.comon.dk/nyheder/Dansk-forsker-starter-3D-firma-1.335424.html">press</a>.
</li><li>It’s not the only WebGL museum out there, though: <a href="http://dojoh.de/synapse/vmuseo/?start">vMuseo (in German) also looks promising</a>.
</li><li>In other framework news, SceneJS now has <a href="http://www.facebook.com/group.php?gid=350488973712&amp;ref=mf">a Facebook group</a>…</li>
<li>…and WebGLU has a new module for optional experimental features, called <a href="http://bjartr.blogspot.com/2010/03/crazyglu-is-for-boids.html">CrazyGLU</a>.</li>
<li>On the subject of crazy, this is either crazy or extremely brave: <a href="http://ogelo3d.free.fr/">Ogelo3d is a project to build a 3D modelling tool like Blender as a WebGL page</a>.
</li><li>The ewgl-matrices library is <a href="http://code.google.com/p/ewgl-matrices/issues/detail?id=20">getting pretty fast</a>, it seems.
</li><li>The <a href="http://gephi.org/">Gephi project</a> (”like Photoshop for graphs”) are looking at a <a href="http://wiki.gephi.org/index.php/Google_Summer_Of_Code_2010#Web-based_network_visualization_engine_with_WebGL">WebGL project for the Google Summer of Code</a>.
</li><li>More WebGL tutorials, <a href="http://3dgames.pl/blog/">this time in Polish</a> — just how to get a WebGL browser so far, though.</li>
<li>Finally: a worthy <a href="http://www.pcpro.co.uk/news/356062/xml3d-the-3d-webs-new-champion">competitor for WebGL (and, indeed O3D)</a>?
</li></ul></div>
    </content>
    <updated>2010-03-09T13:45:33Z</updated>
    <category term="Links"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-09T14:00:03Z</updated>
    </source>
  </entry>

  <entry>
    <id>tag:blogger.com,1999:blog-1513616564513865425.post-6446494501731121770</id>
    <link href="http://bjartr.blogspot.com/feeds/6446494501731121770/comments/default" rel="replies" type="application/atom+xml"/>
    <link href="http://bjartr.blogspot.com/2010/03/crazyglu-is-for-boids.html#comment-form" rel="replies" type="text/html"/>
    <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default/6446494501731121770" rel="edit" type="application/atom+xml"/>
    <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default/6446494501731121770" rel="self" type="application/atom+xml"/>
    <link href="http://bjartr.blogspot.com/2010/03/crazyglu-is-for-boids.html" rel="alternate" type="text/html"/>
    <title>CrazyGLU is for the Boids</title>
    <summary>var postWaveId='55Bl1R4cC';



Hey you! Think WebGLU isn't up to snuff? Let me know why so I can improve it!



As I’ve done work on WebGLU I’ve
implemented a variety of neat features, but in doing so a couple problems have
arisen. The first is that I sometimes have something semi-working, but not
entirely done. The second is that some features don’t really need to be loaded
into every page. The</summary>
    <updated>2010-03-08T22:55:11Z</updated>
    <published>2010-03-08T22:55:00Z</published>
    <author>
      <name>Bjartr</name>
      <email>noreply@blogger.com</email>
      <uri>http://www.blogger.com/profile/04409321734144736503</uri>
    </author>
    <source>
      <id>tag:blogger.com,1999:blog-1513616564513865425</id>
      <author>
        <name>Bjartr</name>
        <email>noreply@blogger.com</email>
        <uri>http://www.blogger.com/profile/04409321734144736503</uri>
      </author>
      <link href="http://bjartr.blogspot.com/feeds/posts/default" rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"/>
      <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default" rel="self" type="application/atom+xml"/>
      <link href="http://bjartr.blogspot.com/" rel="alternate" type="text/html"/>
      <link href="http://pubsubhubbub.appspot.com/" rel="hub" type="text/html"/>
      <subtitle>Benjamin DeLillo's Project Blog</subtitle>
      <title>One Geek's Blog</title>
      <updated>2010-03-08T23:03:54Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1879</id>
    <link href="http://learningwebgl.com/blog/?p=1879" rel="alternate" type="text/html"/>
    <title>Next steps for the lessons, and a demo</title>
    <summary>I’m wondering what I should cover next in the lessons.  The longer-term plan I’m working to right now is to put together something a bit larger than my lessons have been so far; a complete scene demonstrating most of what I’ve covered, but also showing more about program structure.  I’ll aim to build [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>I’m wondering what I should cover next in the lessons.  The longer-term plan I’m working to right now is to put together something a bit larger than my lessons have been so far; a complete scene demonstrating most of what I’ve covered, but also showing more about program structure.  I’ll aim to build it while I write a few more lessons (because there’s more I want to put into it than I’ve tried to explain so far), and then do one large post working through the structure of the big demo.</p>
<p>I’ve started putting something together; it’s called Spacelike (for no reason other than that I felt like writing something called Spacelike) and <a href="http://learningwebgl.com/spacelike/">you can check it out here</a> (a warning — the sky texture is quite large and will take a while to load). The only control right now is that you can orbit the spacecraft by dragging, and zoom in and out with <code>Page Up</code> / <code>Page Down</code>.    Here’s a quick video for those without a WebGL-enabled browser:</p>
<p>&lt;object height="385" width="480"&gt;&lt;param name="movie" value="http://www.youtube.com/v/nrVyA1xwV0o&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed allowfullscreen="true" allowscriptaccess="always" height="385" src="http://www.youtube.com/v/nrVyA1xwV0o&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" width="480"&gt;&lt;/embed&gt;&lt;/object&gt;</p>
<p>Working on this has led me to think of a bunch of different things that feel like they would be worth teaching, some of which are already used in the demo and some of which aren’t:</p>
<ul>
<li>The way cameras interact with lighting.</li>
<li>Sky-spheres and -boxes — that is, background imagery that is always behind objects in the scene.</li>
<li>Picking — the ability to handle the user clicking on an object in a scene.</li>
<li>Shadows — objects casting shadows on other objects.</li>
<li>Exporting meshes from Blender (like the spacecraft in the demo).</li>
<li>Normal-mapping — like <a href="http://learningwebgl.com/blog/?p=1778">specular maps</a>, but with the normals, allowing you to give the impression of much more complex surfaces.</li>
<li>Reflections — shiny stuff.</li>
<li>Particles — flames, smoke, explosions, etc, like in <a href="https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/demos/google/particles/index.html">this Google demo</a>.</li>
<li>Heads-up displays.</li>
</ul>
<p>What do you think?  Do any of these sound particularly cool?  Is there something else that I should be looking at?</p></div>
    </content>
    <updated>2010-03-03T23:51:57Z</updated>
    <category term="Questions"/>
    <category term="Upcoming lessons"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-09T14:00:02Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1877</id>
    <link href="http://learningwebgl.com/blog/?p=1877" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 2 March 2010</title>
    <summary>Fun for those in the San Francisco area, or visiting for the Games Developers Conference: a WebGL social mixer.
This looks pretty cool: an augmented reality demo, using a Flash component to look through your camera for objects with a marker pattern on them and to show the camera’s output on the page, and then X3DOM [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><ul>
<li>Fun for those in the San Francisco area, or visiting for the Games Developers Conference: <a href="http://www.sirikata.com/blog/?p=154">a WebGL social mixer</a>.</li>
<li>This looks pretty cool: <a href="http://i.document.m05.de/?p=836">an augmented reality demo</a>, using a Flash component to look through your camera for objects with a marker pattern on them and to show the camera’s output on the page, and then X3DOM on top of WebGL to render <a href="http://dev.m05.de/clouded_earth/clouded_earth.xhtml">the Earth with semi-live cloud maps superimposed</a> on top of that.  I’ve not managed to get it to work on any of my machines, though :-(</li>
<li>Processing.js, the port of the popular Processing 3D language to WebGL and JavaScript, has <a href="http://vocamus.net/dave/?p=1025">reached version 0.6</a>!</li>
<li>From Lindsay Kay, <a href="http://lindsaystanleykay.blogspot.com/2010/03/scenejs-boundingbox-nodes.html">an impressive demo of level-of-detail (LOD) calculations</a> in SceneJS 0.7.</li>
<li>Benjamin DeLillo has got <a href="http://www.cs.rit.edu/~bpd9116/WebGLU/examples/picking/picking.html">picking working in his WebGLU framework</a>, albeit only in Chrome for now.  Picking is how you enable the user to select objects in the 3D scene with the mouse.</li>
<li>Another one from Benjamin: <a href="http://www.cs.rit.edu/~bpd9116/WebGLU/examples/boids/boids.html">flocking WebGLU Boids</a> :-)</li>
<li>Some promising-looking <a href="http://www.geeks3d.com/20100228/fog-in-glsl-webgl/">screenshots</a> showing WebGL fragment-shader-generated fog in an experimental partial port of the game Forsaken.</li>
</ul></div>
    </content>
    <updated>2010-03-02T14:36:36Z</updated>
    <category term="Links"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-09T14:00:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1778</id>
    <link href="http://learningwebgl.com/blog/?p=1778" rel="alternate" type="text/html"/>
    <title>WebGL Lesson 15 – specular maps</title>
    <summary>&lt;&lt; Lesson 14
Welcome to my number fifteen in my series of WebGL tutorials!  In it, we’ll take a look specular maps, which give your scenes greater realism by making it easy to specify how reflective an object is at every point on its surface, just as normal textures allow you to specify its detailed [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p><span style="float: left; padding: 0px 20px 0px 0px;"><a href="http://learningwebgl.com/blog/?p=1658">&lt;&lt; Lesson 14</a></span><br/><br/>
Welcome to my number fifteen in my series of WebGL tutorials!  In it, we’ll take a look specular maps, which give your scenes greater realism by making it easy to specify how reflective an object is at every point on its surface, just as normal textures allow you to specify its detailed colour.  In terms of new code, this is actually a pretty simple extension on top of what we’ve already covered, but conceptually it’s a bit of a jump.</p>
<p>Here’s what the lesson looks like when run on a browser that supports WebGL:</p>
<p>&lt;object height="385" width="480"&gt;&lt;param name="movie" value="http://www.youtube.com/v/t5ccMHCauuE&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed allowfullscreen="true" allowscriptaccess="always" height="385" src="http://www.youtube.com/v/t5ccMHCauuE&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" width="480"&gt;&lt;/embed&gt;&lt;/object&gt;</p>
<p><a href="http://learningwebgl.com/lessons/lesson15/index.html">Click here and you’ll see the live WebGL version</a>, if you’ve got a browser that supports it; <a href="http://learningwebgl.com/blog/?p=11">here’s how to get one</a> if you don’t.  You’ll see a spinning model of the Earth, with a very bright specular glint — the reflection of the Sun from its surface.  More importantly, if you look closely, you’ll see that the specular glint only appears on the oceans; the land, as you’d expect, doesn’t reflect the light in a specular fashion.  </p>
<p>Try switching off the “Use specular map” toggle underneath the canvas.  You’ll see that now the specular highlight appears on the land too; you might also feel (as I did) that this rather ruins the illusion, and makes the specular glint look more like a very bright spotlight being shone at the Earth.  Specular maps can really improve realism by giving you fine-grained control over the way objects in your model interact with the lighting.</p>
<p>Next, switch the “Use specular map” back on, reduce the diffuse light’s intensity to, say, (0.5, 0.5, 0.5), and then switch off the “Use color map” toggle. You’ll see that the colour texture of the earth is lost, but the specular highlight is still affected by whether or not it would be over land or sea.</p>
<p>So, how does it work?  Read on to find out.</p>
<p><span id="more-1778"/></p>
<p>Before we wade into the code, the usual <a href="http://learningwebgl.com/blog/?page_id=29">warning</a>: these lessons are targeted at people with a reasonable amount of programming knowledge, but no real experience in 3D graphics; the aim is to get you up and running, with a good understanding of what’s going on, so that you can start producing your own 3D Web pages as quickly as possible.  If you haven’t read the previous tutorials already, you should probably do so before reading this one — here I will only explain the new stuff.  The lesson is based on <a href="http://learningwebgl.com/blog/?p=1658">lesson 14</a>, so you should make sure that you understand that one.</p>
<p>There may be bugs and misconceptions in this tutorial.  If you spot anything wrong, let me know in the comments and I’ll correct it ASAP.</p>
<p>There are two ways you can get the code for this example; just “View Source” while you’re looking at the live version, or if you use GitHub, you can clone it (and the other lessons) from <a href="http://github.com/gpjt/webgl-lessons">the repository there</a>.  </p>
<p>Before we take a look at the code, it’s probably worth explaining the background.  So far, we’ve been treating textures as a nice easy way of “skinning” our 3D objects with images.  We specify an image, and our object has per-vertex coordinates to say which part of the image should go where, so when we draw each pixel in the object in our fragment shader, we can work out the portion of the image that corresponds to that part of the object, take its colour from the sampler object that represents the texture in the shader, and use that as the colour of the object at that point.</p>
<p>Specular maps take this logic one step further.  The colour of a point in the texture is, of course, specified by red, green, blue, and alpha components.  In the shader, each of these is a floating point number.  But there’s no particular reason why we <i>have</i> to use them as colour values.  You will remember from the last lesson that the shininess of a material is determined by a single floating point number.  There’s no reason why we shouldn’t use textures as a way of passing a “shininess map” up to the fragment shader, just as we normally use it to pass a colour map.</p>
<p>So that’s the trick we use in this example.  Two separate textures are passed up to the fragment shader to use on the Earth; a colour map that looks like this:</p>
<p><img alt="Colour map of the Earth" height="286" src="http://learningwebgl.com/lessons/lesson15/earth.jpg" width="600"/></p>
<p>…and a lower-resolution specular map, which looks like this:</p>
<p><img alt="Specular map of the Earth" height="286" src="http://learningwebgl.com/lessons/lesson15/earth-specular.gif" width="600"/></p>
<p>This is just a regular GIF file, which I created in <a href="http://www.paint.net/">Paint.NET</a> using the colour map as a starting point.  I decided to set the red, green and blue components of the colour at each point to the same value: the shininess of the point.  I also needed to choose a value that would mean “this bit of the Earth is not shiny”; because most of the image was pretty dark (a shininess of 32 leads to the RGB colour of 32, 32, 32, which is a very dark grey) I decide to use pure white for that.</p>
<p>So, with all that explained, let’s go to the code.  The differences between the code for this lesson and lesson 14’s are actually quite minimal, and pretty clear.  As you might expect, the really important stuff is in the fragment shader, so let’s take a look at that (with changed stuff highlighted in red, as usual).</p>
<p>Firstly, we have a couple of new uniforms specifying whether or not we want to use the colour and specular maps:</p>
<pre>  varying vec2 vTextureCoord;
  varying vec4 vTransformedNormal;
  varying vec4 vPosition;

  <span style="color: red;">uniform bool uUseColorMap;
  uniform bool uUseSpecularMap;</span>
  uniform bool uUseLighting;
</pre>
<p>Next, we have uniform samplers for the two textures.  We’ve renamed the old <code>uSampler</code>, which was used for the colour texture, to <code>uColorMapSampler</code>, and added a new one for the sampler that represents the specular map.</p>
<pre>  uniform vec3 uAmbientColor;

  uniform vec3 uPointLightingLocation;
  uniform vec3 uPointLightingSpecularColor;
  uniform vec3 uPointLightingDiffuseColor;

  <span style="color: red;">uniform sampler2D uColorMapSampler;
  uniform sampler2D uSpecularMapSampler;</span>
</pre>
<p>Next comes our normal boilerplate code to handle the case where the user wants to switch off lighting effects, and to calculate the normal and the light direction if they don’t:</p>
<pre>  void main(void) {
    vec3 lightWeighting;
    if (!uUseLighting) {
      lightWeighting = vec3(1.0, 1.0, 1.0);
    } else {
      vec3 lightDirection = normalize(uPointLightingLocation - vPosition.xyz);
      vec3 normal = normalize(vTransformedNormal.xyz);
</pre>
<p>And finally we get the code that actually handles the specular map.  Firstly, we define a variable that will hold the amount of specular lighting we’re going to apply; this will, of course, be zero if the fragment we’re considering turns out to have no specular lighting after we’ve done all the calculations.</p>
<pre>      float specularLightWeighting = 0.0;
</pre>
<p>Next, we want to work out the shininess for this bit of the material.  If the user has specified that we shouldn’t use the specular map, this code makes the (essentially arbitrary) choice of using 32.0.  Otherwise, we get the value from the specular map’s value for the fragment’s texture coordinates, just as we would previously have found the colour maps’ value.  Now, our specular map actually has the shininess value stored in all three components of the colour at each image — red, green and blue are all the same, which is why it appears as greyscale when viewed as an image.  We use the red one in this code, though we could have used either of the others if we’d wanted to:</p>
<pre>      <span style="color: red;">float shininess = 32.0;
      if (uUseSpecularMap) {
        shininess = texture2D(uSpecularMapSampler, vec2(vTextureCoord.s, 1.0 - vTextureCoord.t)).r * 255.0;
      }</span>
</pre>
<p>Now, you’ll remember that we needed some way of saying “this bit of the material is not shiny” in the specular map, and that I chose to use white, as that had good contrast against the dark-grey areas for the shinier parts of the Earth.  So we don’t do any calculations for specular lighting if the value for the shininess as extracted from the map is greater than or equal to 255.</p>
<pre>      <span style="color: red;">if (shininess &lt; 255.0) {</span>
</pre>
<p>The next bit of code is just the same specular highlight calculation we had in the last lesson, except that we use the shininess constant that we extracted from the map:</p>
<pre>        vec3 eyeDirection = normalize(-vPosition.xyz);
        vec3 reflectionDirection = reflect(-lightDirection, normal);

        specularLightWeighting = pow(max(dot(reflectionDirection, eyeDirection), 0.0), <span style="color: red;">shininess</span>);
      <span style="color: red;">}</span>
</pre>
<p>And finally, we add all of the different forms of lighting’s contributions together, and use that to weight the colour of the fragment, whether it’s from the colour map or, if <code>uUseColorMap</code> is false, just a constant white.</p>
<pre>      float diffuseLightWeighting = max(dot(normal, lightDirection), 0.0);
      lightWeighting = uAmbientColor
        + uPointLightingSpecularColor * specularLightWeighting
        + uPointLightingDiffuseColor * diffuseLightWeighting;
    }

    vec4 fragmentColor;
    if (<span style="color: red;">uUseColorMap</span>) {
      fragmentColor = texture2D(uColorMapSampler, vec2(vTextureCoord.s, 1.0 - vTextureCoord.t));
    } else {
      fragmentColor = vec4(1.0, 1.0, 1.0, 1.0);
    }
    gl_FragColor = vec4(fragmentColor.rgb * lightWeighting, fragmentColor.a);
  }
</pre>
<p>If you’ve got this far, you actually understand everything there is to know about the code for this lesson.  There are other changes, but none are worth a detailed code walkthrough.  <code>initShaders</code> has new code to deal with the new uniforms, <code>initTextures</code> needs to load the two new textures, the code that loaded up the teapot is replaced by an <code>initBuffers</code> function just like the one from <a href="http://learningwebgl.com/blog/?p=1253">lesson 11</a>, <code>drawScene</code> has code to draw a sphere rather than a teapot, and to take the values in the user-input fields below the canvas and put them into the appropriate uniforms, and <code>animate</code> has been updated to make the earth spin.</p>
<p>And after that, that’s it! You now know how to use a texture to provide information about an object’s specular shininess.  As you’ve no doubt worked out by this point, there’s nothing to stop you from using textures to pass up other fine-grained information to your shaders — people often use similar techniques to this for giving detailed maps of the variations in the surface normals, which allows you to have subtly bumpy surfaces without having to create lots of vertices.  We’ll take a closer look at that in a future lesson.</p>
<p><span style="float: left; padding: 0px 20px 0px 0px;"><a href="http://learningwebgl.com/blog/?p=1658">&lt;&lt; Lesson 14</a></span><br/> </p>
<p><em>Acknowledgments: the Earth texture is courtesy of <a href="http://www.esa.int/esaEO/SEMGSY2IU7E_index_0.html">the European Space Agency/Envisat</a>.  Thanks also to <a href="http://www.paulbrunt.co.uk/">Paul Brunt</a> for his <a href="http://learningwebgl.com/blog/?p=1805&amp;cpage=1#comment-1426">suggestion</a> to increase the specular lighting levels to make the demo page for this lesson clearer.</em></p></div>
    </content>
    <updated>2010-02-26T20:44:45Z</updated>
    <category term="Lessons"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-09T14:00:02Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://www.sirikata.com/blog/?p=154</id>
    <link href="http://www.sirikata.com/blog/?p=154" rel="alternate" type="text/html"/>
    <title>Invitation: WebGL social mixer around GDC</title>
    <summary>The WebGL community is growing fast and here is a chance to meet informally in San Francisco. Logistics are:
Friday March 12th from 6-8 at The Vin Club (google maps). (Please note that this has been changed from the original Thirsty Bear location.)
Open to anyone interested so feel free to plug this.
Voluntary RSVP is possible on the Facebook event page</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><div>
<p><a href="http://www.sirikata.com/blog/wp-content/uploads/2010/02/WebGL_logo.png"><img alt="" class="alignright" height="75" src="http://www.sirikata.com/blog/wp-content/uploads/2010/02/WebGL_logo.png" title="WebGL_logo" width="163"/></a>The <a href="http://www.khronos.org/webgl/">WebGL</a> community is growing fast and here is a chance to meet informally in San Francisco. Logistics are:</p>
<p>Friday March 12th from 6-8 at <a href="http://www.thevinclub.com/">The Vin Club</a> (<a href="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=515+Broadway,+sf&amp;sll=37.739553,-122.41418&amp;sspn=0.009519,0.01929&amp;ie=UTF8&amp;hq=&amp;hnear=515+Broadway,+San+Francisco,+California+94133&amp;z=16">google maps</a>). (Please note that this has been changed from the original Thirsty Bear location.)</p>
<p>Open to anyone interested so feel free to plug this.</p>
<p>Voluntary RSVP is possible on the <a href="http://www.facebook.com/event.php?eid=327381779085">Facebook event page</a></p>
</div></div>
    </content>
    <updated>2010-02-26T17:42:17Z</updated>
    <category term="Uncategorized"/>
    <category term="event"/>
    <category term="WebGL"/>
    <author>
      <name>Henrik Bennetsen</name>
    </author>
    <source>
      <id>http://www.sirikata.com/blog</id>
      <link href="http://www.sirikata.com/blog/?feed=rss2&amp;tag=webgl" rel="self" type="application/atom+xml"/>
      <link href="http://www.sirikata.com/blog" rel="alternate" type="text/html"/>
      <subtitle>a BSD licensed open source platform for games and virtual worlds</subtitle>
      <title>Sirikata » WebGL</title>
      <updated>2010-03-04T07:40:04Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1832</id>
    <link href="http://learningwebgl.com/blog/?p=1832" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 25 Feb 2010</title>
    <summary>Just two new links today:

If you found the post about WebGL GPU accelerated matrix operations interesting, you should read this: Mozilla Labs: Elevating JavaScript Performance Through GPU Power. (via)
At rozengain.com, Dennis Ippel has written a step-by-step first tutorial for WebGL, with no dependencies on external libraries.</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>Just two new links today:</p>
<ul>
<li>If you found the post about <a href="http://learningwebgl.com/blog/?p=1828">WebGL GPU accelerated matrix operations</a> interesting, you should read this: <a href="http://mozillalabs.com/jetpack/2010/01/25/elevating-javascript-performance-through-gpu-power/">Mozilla Labs: Elevating JavaScript Performance Through GPU Power</a>. (<a href="http://www.zhaiduo.com/2010/02/ready_for_webgl/">via</a>)</li>
<li>At rozengain.com, Dennis Ippel has written <a href="http://www.rozengain.com/blog/2010/02/22/beginning-webgl-step-by-step-tutorial/">a step-by-step first tutorial for WebGL</a>, with no dependencies on external libraries.</li>
</ul></div>
    </content>
    <updated>2010-02-25T19:03:22Z</updated>
    <category term="Links"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-09T14:00:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1828</id>
    <link href="http://learningwebgl.com/blog/?p=1828" rel="alternate" type="text/html"/>
    <title>WebGL GPU accelerated matrix operations</title>
    <summary>A number of people have been talking about the possibilities for a “WebCL” — that is, an extension like WebGL that would allow general-purpose graphics-card-based computing from JavaScript, like OpenCL and its Nvidia-only predecessor CUDA allow from native client-based applications.  Doing this would remove many of the bottlenecks people worry about when thinking of [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>A number of people have been talking about the possibilities for a “WebCL” — that is, an extension like WebGL that would allow general-purpose graphics-card-based computing from JavaScript, like OpenCL and its Nvidia-only predecessor CUDA allow from native client-based applications.  Doing this would remove many of the bottlenecks people worry about when thinking of porting high-end 3D games to WebGL — imagine if all of your physics simulations could be offloaded to the graphics card.</p>
<p>Aaron Babcock, whose fallingsand WebGL demo I <a href="http://learningwebgl.com/blog/?p=1471">linked</a> to last month, has gone ahead and implemented the first steps towards this, using shaders and render-to-texture to persuade the GPU to multiply two 1024×1024 matrices.  This is really impressive; here’s his own description (with a few edits; errors are doubtless mine):</p>
<blockquote><p>
Technologies like CUDA and OpenCL have had good success accelerating matrix operations. Wouldn’t it be cool if the same accelerations could be accessible from JavaScript?</p>
<p>As a proof of concept I took the <a href="http://sylvester.jcoglan.com/">Sylvester</a> matrix library and modified the multiply function to execute on the GPU. Matrix values are packed into textures, a glsl program computes the multiply to a framebuffer, and <code>readPixels</code> is used to retrieve the result. In my benchmarks stock Sylvester takes about 35 seconds to compute a multiply of two 1024×1024 matrices, the GPU-enabled version can do the same in about 5 seconds. Perhaps one day complex GPU-accelerated, distributed computing projects like seti@home could use only a simple webpage as a client.</p>
<p>I think it is a pretty cool proof of concept but it would be very interesting to get a discussion going from more experienced OpenGL developers. Here are some problems I see:</p>
<ul>
<li>Only works on Webkit, locks up Firefox, Chromium produces incorrect results.  [UPDATE it works for matrices smaller than 500x500 on Minefield now.]</li>
<li>Packing and Unpacking matrix values to textures (only handles integers now, could it be more efficient?)</li>
<li>Alpha channel in textures cannot be used to store matrix data, leaving only 3 bytes per pixel.  [UPDATE: Aaron writes "I found that If I changed the alpha value, it affected all pixel values that resulted from the <code>readPixel</code> call" — some kind of alpha premultiplication going on, perhaps?]</li>
<li>If you want to use javascript for long running calculations, browsers will prompt the user every few seconds if they want to stop the script.  Any way around this?</li>
</ul>
<p>Here is <a href="http://matrixmultiplygpu.appspot.com/sylvesterTest.html">an example page</a> [don't visit it in Minefield], and here is <a href="http://github.com/bunions1/matrixMultiplyGpu">a github link for the source</a>.</p>
<p>Right now the demo is Webkit only, although the concept should be possible on any webgl implementation. I’d be very interested to know what you and other WebGL developers think.
</p></blockquote>
<p>Let me second that — it would be great to hear what people think about this.</p></div>
    </content>
    <updated>2010-02-22T19:27:02Z</updated>
    <category term="Questions"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-09T14:00:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1826</id>
    <link href="http://learningwebgl.com/blog/?p=1826" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 22 Feb 2010</title>
    <summary>Three new links today:

The C3DL team have finished porting their library to WebGL, and it’s now been released as version 2.0.  Some excellent demos; I’m particularly fond of the motion-capture one.
For Russian speakers, here’s a WebGL tutorial that builds on the lessons here.  Looks good!
From the Easy WebGL blog, a new JavaScript matrix [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>Three new links today:</p>
<ul>
<li>The C3DL team have finished porting their library to WebGL, and it’s now been <a href="http://www.c3dl.org/index.php/c3dl-news/c3dl-2-0-webgl-and-beyond/">released as version 2.0</a>.  Some excellent demos; I’m particularly fond of <a href="http://www.c3dl.org/index.php/webgl-demos/mocap_spheres/">the motion-capture one</a>.</li>
<li>For Russian speakers, here’s <a href="http://steps3d.narod.ru/tutorials/webgl-tutorial.html">a WebGL tutorial that builds on the lessons here</a>.  Looks good!</li>
<li>From <a href="http://ewgl.wordpress.com/2010/02/19/matrices/">the Easy WebGL blog</a>, <a href="http://code.google.com/p/ewgl-matrices/">a new JavaScript matrix library</a> to compete with <a href="http://sylvester.jcoglan.com/">Sylvester</a> and Vladimir Vukićević’s streamlined <a href="http://webgl-mjs.googlecode.com/">MJS</a>.  Performance looks roughly in between the two, but in certain tests is better either of the others.  Competition is good — and I’ll be posting something more on accelerated matrix calculations later on today.</li>
</ul></div>
    </content>
    <updated>2010-02-22T14:46:51Z</updated>
    <category term="Uncategorized"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-09T14:00:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://www.c3dl.org/?p=2480</id>
    <link href="http://www.c3dl.org/index.php/c3dl-news/c3dl-2-0-webgl-and-beyond/" rel="alternate" type="text/html"/>
    <title>C3DL 2.0-WebGL and beyond</title>
    <summary>It has been a long time coming but we have now updated all the core features of C3DL to use WebGL.  You can dowload our 2.0 release here.  We have also updated all our demos to use WebGL.  Our tutorials have all been updated (tutorial 5 and 6 needs a better example [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">It has been a long time coming but we have now updated all the core features of C3DL to use<a href="http://en.wikipedia.org/wiki/WebGL"> WebGL.</a>  You can dowload our 2.0 release <a href="http://www.c3dl.org/index.php/download/">here.</a>  We have also updated all our <a href="http://www.c3dl.org/index.php/webgl-demos/">demos</a> to use WebGL.  Our <a href="http://www.c3dl.org/index.php/tutorials/">tutorials</a> have all been updated (tutorial 5 and 6 needs a better example but we’re getting to it).  Our <a href="http://www.c3dl.org/index.php/documentation/">documentation</a> has also been updated for release 2.0
<br/><br/>

C3DL 2.0 includes the following features:
 
<ul>
	<li>uses WebGL (as opposed to Canvas 3D) – you will need a WebGL enabled browser to see demos (see <a href="http://www.c3dl.org/index.php/tutorials/tutorial-1-browsers/">tutorial #1</a> on how to do this)</li>

	<li>ports all c3dl features including:</li>

 <ul>
	<li> Collada model loading</li>
<li>Picking</li>
<li>Lighting System</li>
<li>camera system</li>
<li>Particle system</li>
<li>Effects system that allows a swappable shader to be applied to alter its look.  Currently we have the following effects implements:
<ul>
<li>cartoon (with or without outlines)</li>
<li>greyscale</li>
<li>solid colour</li>
<li>sepia</li>
<li>gooch</li>
</ul>
</li></ul>
<li>lines and dots</li>
</ul>

Many of these features can be observed in our <a href="http://www.c3dl.org/index.php/webgl-demos/asteroids-3d/">Asteroids-3D</a> demo.  (click on rocks to fire at them).

We have also moved our <a href="http://github.com/cathyatseneca/c3dl">repository onto github</a> and a <a href="http://c3dl.lighthouseapp.com/projects/42081-c3dl/overview">bug tracker at lighthouse</a>.

Try it out and give us some feedback! <img alt=":D" class="wp-smiley" src="http://www.c3dl.org/wp-includes/images/smilies/icon_biggrin.gif"/> 

If you are looking for our Canvas 3D related demos please check our Archive link.</div>
    </content>
    <updated>2010-02-22T05:59:12Z</updated>
    <category term="C3DL News"/>
    <category term="c3dl development"/>
    <author>
      <name>Cathy Leung</name>
    </author>
    <source>
      <id>http://www.c3dl.org</id>
      <link href="http://www.c3dl.org/index.php/category/c3dl-dev/feed/" rel="self" type="application/atom+xml"/>
      <link href="http://www.c3dl.org" rel="alternate" type="text/html"/>
      <subtitle>WebGL made easy!</subtitle>
      <title>Canvas 3d JS Library » c3dl development</title>
      <updated>2010-02-22T06:20:05Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1818</id>
    <link href="http://learningwebgl.com/blog/?p=1818" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 18 Feb 2010</title>
    <summary>Some more framework news today, but also something useful for all WebGL developers:

Chromium developer Gregg Tavares has put a really useful-looking debugging wrapper up on the Khronos site, with solid documentation in the Wiki.  The problem it solves is that when a call to a WebGL context triggers an error, the only way you [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>Some more framework news today, but also something useful for all WebGL developers:</p>
<ul>
<li>Chromium developer Gregg Tavares has put a really useful-looking <a href="https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/debug/webgl-debug.js">debugging wrapper</a> up on the Khronos site, with <a href="http://www.khronos.org/webgl/wiki/Debugging">solid documentation</a> in the Wiki.  The problem it solves is that when a call to a WebGL context triggers an error, the only way you can detect it is to call <code>gl.getError</code> and look at the result.  It would be a pain to check that after every call, so in general you don’t — which means that if a GL call fails, often you won’t see any kind of error message.  The module wraps around the WebGL context, intercepts your calls to it, and does the check for you when they return before control is returned to your code.  In its default configuration, it dumps all errors to your JavaScript console, but you can also add your own error function to throw an exception of some kind.  I’m debating adding this to all of the tutorials here, it sounds really useful; my only concern would be how it would impact performance, but I suspect it’s not enough to be an issue for tutorials and experimental apps.</li>
<li>Marco Di Benedetto’s been adding new demos for his <a href="http://spidergl.org/">SpiderGL</a> framework; particularly fun is the <a href="http://spidergl.org/example.php?id=8">Streaming LoD Terrain</a>, which loads a low-resolution terrain map and then progressively loads more detail as needed (rather like Google Earth), but the <a href="http://spidergl.org/example.php?id=6">shadow mapping example</a> is fun too (particularly if you happen to be planning a WebGL lesson about shadows ;-)   There are also <a href="http://sourceforge.net/projects/spidergl/forums">SpiderGL forums</a> — all quiet now, but I’m sure that will change.</li>
<li>Lindsay Kay’s SceneJS has been progressing by leaps and bounds; since I last gave an update on it back in January, he’s added <a href="http://lindsaystanleykay.blogspot.com/2010/01/scenejs-bounding-volumes.html">bounding nodes</a> (which tell the library about the spacial boundaries of a subtree of the scene graph), <a href="http://lindsaystanleykay.blogspot.com/2010/01/scenejs-parameterised-assets.html">parameterised assets</a> (so that you can import a subtree and modify certain parameters), some pretty heavy-duty memory management stuff (”[m]y mission is to have SceneJS never run out of memory”), <a href="http://lindsaystanleykay.blogspot.com/2010/02/scenejs-logger-nodes.html">customisable logging</a>, and <a href="http://lindsaystanleykay.blogspot.com/2010/02/scenejs-error-management-and-logging.html">better error handling</a>.  All of this should be in version 0.7.0, and he’s also hoping to add frustum culling (avoiding asking WebGL to draw things that aren’t on the screen), keyboard and mouse handling, and picking.  If all that gets in there, it should be a fantastic release!</li>
</ul></div>
    </content>
    <updated>2010-02-18T19:27:41Z</updated>
    <category term="Links"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-09T14:00:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1809</id>
    <link href="http://learningwebgl.com/blog/?p=1809" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 17 Feb 2010</title>
    <summary>Quite a lot of new stuff over the last few days!

An excellent demo of GLGE, from Philip J. Mercurio: Robert B. Livingston’s 1970’s 3D model of a brain.
On the subject of GLGE, Paul Brunt has now added support for importing COLLADA files.
After a short absence from the world of WebGL, Jacob Seidelin is back with [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>Quite a lot of new stuff over the last few days!</p>
<ul>
<li>An excellent demo of GLGE, from Philip J. Mercurio: <a href="http://thyrd.org/brain/">Robert B. Livingston’s 1970’s 3D model of a brain</a>.</li>
<li>On the subject of GLGE, Paul Brunt has now added <a href="http://www.glge.org/collada-now-supported/">support for importing COLLADA files</a>.</li>
<li>After a short absence from the world of WebGL, Jacob Seidelin is back with <a href="http://blog.nihilogic.dk/2010/02/webgl-cheat-sheet-update.html">an update to his extremely useful WebGL Cheat Sheet</a>.</li>
<li><a href="http://code.google.com/p/gwtgl/">GwtGL</a>, which provides support for WebGL in Google Web Toolkit, has now reached its first official release.  They’ve done a great job packaging it all so that you can get started quickly, with a solid set of <a href="http://code.google.com/p/gwtgl/wiki/Documentation?tm=6">documentation</a> and <a href="http://gwtgl-examples.appspot.com/">demos</a>.
</li><li><a href="http://www.3d-test.com/interviews/webgl_copperlicht_1.htm">An interesting interview with Nikolaus Gebhardt</a>, creator of <a href="http://www.ambiera.com/copperlicht/index.html">Copperlicht</a>.</li>
<li>From Andor Salga of the C3DL team, <a href="http://www.c3dl.org/index.php/c3dl-dev/preliminary-webgl-rts-game/">the beginnings of a simple RTS game</a>.</li>
</ul></div>
    </content>
    <updated>2010-02-17T13:38:34Z</updated>
    <category term="Links"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-09T14:00:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://www.c3dl.org/?p=2329</id>
    <link href="http://www.c3dl.org/index.php/c3dl-dev/preliminary-webgl-rts-game/" rel="alternate" type="text/html"/>
    <title>Preliminary WebGL RTS Game</title>
    <summary>Cathy asked me to make a cool demo using our library. After thinking about, I started getting many ideas, but creating a preliminary real-time strategy game made the most sense. It not only demonstrates a lot of C3DL features such as model loading, transformations, lighting, shaders, picking, cameras, textures, etc, but since animation is kept [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><a href="http://cleung.wordpress.com/">Cathy</a> asked me to make a <a href="http://www.c3dl.org/wp-content/blog_demos/rts/rts/">cool demo</a> using our library. After thinking about, I started getting many ideas, but creating a preliminary real-time strategy game made the most sense. It not only demonstrates a lot of C3DL features such as model loading, transformations, lighting, shaders, picking, cameras, textures, etc, but since animation is kept to a minimum, the frame rate on slower machines shouldn’t be a big deal.<br/>
<br/>
You’ll need a <a href="http://www.khronos.org/webgl/">WebGL</a>-compatible browser to run it. You can either download <a href="http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/">Minefield</a>, <a href="http://nightly.webkit.org/">WebKit</a> or <a href="http://build.chromium.org/buildbot/snapshots/">Chromium</a>. Please let us know if it fails to load. Keep in mind I hacked this thing together in a day so the code isn’t pretty, but <a href="http://www.c3dl.org/wp-content/blog_demos/rts/rts/">here it is anyway</a>!

<a href="http://www.c3dl.org/wp-content/blog_demos/rts/rts/"><img alt="" class="alignnone size-full wp-image-1182" height="410" src="http://asalga.files.wordpress.com/2010/02/snapshot-2010-02-15-15-15-391.jpg" title="Snapshot 2010-02-15 15-15-39" width="460"/></a></div>
    </content>
    <updated>2010-02-15T22:08:08Z</updated>
    <category term="c3dl development"/>
    <author>
      <name>Andor Salga</name>
    </author>
    <source>
      <id>http://www.c3dl.org</id>
      <link href="http://www.c3dl.org/index.php/category/c3dl-dev/feed/" rel="self" type="application/atom+xml"/>
      <link href="http://www.c3dl.org" rel="alternate" type="text/html"/>
      <subtitle>WebGL made easy!</subtitle>
      <title>Canvas 3d JS Library » c3dl development</title>
      <updated>2010-02-22T06:20:05Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1805</id>
    <link href="http://learningwebgl.com/blog/?p=1805" rel="alternate" type="text/html"/>
    <title>A bundle of retrospective changes</title>
    <summary>I’ve got quite a large list of things I wanted to fix in the lessons, but I’ve just made it three items shorter…

murphy pointed out that modern browsers have built-in JSON libraries, so lesson 14 doesn’t need to import one.  So that’s gone.
The code that loaded textures was pretty ugly, creating separate globals for [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>I’ve got quite a large list of things I wanted to fix in the lessons, but I’ve just made it three items shorter…</p>
<ol>
<li><a href="http://murfy.de/">murphy</a> <a href="http://learningwebgl.com/blog/?p=1658&amp;cpage=1#comment-1284">pointed out</a> that modern browsers have built-in JSON libraries, so lesson 14 doesn’t need to import one.  So that’s gone.</li>
<li>The code that loaded textures was pretty ugly, creating separate globals for the image and the texture itself.  I felt that the image should be a field of the texture object — so now it is, in all lessons back to #5.</li>
<li>Finally, doug <a href="http://learningwebgl.com/blog/?p=1008&amp;cpage=1#comment-489">pointed out</a> that my JavaScript objects in lesson 9 all had separate copies of their methods — that is, for each object, there was a completely different copy of the function stored in memory.  The correct thing to do is to use a prototype, so now I do.  Hopefully <a href="http://learningwebgl.com/blog/?p=1008#object-mode-start">my explanation of JavaScript’s object model</a> is finally correct…</li>
</ol>
<p>One more thing: <a href="http://learningwebgl.com/lessons/lesson15/">the demo for lesson 15</a> is now live — take a look and tell me what you think!</p></div>
    </content>
    <updated>2010-02-12T20:59:49Z</updated>
    <category term="Retrospective changes"/>
    <category term="Upcoming lessons"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-09T14:00:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1789</id>
    <link href="http://learningwebgl.com/blog/?p=1789" rel="alternate" type="text/html"/>
    <title>Retrospective changes: viewports</title>
    <summary>The WebGL spec recently changed to require that you call the gl.viewport before rendering to your canvas; it was previously done for you automatically, but the people working on the spec realised that this could cause problems in certain specific circumstances.  The function tells WebGL which part of the rendered image should be shown [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>The WebGL spec recently changed to <a href="https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/doc/spec/WebGL-spec.html#2.3">require that you call the <code>gl.viewport</code></a> before rendering to your canvas; it was previously done for you automatically, but the people working on the spec realised that this could cause problems in certain specific circumstances.  The function tells WebGL which part of the rendered image should be shown on the canvas, and as most of the time this will be “all of it”, the code to use will usually be:</p>
<pre>      gl.viewport(0, 0, canvas.width, canvas.height);
</pre>
<p>Now, if you don’t do this call before you start rendering, the results are undefined, and Kevin Theisen (creator of the excellent <a href="http://web.chemdoodle.com/overview3D.php">Chemdoodle</a>) just let me know that last night’s WebKit builds — Safari and Chromium both — now require it.  So I’ve retrospectively changed all of the lessons and updated <a href="http://learningwebgl.com/cookbook/index.php/How_to_initialise_WebGL">the Cookbook</a>.  If you’re building WebGL pages, you’ll need to do the same thing.</p>
<p>(Also: if you’re supporting resizable canvases, you’ll need to add code to re-set the viewport whenever the canvas size changes, not just when you initialise it.)</p></div>
    </content>
    <updated>2010-02-12T00:25:09Z</updated>
    <category term="API changes"/>
    <category term="Retrospective changes"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-04T00:00:04Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1780</id>
    <link href="http://learningwebgl.com/blog/?p=1780" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 11 Feb 2010</title>
    <summary>Two links for today:

Pl4n3 has made a very cool animated character, with the complete animation living in just one HTML page — only textures are loaded from external files.  Very impressive!
The X3DOM guys have put together a very nice animated globe (drag to orbit it) which displays live satellite imagery showing the current cloud [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>Two links for today:</p>
<ul>
<li>Pl4n3 has made <a href="http://pl4n3.blogspot.com/2010/02/webgl-skeletal-animation-demo.html">a very cool animated character</a>, with the complete animation living in just one HTML page — only textures are loaded from external files.  Very impressive!</li>
<li>The X3DOM guys have put together <a href="http://www.x3dom.org/?p=458">a very nice animated globe</a> (drag to orbit it) which displays live satellite imagery showing the current cloud cover.  It also uses a skybox to show a constant background, which is something I’m intending to introduce in the next lesson but one.</li>
</ul></div>
    </content>
    <updated>2010-02-11T18:00:11Z</updated>
    <category term="Links"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-03T21:20:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://hacks.mozilla.org/?p=3956</id>
    <link href="http://hacks.mozilla.org/2010/02/mozilla-developer-preview-gecko-1-9-3a1-available-for-download/" rel="alternate" type="text/html"/>
    <title>Mozilla developer preview (Gecko 1.9.3a1) available for download</title>
    <summary>Editor’s note: Today, Mozilla released a preview of the Gecko 1.9.3 platform for developers and testers. Check out the Mozilla Developer News announcement reposted below.
A Mozilla Developer Preview of improvements in the Gecko layout engine is now available for download. This is a pre-release version of the Gecko 1.9.3 platform, which forms the core of [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p><em>Editor’s note: Today, Mozilla released a preview of the Gecko 1.9.3 platform for developers and testers. Check out the <a href="http://bit.ly/bayY7k">Mozilla Developer News</a> announcement reposted below.</em></p>
<p>A Mozilla Developer Preview of improvements in the Gecko layout engine is now available for download. This is a pre-release version of the Gecko 1.9.3 platform, which forms the core of rich Internet applications such as Firefox. <strong>Please note that this release is intended for developers and testers only.</strong> As always, we appreciate any <a href="http://hendrix.mozilla.org/">feedback</a> you may have and encourage users to help us by <a href="http://developer.mozilla.org/en/docs/Bug_writing_guidelines">filing bugs</a>.</p>
<p>This developer preview introduces several new features, including:</p>
<ul>
<li>Support for <a href="http://www.w3.org/TR/css3-transitions/">CSS Transitions</a>. This support is not quite complete: support for animation of transforms and gradients has not yet been implemented.</li>
<li>Support for SMIL Animation in SVG. Support for animating some SVG attributes is still under development and the <code>animateMotion</code> element isn’t supported yet.</li>
<li>Support for <a href="https://developer.mozilla.org/en/WebGL">WebGL</a>, which is disabled by default but can be enabled by changing a preference. See <a href="http://hacks.mozilla.org/2009/09/webgl-for-firefox/">this blog post</a> and <a href="http://hacks.mozilla.org/2009/12/webgl-draft-released-today/">this blog post</a> for more details.</li>
<li>Support for the <code>getClientRects</code> and <code>getBoundingClientRect</code> methods on <code>Range</code> objects.  See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=396392">bug 396392</a> for details.</li>
<li>Support for the <code>setCapture</code> and <code>releaseCapture</code> methods on DOM elements. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=503943">bug 503943</a> for details.</li>
<li>Support for the <a href="https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history#Adding_and_modifying_history_entries">HTML5 <code>History.pushState()</code> and <code>History.replaceState()</code> methods and the <code>popstate</code> event</a>. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=500328">bug 500328</a> for details.</li>
<li>Support for the <code>-moz-image-rect()</code> value for <code><a href="https://developer.mozilla.org/en/CSS/background-image">background-image</a></code>. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=113577">bug 113577</a> for more details.</li>
</ul>
<p>and several other significant changes, including:</p>
<ul>
<li>On Mac OS X, we render text using Core Text rather than ATSUI.</li>
<li>We rewrote major parts of the code for handling scrolling. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=526394">bug 526394</a> for details.</li>
<li>We rewrote the way a snapshot of a document is taken in order to print or print preview.  See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=487667">bug 487667</a> for details.</li>
<li>We made significant changes to table border handling. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=452319">bug 452319</a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=43178">bug 43178</a> for details.</li>
<li>We made various architectural changes to improve Web page        performance.</li>
</ul>
<p>More information on these changes is in the <a href="http://www.mozilla.org/projects/firefox/3.7a1/releasenotes/">release notes</a>, as well as the <a href="https://developer.mozilla.org/en/Upcoming_Firefox_features_for_developers">Upcoming Firefox features for developers</a> article on the <a href="https://developer.mozilla.org/">Mozilla Developer Center</a>.</p>
<p>Please use the following links when downloading this Mozilla Developer Preview:</p>
<ul>
<li><a href="http://download.mozilla.org/?product=devpreview-1.9.3a1&amp;os=win&amp;lang=en-US">Installer for Windows</a></li>
<li><a href="http://download.mozilla.org/?product=devpreview-1.9.3a1&amp;os=osx&amp;lang=en-US">DMG for Mac OS X (10.5 or better required)</a></li>
<li><a href="http://download.mozilla.org/?product=devpreview-1.9.3a1&amp;os=linux&amp;lang=en-US">Archive for Linux</a></li>
</ul></div>
    </content>
    <updated>2010-02-10T22:01:32Z</updated>
    <category term="CSS"/>
    <category term="Firefox"/>
    <category term="HTML5"/>
    <category term="Performance"/>
    <category term="SVG"/>
    <category term="WebGL"/>
    <author>
      <name>Alix Franquet</name>
    </author>
    <source>
      <id>http://hacks.mozilla.org</id>
      <link href="http://hacks.mozilla.org/category/webgl/feed/" rel="self" type="application/atom+xml"/>
      <link href="http://hacks.mozilla.org" rel="alternate" type="text/html"/>
      <subtitle>hacks.mozilla.org</subtitle>
      <title>Mozilla Hacks - the Web developer blog » WebGL</title>
      <updated>2010-03-10T17:00:10Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1658</id>
    <link href="http://learningwebgl.com/blog/?p=1658" rel="alternate" type="text/html"/>
    <title>WebGL Lesson 14 – specular highlights and loading a JSON model</title>
    <summary>&lt;&lt; Lesson 13Lesson 15 &gt;&gt;
Welcome to my number fourteen in my series of WebGL tutorials!  In it, we’ll introduce the last bit of the Phong reflection model that we introduced in lesson 7: specular highlights; the “glints” on a shiny surface, which make a scene look that little bit more realistic.
Here’s what the lesson [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p><span style="float: left; padding: 0px 20px 0px 0px;"><a href="http://learningwebgl.com/blog/?p=1523">&lt;&lt; Lesson 13</a></span><span style="float: right; padding: 0px 20px 0px 0px;"><a href="http://learningwebgl.com/blog/?p=1778">Lesson 15 &gt;&gt;</a></span><br/><br/>
Welcome to my number fourteen in my series of WebGL tutorials!  In it, we’ll introduce the last bit of the <a href="http://en.wikipedia.org/wiki/Phong_shading">Phong reflection model</a> that we introduced in <a href="http://learningwebgl.com/blog/?p=684">lesson 7</a>: specular highlights; the “glints” on a shiny surface, which make a scene look that little bit more realistic.</p>
<p>Here’s what the lesson looks like when run on a browser that supports WebGL:</p>
<p>&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/OSjVRA2BQJU&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;embed allowfullscreen="true" allowscriptaccess="always" height="344" src="http://www.youtube.com/v/OSjVRA2BQJU&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;" type="application/x-shockwave-flash" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;</p>
<p><a href="http://learningwebgl.com/lessons/lesson14/index.html">Click here and you’ll see the live WebGL version</a>, if you’ve got a browser that supports it; <a href="http://learningwebgl.com/blog/?p=11">here’s how to get one</a> if you don’t.  You’ll see a spinning <a href="http://en.wikipedia.org/wiki/Utah_teapot">teapot</a>, and as it spins you’ll see a constant glint to the mid-left and on the handle of the lid.  There will also be occasional glints from the spout and the handle when they hit just the right angle to catch the light.  You can switch these specular highlights on and off using the checkbox below, and you can also disable lighting completely, and switch between three options for the texture used: none, the “galvanized” texture that is used by default (and which is a Creative Commons-licensed sample from the excellent <a href="http://www.arroway-textures.com/">Arroway Textures</a>), and, just for fun, a texture showing the planet Earth (courtesy of the <a href="http://www.esa.int/esaEO/SEMGSY2IU7E_index_0.html">European Space Agency/Envisat</a>), which looks quite fun on a teapot :-)</p>
<p>You can also control the teapot’s shininess from the text fields below — larger numbers mean a smaller, sharper highlight — and you can adjust the specular reflection’s colour, and, as before, the position and diffuse colour of the point light that’s causing all of these effects.  More about that below.</p>
<p><span id="more-1658"/></p>
<p>Before we wade into the code, the usual <a href="http://learningwebgl.com/blog/?page_id=29">warning</a>: these lessons are targeted at people with a reasonable amount of programming knowledge, but no real experience in 3D graphics; the aim is to get you up and running, with a good understanding of what’s going on, so that you can start producing your own 3D Web pages as quickly as possible.  If you haven’t read the previous tutorials already, you should probably do so before reading this one — here I will only explain the new stuff.  The lesson is based on <a href="http://learningwebgl.com/blog/?p=1523">lesson 13</a>, so you should make sure that you understand that one (and please do post a comment on  that post if anything’s unclear about it!)</p>
<p>There may be bugs and misconceptions in this tutorial.  If you spot anything wrong, let me know in the comments and I’ll correct it ASAP.</p>
<p>There are two ways you can get the code for this example; just “View Source” while you’re looking at the live version, or if you use GitHub, you can clone it (and the other lessons) from <a href="http://github.com/gpjt/webgl-lessons">the repository there</a>.  </p>
<p>Once you have it, open it up in an editor.  We’ll start at the top and work our way down, which has the great advantage that we can see the fragment shader pretty much right away — this is where the most interesting changes are.  Before we encounter that, there’s one minor difference between this code and lesson 13’s: we don’t have the shaders for per-vertex lighting.  Per-vertex lighting doesn’t really handle specular highlights very well (as they get smeared out over an entire face), so we don’t bother with them.  </p>
<p>So, the first shader you’ll see in the file is the fragment shader for per-fragment lighting.   It starts off with the usual declarations of varying and uniform variables, of which a couple (highlighted here in red) are new, and one — the uniform that used to hold the point light’s colour — has been renamed, as the point light now has specular and diffuse components:</p>
<pre>  varying vec2 vTextureCoord;
  varying vec4 vTransformedNormal;
  varying vec4 vPosition;

<span style="color: red;">  uniform float uMaterialShininess;

  uniform bool uShowSpecularHighlights;</span>
  uniform bool uUseLighting;
  uniform bool uUseTextures;

  uniform vec3 uAmbientColor;

  uniform vec3 uPointLightingLocation;
<span style="color: red;">  uniform vec3 uPointLightingSpecularColor;</span>
  uniform vec3 uPointLighting<span style="color: red;">Diffuse</span>Color;

  uniform sampler2D uSampler;
</pre>
<p>These shouldn’t need much explanation; they’re just where the values that you can change from the HTML code are fed into the shader for processing.  Let’s move on to the body of the shader; the first thing is to handle the case where the user has lighting switched off, and this is the same as it was before:</p>
<pre>  void main(void) {
    vec3 lightWeighting;
    if (!uUseLighting) {
      lightWeighting = vec3(1.0, 1.0, 1.0);
    } else {
</pre>
<p>Now we handle the lighting, and of course this is where it gets interesting:</p>
<pre>      vec3 lightDirection = normalize(uPointLightingLocation - vPosition.xyz);
<span style="color: red;">      vec3 normal = normalize(vTransformedNormal.xyz);

      float specularLightWeighting = 0.0;
      if (uShowSpecularHighlights) {</span>
</pre>
<p>So, what’s going on here?  Well, we calculate the direction of the light just as we did for normal per-fragment lighting.  We then normalise the fragment’s normal vector, once again just as before — remember, when the per-vertex normals are linearly interpolated to create per-fragment normals, the results aren’t necessarily of length one, so we normalise to fix this — but this time we’ll be using it a little more so we store it in a local variable.  Next, we define a weighting for the amount of extra brightness that is going to come from the specular highlight; this is of course zero if the specular highlight is switched off, but if it’s not, we need to calculate it.</p>
<p>So, what determines the brightness of a specular highlight?  As you might remember from the explanation of the Phong Reflection Model in lesson 7, <a href="http://learningwebgl.com/blog/?p=684#specular-explanation">specular highlights are created by that portion of the light from a light source that bounces off the surface as if from a mirror</a>:</p>
<blockquote><p>The portion of the light that is reflected this way bounces off the surface at the same angle as it hit it. In this case, the brightness of the light you see reflected from the material depends on whether or not your eyes happen to be in the line along which the light was bounced — that is, it depends not only on the angle at which the light hit the surface but on the angle between your line of sight and the surface. This specular reflection is what causes “glints” or “highlights” on objects, and the amount of specular reflection can obviously vary from material to material; unpolished wood will probably have very little specular reflection, and highly-polished metal will have quite a lot.</p></blockquote>
<p>The specific equation for working out the brightness of a specular reflection is this:</p>
<ul>
<li>(R<sub>m</sub> . V)<sup>α</sup></li>
</ul>
<p>…where R<sub>m</sub> is the (normalised) vector that a perfectly-reflected ray of light from the light source would go when it bounced off the point on the surface that is under consideration, V is the (also normalised) vector pointing in in the direction of the viewer’s eyes, and α is a constant describing the shininess, the higher the shinier.  You may remember that the dot product of two vectors is the cosine of the angle between them; this means that this part of the equation produces a value that is 1 if the light from the light source would be reflected directly at the viewer (that is, R<sub>m</sub> and V are parallel and so the angle between them is zero, and the cosine of zero is one) and then fades off fairly slowly as the light is less directly reflected.  Taking this value to the power of α has the effect of “compressing” it: that is, while the result is still one when the vectors are parallel, it drops off more rapidly to each side.  You can see this in action if you set the shininess constant in <a href="http://learningwebgl.com/lessons/lesson14/index.html">the demo page</a> to something large, like (say) 512.</p>
<p>So, given all this, the first things we need to work out are the direction of the viewer’s eyes, V, and the direction of a perfectly-reflected ray of light, R<sub>m</sub>.  Let’s look at V first, because it’s easy!  Our scene is constructed in eye space, which <a href="http://learningwebgl.com/blog/?p=1067#eye-space-explanation">you may remember from lesson 10</a>; in effect, this means that we’re drawing the scene as if there was a camera at the origin, (0, 0, 0), looking down the negative Z axis with X increasing to the right and Y increasing upwards.  The direction of any point from the origin is, of course, just its coordinates expressed as a vector — so, likewise, the direction of the viewers eyes at the origin from any point is just the negative of the coordinates.  We have the coordinates of the fragment, linearly interpolated from the vertex coordinates, in <code>vPosition</code>, so we negate it, normalise it to make it of length one, and that’s it!</p>
<pre><span style="color: red;">        vec3 eyeDirection = normalize(-vPosition.xyz);</span>
</pre>
<p>Now let’s look at R<sub>m</sub>.  This would be a bit more involved, if it weren’t for a very convenient GLSL function called <code>reflect&lt;/code,&gt;</code></p><code>
<blockquote><p>reflect (I, N): For the incident vector I and surface orientation N,  returns the reflection direction</p></blockquote>
<p>The incident vector is the direction from which a ray of light hits the surface at the fragment, which is the opposite of the direction of the light from the fragment (which we already have in <code>lightDirection</code>).  The surface orientation is called N because it's just the normal, which we also already have.  Given all that, it's easy to work out:</p>
<pre><span style="color: red;">        vec3 reflectionDirection = reflect(-lightDirection, normal);</span>
</pre>
<p>So, now that we have all that, the final step is very easy indeed:</p>
<pre><span style="color: red;">        specularLightWeighting = pow(max(dot(reflectionDirection, eyeDirection), 0.0), uMaterialShininess);
      }</span>
</pre>
<p>That's all we need to do to work out the contribution of the specular component to the fragment's lighting.  The next step is to work out how much the diffuse light contributes, using the same logic as before (though we can now use our local variable for the normalised normal):</p>
<pre>      float diffuseLightWeighting = max(dot(<span style="color: red;">normal</span>, lightDirection), 0.0);
</pre>
<p>Finally, we use both weightings, the diffuse and specular colours, and the ambient colour to work out the overall amount of lighting at this fragment for each colour component; this is a simple extension of what we were using before:</p>
<pre>      lightWeighting = uAmbientColor
        <span style="color: red;">+ uPointLightingSpecularColor * specularLightWeighting</span>
        + uPointLighting<span style="color: red;">Diffuse</span>Color * diffuseLightWeighting;
    }
</pre>
<p>Once that's all done, we have a value for the light weighting which we can just use in identical code to lesson 13's to weight the colour as specified by the current texture:</p>
<pre>    vec4 fragmentColor;
    if (uUseTextures) {
      fragmentColor = texture2D(uSampler, vec2(vTextureCoord.s, 1.0 - vTextureCoord.t));
    } else {
      fragmentColor = vec4(1.0, 1.0, 1.0, 1.0);
    }
    gl_FragColor = vec4(fragmentColor.rgb * lightWeighting, fragmentColor.a);
  }
</pre>
<p>That's it for the fragment shader!</p>
<p>Let's move a bit further down.  If you're looking for differences from lesson 13, the next you'll notice is that <code>initShaders</code> is back to its earlier simple form, just creating one program, though of course it also now initialises one or two more uniform locations for the new specular lighting settings.  A little further down from that, <code>initTextures</code> is now loading textures for the Earth and the galvanised steel effects instead of the Moon and the crate.  Down a little bit more and <code>setMatrixUniforms</code> is, like <code>initShaders</code>, once again designed for a single program — and then we reach something a little more interesting.</p>
<p>Instead of having <code>initBuffers</code> to create the WebGL buffers containing the various per-vertex attributes that define the appearance of the teapot, we have two functions: <code>handleLoadedTeapot</code> and <code>loadTeapot</code>.  The pattern will be familiar from <a href="http://learningwebgl.com/blog/?p=1067">lesson 10</a>, but it's worth going over again.  Let's take a look at <code>loadTeapot</code> (though it's the second one to appear in the code):</p>
<pre>  function loadTeapot() {
    var request = new XMLHttpRequest();
    request.open("GET", "Teapot.json");
    request.onreadystatechange = function() {
      if (request.readyState == 4) {
        handleLoadedTeapot(JSON.parse(request.responseText));
      }
    }
    request.send();
  }
</pre>
<p>The overall structure should be familiar from lesson 10; we create a new <code>XMLHttpRequest</code> and use it to load the file <code>Teapot.json</code>.   This will happen asynchronously, so we attach a callback function that will be triggered when the process of loading the file reaches various stages, and in the callback we do some stuff when the load reaches a <code>readyState</code> of 4, which means that it is fully loaded.  </p>
<p>The interesting bit is what happens then.  The file that we're loading is in <a href="http://json.org/">JSON format</a>, which basically means that it's already written in JavaScript; <a href="http://learningwebgl.com/lessons/lesson14/Teapot.json">have a look at it</a> to see what I mean.  The file describes a JavaScript object containing lists that hold the vertex positions, normals, texture coordinates, and a set of vertex indices that completely describe the teapot.  We could, of course, just embed this code directly into the <code>index.html</code> file, but if you were building a more complex model, with many separately-modelled objects, you'd want them all in separate files.</p>
<p>(Just which format you should use for pre-built objects in your WebGL applications is an interesting question.  You might be designing them in any of a plethora of different programs, and these programs can output models in many different formats, ranging from .obj to 3DS.  In the future, it looks like at least one of them will be able to output models in a JavaScript-native format, which I suspect may look a bit like the JSON model I've used for the teapot.  For now, you should treat this tutorial as an example of how you might go about loading a JSON-format pre-designed model, and not as an example of best practice :-)</p>
<p>So, we have code that loads up a file in JSON format, and triggers an action when it's loaded.  The action converts the JSON text into data we can use; we could just use the JavaScript <code>eval</code> function to convert it into a JavaScript object, but this is <a href="http://www.json.org/js.html">generally frowned upon</a>, and so instead we use the built-in function <code>JSON.parse</code> to parse the object.  Once that's done, we pass it up to <code>handleLoadedTeapot</code>:</p>
<pre>  var teapotVertexPositionBuffer;
  var teapotVertexNormalBuffer;
  var teapotVertexTextureCoordBuffer;
  var teapotVertexIndexBuffer;
  function handleLoadedTeapot(teapotData) {
    teapotVertexNormalBuffer = gl.createBuffer();
    gl.bindBuffer(gl.ARRAY_BUFFER, teapotVertexNormalBuffer);
    gl.bufferData(gl.ARRAY_BUFFER, new WebGLFloatArray(teapotData.vertexNormals), gl.STATIC_DRAW);
    teapotVertexNormalBuffer.itemSize = 3;
    teapotVertexNormalBuffer.numItems = teapotData.vertexNormals.length / 3;

    teapotVertexTextureCoordBuffer = gl.createBuffer();
    gl.bindBuffer(gl.ARRAY_BUFFER, teapotVertexTextureCoordBuffer);
    gl.bufferData(gl.ARRAY_BUFFER, new WebGLFloatArray(teapotData.vertexTextureCoords), gl.STATIC_DRAW);
    teapotVertexTextureCoordBuffer.itemSize = 2;
    teapotVertexTextureCoordBuffer.numItems = teapotData.vertexTextureCoords.length / 2;

    teapotVertexPositionBuffer = gl.createBuffer();
    gl.bindBuffer(gl.ARRAY_BUFFER, teapotVertexPositionBuffer);
    gl.bufferData(gl.ARRAY_BUFFER, new WebGLFloatArray(teapotData.vertexPositions), gl.STATIC_DRAW);
    teapotVertexPositionBuffer.itemSize = 3;
    teapotVertexPositionBuffer.numItems = teapotData.vertexPositions.length / 3;

    teapotVertexIndexBuffer = gl.createBuffer();
    gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, teapotVertexIndexBuffer);
    gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new WebGLUnsignedShortArray(teapotData.indices), gl.STREAM_DRAW);
    teapotVertexIndexBuffer.itemSize = 3;
    teapotVertexIndexBuffer.numItems = teapotData.indices.length;

    document.getElementById("loadingtext").textContent = "";
  }
</pre>
<p>There's not really anything worth highlighting in that function — it just takes the various lists from the loaded JSON object and puts them into WebGL arrays, which are then pushed over onto the graphics card in newly-allocated buffers.  Once all of this is done, we clear out a <code>div</code> in the HTML document which was previously telling the user that the model was being loaded, just like we did in lesson 10.</p>
<p>So, that's the model loaded.  What else?  Well, there's <code>drawScene</code>, which now needs to draw the teapot at an appropriate angle (after checking that it's loaded), but there's nothing really new there; take a look at the code and make sure you know what's going on (and please do leave a comment if anything's unclear), but I doubt you'll find anything to surprise you.</p>
<p>After that, <code>animate</code> has a few trivial changes to make it spin the teapot rather than make the Moon and the crate orbit, and <code>webGLStart</code> has to call <code>loadTeapot</code> instead of <code>initBuffers</code>.  And finally, the HTML code has the <code>DIV</code> to display the "Loading world..." text while the teapot is being loaded up, along with its associated CSS style, and of course it has new input fields for the new specular highlight parameters.</p>
<p>And after that, that's it!  You now know how to write shaders to show specular highlights, and how to load pre-built models that are stored in JSON format.  Next time we'll look at something a bit more advanced; how to use textures in a slightly different and more interesting way than we are now, with specular maps</p>
<p><span style="float: left; padding: 0px 20px 0px 0px;"><a href="http://learningwebgl.com/blog/?p=1523">&lt;&lt; Lesson 13</a></span><span style="float: right; padding: 0px 20px 0px 0px;"><a href="http://learningwebgl.com/blog/?p=1778">Lesson 15 &gt;&gt;</a></span><br/></p>
<p><em>Acknowledgments: the galvanised pattern is a Creative Commons sample from <a href="http://www.arroway-textures.com/">Arroway Textures</a>, and the Earth texture is courtesy of <a href="http://www.esa.int/esaEO/SEMGSY2IU7E_index_0.html">the European Space Agency/Envisat</a>.</em></p></code></div>
    </content>
    <updated>2010-02-09T14:52:37Z</updated>
    <category term="Lessons"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-03-02T15:00:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1703</id>
    <link href="http://learningwebgl.com/blog/?p=1703" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 8 Feb 2010</title>
    <summary>One big one today, and two smaller ones:

There have been a lot of fantastic games and demos made for WebGL, but that makes it particularly cool to see someone building something different.  iChemLabs have just released a 3D library for modelling molecules using WebGL (click the “3D” button at the top to get the [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>One big one today, and two smaller ones:</p>
<ul>
<li>There have been a lot of fantastic games and demos made for WebGL, but that makes it particularly cool to see someone building something different.  iChemLabs have just released a <a href="http://web.chemdoodle.com/">3D library for modelling molecules using WebGL</a> (click the “3D” button at the top to get the WebGL version).  They have <a href="http://web.chemdoodle.com/overview3D.php">an overview page</a> showing a bunch of different kinds of views of various molecules, and <a href="http://web.chemdoodle.com/molgrabber3d.php">a page demonstrating their MolGrabber3D canvas</a> where you can pick the drug whose molucule you want to see and can change the kind of representation you want to see it in.  There’s also <a href="http://web.chemdoodle.com/3dcwc.html">a nice 8-minute overview video</a>, so you can see what they’re up to even if you don’t have WebGL setup on your machine, and <a href="http://www.macresearch.org/3d-chemdoodle-web-components">a written overview</a> for the MacResearch community site.  So that’s chemistry done, any astrophysicists or geologists out there working with WebGL?  :-)</li>
<li>Not strictly WebGL, but it’s using it under the hood: Andor Salga has built <a href="http://matrix.senecac.on.ca/~asalga/DPS911/release0.5/demo/IDE3D/">a web-based mini-IDE</a> for the <a href="http://processingjs.org/">Processing.js</a> port of the <a href="http://processing.org/">Processing</a> 3D language.</li>
<li>A simple demo: drawing <a href="http://www.c3dl.org/wp-content/effects_all_3_browsers/effect_test2/">cartoon animations</a> using C3DL.</li>
</ul></div>
    </content>
    <updated>2010-02-08T14:45:00Z</updated>
    <category term="Links"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-02-26T18:20:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1698</id>
    <link href="http://learningwebgl.com/blog/?p=1698" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 5 Feb 2010</title>
    <summary>Some interesting new projects today!

In the earliest WebGL demos, Vladimir Vukićević used the Sylvester library for vector and matrix maths; it’s convenient, well-written, well-documented, and open source.  Pretty much everyone else followed suit.  However, its very general-purpose nature means that it can’t be as fast as a specialised library focusing on the specific [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>Some interesting new projects today!</p>
<ul>
<li>In the earliest WebGL demos, Vladimir Vukićević used the <a href="http://sylvester.jcoglan.com/">Sylvester library</a> for vector and matrix maths; it’s convenient, well-written, well-documented, and open source.  Pretty much everyone else followed suit.  However, its very general-purpose nature means that it can’t be as fast as a specialised library focusing on the specific kinds of calculations we need for 3D graphics.  <a href="http://blog.vlad1.com/2010/02/05/mjs-simple-vector-and-matrix-math-for-js/">So, he’s started a new project called mjs</a>, to provide just the really simple vector and matrix maths we need, and to do it really quickly.  He’s getting pretty encouraging results on his benchmarks, with JITed calculations being more than ten times as quick, and un-JITed at least twice as fast.  [UPDATE I've tried porting the upcoming lesson 14 to it, and it works fine.  No performance figures yet, though.]</li>
<li>Another important part of building 3D scenes is getting models designed in 3D graphics programs into your JavaScript code.  People are working on tools to import existing 3D graphics formats like <a href="http://techblog.floorplanner.com/2010/01/27/introducing-js3ds-a-javascript-parser-for-3ds/">3DS</a>, but an alternative route is to get the 3D modelling tool to output JSON or some other format you can easily read.  Paul Brunt’s <a href="http://www.glge.org/">GLGE</a> has some support for doing this from Blender, but <a href="http://www.rozengain.com/blog/2010/02/04/blender-to-webgl-javascript-exporter/">Dennis Ippel has just announced a project that makes exporting from Blender to WebGL code its main focus</a>.  So far it exports to SceneJS, but a generic WebGL version is on its way.  It’s not ready to download yet, but will be soon.</li>
<li>Another 3D library for WebGL, this one with its own editor!  <a href="http://www.ambiera.com/copperlicht/index.html">CopperLicht</a> is definitely worth a look.</li>
</ul></div>
    </content>
    <updated>2010-02-05T14:29:11Z</updated>
    <category term="Uncategorized"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-02-22T19:40:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1695</id>
    <link href="http://learningwebgl.com/blog/?p=1695" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 4 Feb 2010</title>
    <summary>For today, one new link and a couple of older things that I managed to miss first time around:

A new interview with a WebGL library creator at 3D test: this time, it’s Marco Di Benedetto on SpiderGL.  Well worth a read.
GLGE has forums!  It looks like a good place not just for discussing [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>For today, one new link and a couple of older things that I managed to miss first time around:</p>
<ul>
<li>A new interview with a WebGL library creator at 3D test: this time, it’s <a href="http://www.3d-test.com/interviews/webgl_spiderGL_1.htm">Marco Di Benedetto on SpiderGL</a>.  Well worth a read.</li>
<li><a href="http://www.glge.org/forum/">GLGE has forums</a>!  It looks like a good place not just for discussing the library, but also WebGL in general.</li>
<li>Peter Strohm has added more to his <a href="http://peter-strohm.de/webgl/">WebGL lessons in German</a>; there are now tutorials on adding <a href="http://peter-strohm.de/webgl/webgltutorial5.html">interaction</a>, and <a href="http://peter-strohm.de/webgl/webgltutorial6.html">textures</a>.</li>
<li><a href="http://code.google.com/p/gwt-g3d/">gwt-g3d</a>, one of the three independent projects to create a Google Web Toolkit binding for WebGL, now includes ports of my first 12 lessons as part of its demos.  I’m flattered :-) — but additionally, that suggests things have moved on quite a bit since it was announced at the end of December.  Its competitors, <a href="http://sourceforge.net/projects/wgt/">WGT</a> and <a href="http://code.google.com/p/gwtgl/">GwtGL</a> seem to be coming along nicely too.</li>
</ul></div>
    </content>
    <updated>2010-02-04T19:59:00Z</updated>
    <category term="Links"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-02-22T17:40:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1690</id>
    <link href="http://learningwebgl.com/blog/?p=1690" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 2 Feb 2010</title>
    <summary>It looks like WebGL is going to get a bit of a push at the Game Developers’ Conference in San Francisco in March: there are three sessions highlighting it, one from Barthold Lichtenbelt of NVIDIA on OpenGL — Featuring WebGL, one from Tom Olson of Khronos on Khronos Mobile — Featuring WebGL, and one from [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><ul>
<li>It looks like WebGL is going to get a bit of a push at the Game Developers’ Conference in San Francisco in March: there are three sessions highlighting it, one from Barthold Lichtenbelt of NVIDIA on <a href="https://www.cmpevents.com/GD10/a.asp?option=C&amp;V=11&amp;SessID=10553">OpenGL — Featuring WebGL</a>, one from Tom Olson of Khronos on <a href="https://www.cmpevents.com/GD10/a.asp?option=C&amp;V=11&amp;SessID=10555">Khronos Mobile — Featuring WebGL</a>, and one from Mark Barnes of Khronos on <a href="https://www.cmpevents.com/GD10/a.asp?option=C&amp;V=11&amp;SessID=10554">COLLADA — Featuring WebGL</a>.  Interestingly, there doesn’t seem to be anything on WebGL on its own.</li>
<li>A new demo, this time from Marko Ivankovic: <a href="http://code.google.com/p/mivankovic-blog/wiki/WebGLTestpage">fractal mountain generation</a>.</li>
</ul>
<p>Finally, some good news about the next tutorial on this blog: <a href="http://learningwebgl.com/lessons/lesson14">the page for lesson 14</a> — which covers specular highlights — is pretty much done, as is <a href="http://www.youtube.com/watch?v=OSjVRA2BQJU">the video</a> for people who don’t have WebGL-enabled browsers.  Now it’s “just” a question of writing about it :-S</p></div>
    </content>
    <updated>2010-02-02T14:03:43Z</updated>
    <category term="Links"/>
    <category term="Upcoming lessons"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-02-18T19:40:02Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1680</id>
    <link href="http://learningwebgl.com/blog/?p=1680" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 1 Feb 2010</title>
    <summary>A game!  From the C3DL team, 3D Asteroids.
Also from the C3DL guys, an update to keep their particle systems working, which leads neatly on to…
…this N-body simulation from Mike Bostock.  Look out, though — it works in Chrome but it crashed last night’s Minefield for me.
More good news from Paul Brunt: GLGE can [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><ul>
<li>A game!  From the C3DL team, <a href="http://www.c3dl.org/index.php/c3dl-dev/asteroids-in-3d-and-a-bit-of-2d/">3D Asteroids</a>.</li>
<li>Also from the C3DL guys, <a href="http://www.c3dl.org/index.php/c3dl-dev/another-demo-updated/">an update to keep their particle systems working</a>, which leads neatly on to…</li>
<li>…<a href="http://graphics.stanford.edu/~mbostock/physics-webgl.html">this N-body simulation</a> from Mike Bostock.  Look out, though — it works in Chrome but it crashed last night’s Minefield for me.</li>
<li>More good news from Paul Brunt: <a href="http://www.glge.org/glge-text-rendering-demo/">GLGE can now render text</a>!</li>
<li>A new real-world use for WebGL: from Helmut Dersch, <a href="http://webuser.hs-furtwangen.de/~dersch/PTViewerNG/PTViewerNG.html">DIY Streetview in WebGL</a> (and also <a href="http://www.diy-streetview.org/data/development/20100130/webgl/PTViewerNG.htm">here</a>).</li>
</ul></div>
    </content>
    <updated>2010-02-01T14:28:04Z</updated>
    <category term="Links"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-02-17T13:40:03Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://www.c3dl.org/?p=2271</id>
    <link href="http://www.c3dl.org/index.php/c3dl-dev/asteroids-in-3d-and-a-bit-of-2d/" rel="alternate" type="text/html"/>
    <title>Asteroids in 3D… and a bit of 2D</title>
    <summary>So I’ve been working on this little demo in preparation for the upcoming (very very soon…docs left only) release of C3DL’s webGL release.  I adapted it from Peter Callaghan’s Asteroids game and the models were from an old demo made as part of our user testing last year.

This demo is kind of cool because [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">So I’ve been working on this little demo in preparation for the upcoming (very very soon…docs left only) release of C3DL’s webGL release.  I adapted it from Peter Callaghan’s Asteroids game and the models were from an old demo made as part of our user testing last year.

This demo is kind of cool because it demonstrates many of the features of C3DL and puts it all together in one.  Namely it uses:
<ul>
	<li>collada model loading – you can export to collada from a good number of modeling programs including blender, 3ds max and google sketchup</li>
	<li>particle systems – watch the rocks when they explode!</li>
	<li>lighting – ok… this is not featured well… I’ll try to see if I can do better with it</li>
	<li>picking – click on rock to identify which one</li>
</ul>
I will probably add something to that uses the effects system as that is one key component not highlighted.

Its not quite done yet but I figured I’d link it anyways since I won’t have time to finish it till probably Wednesday…. I still have to add scoring and end game functionalities, the keys should be changed to a and d instead of using arrows,  and I think my health bar is messed up when it drops below 25 but… its a start.  I also have not tested well on webkit (there was a bug of constantly rotating ship at one point but have not been able to reproduce it) and I can’t seem to run chrome on my desktop atm so no testing there.

This demo uses webGL in the main display and I painted the hud with 2D canvas.

Click on the asteroids to shoot them.  Use arrow keys to rotate the ship.

<a href="https://cs.senecac.on.ca/~catherine.leung/c3dl/Asteroids3/asteroids.html">https://cs.senecac.on.ca/~catherine.leung/c3dl/Asteroids3/asteroids.html
</a>
NOTE:  To see this demo you need a web browser that supports webGL and it must be enabled.</div>
    </content>
    <updated>2010-02-01T11:12:55Z</updated>
    <category term="c3dl development"/>
    <author>
      <name>Cathy Leung</name>
    </author>
    <source>
      <id>http://www.c3dl.org</id>
      <link href="http://www.c3dl.org/index.php/category/c3dl-dev/feed/" rel="self" type="application/atom+xml"/>
      <link href="http://www.c3dl.org" rel="alternate" type="text/html"/>
      <subtitle>WebGL made easy!</subtitle>
      <title>Canvas 3d JS Library » c3dl development</title>
      <updated>2010-02-22T06:20:04Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://www.c3dl.org/?p=2259</id>
    <link href="http://www.c3dl.org/index.php/c3dl-dev/another-demo-updated/" rel="alternate" type="text/html"/>
    <title>Another demo updated</title>
    <summary>I’ve just finished updating the particle systems demo.  There wasn’t anything wrong with the demo itself, but there was an array in the particle system class that wasn’t being initialized properly that suddenly started causing Minefield to crash.  The strange thing is that until recently Minefield wasn’t complaining about it.  But as [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>I’ve just finished updating the <a href="http://www.c3dl.org/index.php/webgl-demos/particle-systems-demo">particle systems demo</a>.  There wasn’t anything wrong with the demo itself, but there was an array in the particle system class that wasn’t being initialized properly that suddenly started causing Minefield to crash.  The strange thing is that until recently Minefield wasn’t complaining about it.  But as of the nightly build on the 23rd it didn’t just complain, it outright crashed.  By populating the array with 0s when it is initialized, I’ve got particles working again.  The misleading problem was that this happened at the same time I was fixing an issue with colours for Chromium was preventing it from displaying.  It started crashing one browser at the same time I fixed a problem for another.  It turns out that was caused because colour values were being read out of a file and split into an array, but they were never explicitly made into floating point values.  Minefield and Webkit understood them as such anyway, but Chromium didn’t like that.  A temporary solution was to multiply the values by 1 before using them, but that isn’t a very good solution.  Once I actually traced the problem to its source, a quick parseFloat took care of it.  Slightly slower, but more correct.</p><p/></div>
    </content>
    <updated>2010-01-28T21:25:35Z</updated>
    <category term="c3dl development"/>
    <author>
      <name>peter</name>
    </author>
    <source>
      <id>http://www.c3dl.org</id>
      <link href="http://www.c3dl.org/index.php/category/c3dl-dev/feed/" rel="self" type="application/atom+xml"/>
      <link href="http://www.c3dl.org" rel="alternate" type="text/html"/>
      <subtitle>WebGL made easy!</subtitle>
      <title>Canvas 3d JS Library » c3dl development</title>
      <updated>2010-02-22T06:20:04Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1664</id>
    <link href="http://learningwebgl.com/blog/?p=1664" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 28 Jan 2010</title>
    <summary>A lot of new stuff over the last three days:

Over at 3D test, an interview with Paul Brunt of GLGE fame — well worth reading.
On thing that’s going to be important for WebGL going forward is the ability to load up objects that have been designed in 3D modeling tools like Blender, Autodesk 3D Studio [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>A lot of new stuff over the last three days:</p>
<ul>
<li>Over at 3D test, <a href="http://www.3d-test.com/interviews/webgl_GLGE_1.htm">an interview with Paul Brunt</a> of <a href="http://www.glge.org/">GLGE</a> fame — well worth reading.</li>
<li>On thing that’s going to be important for WebGL going forward is the ability to load up objects that have been designed in 3D modeling tools like Blender, Autodesk 3D Studio or Google SketchUp.  There are two ways of doing this — by converting the tools’ files into a JavaScript-friendly format like JSON, or by writing code to load the files directly in JavaScript.  Tim Knip has started work on the latter kind: <a href="http://techblog.floorplanner.com/2010/01/27/introducing-js3ds-a-javascript-parser-for-3ds/">js3ds, a 3DS import library for JavaScript</a>.</li>
<li>A very neat (Firefox-only) demo from murphy: <a href="http://murfy.de/read/webgl-drawWindow">using a web page as a texture on a WebGL object</a>.</li>
<li>An impressive (new?) X3DOM demo that I’ve not seen before: <a href="http://x3dom.org/x3dom/example/x3dom_shadows.xhtml">floating objects with shadows</a>.</li>
<li>Some interesting news about the WebGL spec — <a href="http://blog.vlad1.com/2009/11/06/canvasarraybuffer-and-canvasarray/">a while back</a>,  Vladimir Vukićević suggested that the <code>WebGLArrayBuffer</code> and <code>WebGL*Array</code> types would be useful outside WebGL.  He’s now started moving their definition into <a href="http://people.mozilla.com/~vladimir/jsvec/TypedArray-spec.html">a specification of their own</a>.  If this goes ahead, and they are broken out of WebGL, then we’ll probably have to change our pages once again — after all, if they’re not WebGL-specific then they won’t have “WebGL” in their names.  One to keep an eye on…</li>
<li>Finally, Benjamin DeLillo reports that <a href="http://bjartr.blogspot.com/2010/01/webglu-now-on-github.html">he’s moved WebGLU to github</a> (an excellent idea) and shows that the latest version of his library makes his 50-line demo <a href="http://bjartr.blogspot.com/2010/01/remember-that-50-line-webgl-demo-now.html">an even more impressive 25 lines</a>!</li>
</ul></div>
    </content>
    <updated>2010-01-28T14:43:44Z</updated>
    <category term="Links"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-02-17T00:40:03Z</updated>
    </source>
  </entry>

  <entry>
    <id>tag:blogger.com,1999:blog-1513616564513865425.post-3670440867095566457</id>
    <link href="http://bjartr.blogspot.com/feeds/3670440867095566457/comments/default" rel="replies" type="application/atom+xml"/>
    <link href="http://bjartr.blogspot.com/2010/01/remember-that-50-line-webgl-demo-now.html#comment-form" rel="replies" type="text/html"/>
    <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default/3670440867095566457" rel="edit" type="application/atom+xml"/>
    <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default/3670440867095566457" rel="self" type="application/atom+xml"/>
    <link href="http://bjartr.blogspot.com/2010/01/remember-that-50-line-webgl-demo-now.html" rel="alternate" type="text/html"/>
    <title>Remember that 50 line WebGL demo? Now it's 25 lines</title>
    <summary>So a while back I did a 50 line demo to show how little code it takes to make WebGL content when using the WebGLU library. Since then I've simplified and consolidated WebGLU in addition to adding new features. One of the biggest (code length wise) was to load shaders from a file and add a default shader as well as a couple other simple shaders. Hopefully WebGLU will grow to include many cool and</summary>
    <updated>2010-01-26T04:54:10Z</updated>
    <published>2010-01-26T04:11:00Z</published>
    <author>
      <name>Bjartr</name>
      <email>noreply@blogger.com</email>
      <uri>http://www.blogger.com/profile/04409321734144736503</uri>
    </author>
    <source>
      <id>tag:blogger.com,1999:blog-1513616564513865425</id>
      <author>
        <name>Bjartr</name>
        <email>noreply@blogger.com</email>
        <uri>http://www.blogger.com/profile/04409321734144736503</uri>
      </author>
      <link href="http://bjartr.blogspot.com/feeds/posts/default" rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"/>
      <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default" rel="self" type="application/atom+xml"/>
      <link href="http://bjartr.blogspot.com/" rel="alternate" type="text/html"/>
      <link href="http://pubsubhubbub.appspot.com/" rel="hub" type="text/html"/>
      <subtitle>Benjamin DeLillo's Project Blog</subtitle>
      <title>One Geek's Blog</title>
      <updated>2010-03-08T23:03:54Z</updated>
    </source>
  </entry>

  <entry>
    <id>tag:blogger.com,1999:blog-1513616564513865425.post-6143343438058987974</id>
    <link href="http://bjartr.blogspot.com/feeds/6143343438058987974/comments/default" rel="replies" type="application/atom+xml"/>
    <link href="http://bjartr.blogspot.com/2010/01/long-delayed-webglu-update-some-360.html#comment-form" rel="replies" type="text/html"/>
    <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default/6143343438058987974" rel="edit" type="application/atom+xml"/>
    <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default/6143343438058987974" rel="self" type="application/atom+xml"/>
    <link href="http://bjartr.blogspot.com/2010/01/long-delayed-webglu-update-some-360.html" rel="alternate" type="text/html"/>
    <title>A long delayed WebGLU update, some 360 degree video, and that's just for starters</title>
    <summary>Yes, I'm still here and actively developing my WebGLU library. For those of you who don't know what WebGLU is, it's a library for making WebGL application development easy and fun with minimal coding.  Since my last post WebGLU has gone through a major refactor adding several new features and cleaning up old ones. Plus, I've got a neat demo to show off. Both a live version and a video are</summary>
    <updated>2010-01-26T04:53:27Z</updated>
    <published>2010-01-22T00:18:00Z</published>
    <author>
      <name>Bjartr</name>
      <email>noreply@blogger.com</email>
      <uri>http://www.blogger.com/profile/04409321734144736503</uri>
    </author>
    <source>
      <id>tag:blogger.com,1999:blog-1513616564513865425</id>
      <author>
        <name>Bjartr</name>
        <email>noreply@blogger.com</email>
        <uri>http://www.blogger.com/profile/04409321734144736503</uri>
      </author>
      <link href="http://bjartr.blogspot.com/feeds/posts/default" rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"/>
      <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default" rel="self" type="application/atom+xml"/>
      <link href="http://bjartr.blogspot.com/" rel="alternate" type="text/html"/>
      <link href="http://pubsubhubbub.appspot.com/" rel="hub" type="text/html"/>
      <subtitle>Benjamin DeLillo's Project Blog</subtitle>
      <title>One Geek's Blog</title>
      <updated>2010-03-08T23:03:54Z</updated>
    </source>
  </entry>

  <entry>
    <id>tag:blogger.com,1999:blog-1513616564513865425.post-4534909547907606793</id>
    <link href="http://bjartr.blogspot.com/feeds/4534909547907606793/comments/default" rel="replies" type="application/atom+xml"/>
    <link href="http://bjartr.blogspot.com/2010/01/webglu-now-on-github.html#comment-form" rel="replies" type="text/html"/>
    <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default/4534909547907606793" rel="edit" type="application/atom+xml"/>
    <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default/4534909547907606793" rel="self" type="application/atom+xml"/>
    <link href="http://bjartr.blogspot.com/2010/01/webglu-now-on-github.html" rel="alternate" type="text/html"/>
    <title>WebGLU now on GitHub</title>
    <summary>WebGLU, the library that makes WebGL development easy, has been moved to GitHub. I've gotten several requests for this move. Seems like the move couldn't hurt, so after some deliberation I've decided to do it.

In performing this move I've cleaned up the examples folder so that it now contains working examples which include texture mapping, keyframed animation, and the videosphere. I've also</summary>
    <updated>2010-01-26T03:31:20Z</updated>
    <published>2010-01-26T03:05:00Z</published>
    <category scheme="http://www.blogger.com/atom/ns#" term="webgl"/>
    <category scheme="http://www.blogger.com/atom/ns#" term="git"/>
    <category scheme="http://www.blogger.com/atom/ns#" term="github"/>
    <category scheme="http://www.blogger.com/atom/ns#" term="webglu"/>
    <author>
      <name>Bjartr</name>
      <email>noreply@blogger.com</email>
      <uri>http://www.blogger.com/profile/04409321734144736503</uri>
    </author>
    <source>
      <id>tag:blogger.com,1999:blog-1513616564513865425</id>
      <author>
        <name>Bjartr</name>
        <email>noreply@blogger.com</email>
        <uri>http://www.blogger.com/profile/04409321734144736503</uri>
      </author>
      <link href="http://bjartr.blogspot.com/feeds/posts/default" rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"/>
      <link href="http://www.blogger.com/feeds/1513616564513865425/posts/default" rel="self" type="application/atom+xml"/>
      <link href="http://bjartr.blogspot.com/" rel="alternate" type="text/html"/>
      <link href="http://pubsubhubbub.appspot.com/" rel="hub" type="text/html"/>
      <subtitle>Benjamin DeLillo's Project Blog</subtitle>
      <title>One Geek's Blog</title>
      <updated>2010-03-08T23:03:54Z</updated>
    </source>
  </entry>

  <entry xml:lang="en">
    <id>http://learningwebgl.com/blog/?p=1651</id>
    <link href="http://learningwebgl.com/blog/?p=1651" rel="alternate" type="text/html"/>
    <title>WebGL around the net, 25 Jan 2010</title>
    <summary>Three framework updates today!

Benjamin DeLillo has been quiet for a while, but he’s been working hard on WebGLU, adding (among other things) keyframe animation, image and video-based textures, shader loading from external files, and the beginning stages of import capabilities for .obj files (a common format for 3D models).  His blog post gives more [...]</summary>
    <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>Three framework updates today!</p>
<ul>
<li>Benjamin DeLillo has been quiet for a while, but he’s been working hard on WebGLU, adding (among other things) keyframe animation, image and video-based textures, shader loading from external files, and the beginning stages of import capabilities for .obj files (a common format for 3D models).  <a href="http://bjartr.blogspot.com/2010/01/long-delayed-webglu-update-some-360.html">His blog post gives more information</a>, including a very cool example of a 360° video.</li>
<li>Paul Brunt’s GLGE improves in leaps and bounds; <a href="http://www.glge.org/fog-now-supported/">he’s now added fog effects</a>.</li>
<li><a href="http://lindsaystanleykay.blogspot.com/2010/01/scenejs-environment-nodes.html">Lindsay Kay’s SceneJS</a> has now gained the ability to override certain rendering parameters in specific subtrees of the scene graph.</li>
</ul></div>
    </content>
    <updated>2010-01-25T19:46:06Z</updated>
    <category term="Links"/>
    <author>
      <name>giles</name>
    </author>
    <source>
      <id>http://learningwebgl.com/blog</id>
      <link href="http://learningwebgl.com/blog/?feed=rss2" rel="self" type="application/atom+xml"/>
      <link href="http://learningwebgl.com/blog" rel="alternate" type="text/html"/>
      <subtitle>...lessons 'n' links...</subtitle>
      <title>Learning WebGL</title>
      <updated>2010-02-12T20:40:03Z</updated>
    </source>
  </entry>
</feed>
