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 » Benefits with GLOW
Parajumpers sale Parajumpers sale canada goose sale Canada Goose jas

Benefits with GLOW

Several people have asked me why they should use GLOW when there’re a lot more competent libraries out there. It’s a good question, which I’ll try to answer here.

GLOW is a WebGL wrapper, so you’re flying very LOW over the GL – that’s where the name comes from. This also means that GLOW is not for beginners but for you with some experience of WebGL or OpenGL. It also means that it’s not a WebGL 3D framework (like Three.js). It’s just a wrapper.

Given that you have experience, you’re probably familiar with code looking like…

GL.useProgram( program );
GL.uniformMatrix4fv( viewMatrixLoc, false, viewMatrix );
GL.uniformMatrix4fv( projMatrixLoc, false, projMatrix );
GL.uniform1i( sampleLoc, 0 );
GL.activeTexture( GL.TEXTURE0 );
GL.bindTexture( GL.TEXTURE_2D, texture );
GL.bindBuffer( GL.ARRAY_BUFFER, vertices );
GL.vertexAttribPointer( 0, 3, GL.FLOAT, false, 0, 0 );
GL.bindBuffer( GL.ARRAY_BUFFER, uvs );
GL.vertexAttribPointer( 1, 2, GL.FLOAT, false, 0, 0 );
GL.bindBuffer( GL.ARRAY_BUFFER, normals );
GL.vertexAttribPointer( 2, 3, GL.FLOAT, false, 0, 0 );
GL.bindBuffer( GL.ELEMENT_ARRAY_BUFFER, faces );
GL.drawElements( GL.TRIANGLES, 36, GL.UNSIGNED_SHORT, 0 );

This is pretty much the only way to draw something with WebGL – it’s designed this way. GLOW wraps this with a tiny overhead (most of which is the cache) and all you do is…


It’s in your shader code the magic happens and we think this is where you should spend your time. The shader data format is similar to the Three.js custom shader format – only slightly simpler, all to get you started within minutes…

var shaderData = {
  vertexShader: "...the vertex shader code...",
  fragmentShader: "...the fragment shader code...",
  data: {
    viewMatrix: new GLOW.Matrix4(),
    vertices: myFloat32ArrayWithVertices,
    ...and all other uniforms and attributes...
  elements: myUint16ArrayWithElements

var shader = new GLOW.Shader( shaderData );

GLOW comes with an extras library including matrices, vectors, hierarchies, geometry parsers and other helpful objects, all (most probably) working out of the box. As GLOW is just a wrapper, it’s compatible with all other WebGL libraries and can be used to extend these in all possible ways.

So, the benefits are:

  • You get close to WebGL without having to deal with the WebGL API
  • It’s very easy to create shaders
  • There are a lot of extras that helps you get going
  • It’s compatible with all other WebGL frameworks