Friends link: exam 70-450 cert 9a0-125 Adobe 9A0-127 exam Apple 9l0-410 Certification a00-202 Exam dumps IBM a2010-570 Exam dumps Pass A2160-669 Exam asc-029 Exam Dumps BCP-240 Actual Exam ISEB bh0-006 exam
GLOW » Hello Cube!
canada goose jacke parajumpers ugo parajumpers jas ugo canada goose uk moncler outlet
2011+06+02

Hello Cube!

This is the first GLOW tutorial where we’ll show how to create a rotating cube.

You can see the result here. Please view the source and have it at hand when reading this tutorial.

To get GLOW going, you first create a GLOW.Context…

var context = new GLOW.Context();
context.setupClear( { red: 1, green: 1, blue: 1 } );
var container = document.getElementById( "container" );
container.appendChild( context.domElement );

We’re also setting the clear color to white and append the context’s DOM element to the page. Then we create an object containing four properties…

var cubeShaderInfo = {
  vertexShader: "...vertex shader code...",
  fragmentShader: "...fragment shader code...",
  data: { ...all uniform, attribute and texture data... },
  elements: [ ...UInt16Array containing element info... ]
}

GLOW.Shader takes this object as constructor parameter…

var cube = new GLOW.Shader( cubeShaderInfo );

And when you have your shader, you can simply draw it by calling…

cube.draw();

Now, probably you see there’s stuff missing to actually get a cube rotating, please read the code for the details. One important thing is that all properties you create in the data-object, is attached to the shader for easy access…

var cubeShaderInfo = {
  vertexShader: "...vertex shader code...",
  fragmentShader: "...fragment shader code...",
  data: {
    transform: new GLOW.Matrix4()
  },
  elements: [ ...UInt16Array containing element info... ]
}

var cube = new GLOW.Shader( cubeShaderInfo );
cube.transform.setPosition( 100, 100, 100 );

Another important thing is the cache – read all about it here. Before drawing your first shader in your render loop it’s important to…

context.cache.clear();

That’s pretty much it. Again, please read the code, it’s more or less self-explanatory. Happy coding!