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 » Refactored .elements
canada goose jacke parajumpers ugo parajumpers jas ugo canada goose uk moncler outlet
2011+12+27

Refactored .elements

To make it easier and more logical to activate GL.drawArrays (see previous post) we’ve thrown away the good old elements property and changed it into…

var shaderConfig = {
  indices: myArrayOfIndices,
  primitives: GL.TRIANGLES,
  data: {
    // attributes and uniforms
  },
  usage: {
    primitives: GL.DYNAMIC_DRAW
  }
}

(First a side note: elements is now primitives in the usage object). As you can see we’ve split elements into indices and primitives, where…

  • indices is the array of indices
  • primitives is the type of primitive you’d like to use

If you leave out the primitives property, it defaults to GL.TRIANGLE. Also, the good old…

  • triangles
  • triangleStrip
  • triangleFan
  • points
  • lines
  • lineLoop
  • lineStrip

… properties still work and automatically sets the primitive property.

Now, to use GL.drawArrays instead of GL.drawElements you simply leave out the indices property…

var shaderConfig = {
  primitives: GL.POINTS,
  data: {
    // attributes and uniforms
  }
}

As you see, you no longer have to set the amount of primitives to draw (this is calculated from the attribute length).

Thanks Neil Mendoza for the excellent suggestion.
Hope you like it!