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 » Uniforms and Attributes
canada goose jacke parajumpers ugo parajumpers jas ugo canada goose uk moncler outlet
2011+06+07

Uniforms and Attributes

Assuming you know what Uniforms and Attributes are for shaders, I’ll try to explain how they work in GLOW.

(It could be a good idea to check out the Hello Cube tutorial first)

The data property in the object passed to the Shader constructor contains all Uniform and Attribute data for your shader. The Shader constructor passes these, along with the elements, vertex and fragment shader code, into the GLOW.Compiler. The compiler wraps your data in GLOW.Uniform and GLOW.Attribute, which handles loading and binding of your data.

You can create any kind of data you like – you don’t have to use the math objects supplied in the GLOW extras. If you like to create your own data, make sure the data is stored in Float32Arrays and that you alter…

GLOW.Uniform.prototype.getNativeValue = function() {
  // code that return a Float32Array containing your data
}

Note that this goes for single values as well. For reference, please check out GLOW.Float. If you like, you can alter the value function on separate uniforms…

myShader.uniforms.transform.getNativeValue = function() {
  // code that return a Float32Array containing your data
}

Another sweet thing is that all your data is attached to the GLOW.Shader, so you can access your data like…

myShader.transform.setPosition( 100, 100, 100 );
myShader.time.add( 1 );

If you like to access the GLOW.Uniform or the GLOW.Attribute, they’re accessible here…

myShader.uniforms.myUniformName.load();
myShader.attributes.myAttributeName.bind();

As usual, please read the code for more insights.