title: synch vs. asynch texture loading in three.js
body: <p>I am have been playing around with Three.js during my lunch hour, implementing the old NEHE demos (up to #30 so far).  One aspect that seems annoying is the new asynchronous texture loaders.  I have a shader material  demo where the material gets created like this:</p>
  
  <pre><code>var uniforms = {
      tOne: { type: "t", value: THREE.ImageUtils.loadTexture( "images/cover.png" ) },
      tSec: { type: "t", value: THREE.ImageUtils.loadTexture( "images/grass.png" ) }
  };
  var material_shh = new THREE.ShaderMaterial({
      uniforms: uniforms,
      vertexShader: vertShader,
      fragmentShader: fragShader
  });
  var mesh = new THREE.Mesh( cubeGeom, material_shh );
  gfxScene.add(mesh);
  </code></pre>
  
  <p>This works fine, but three.js whines at me in the console that loadTexture is deprecated. (Why?).  Anyway, I can write it to use a textureLoader like this:</p>
  
  <pre><code>var textureLoader = new THREE.TextureLoader();
  var cover, grass;
  textureLoader.load( "images/cover.png", function( texture ) {
      cover = texture;
  });
  
  textureLoader.load( "images/grass.png", function( texture ) {
      grass = texture;
  
     var uniforms = {
          tOne: { type: "t", value: cover  },
          tSec: { type: "t", value: grass  }
      };
  
      var material_shh = new THREE.ShaderMaterial({
          uniforms: uniforms,
          vertexShader: vertShader,
          fragmentShader: fragShader
      });
  
      var mesh = new THREE.Mesh( cubeGeom, material_shh );
      gfxScene.add(mesh);
  });
  </code></pre>
  
  <p>This works too, but seems rather convoluted. I get it that asynch is good for web apps, etc. but... And it assumes that I am guaranteed that the cover.png will be loaded before grass.png.  Is that in fact guaranteed? I'd rather just stick with the synchronous loadTexture utility, but perhaps there is a good reason to not use loadTexture (other than it is deprecated).  TIA.</p>