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


Usage in WebGL is used for hinting the GPU how to store data. This parameter is now supported by GLOW.

The GLOW shader data object has a new property, simply called usage…

var shaderData = {
  vertexShader: "...the vertex shader code...",
  fragmentShader: "...the fragment shader code...",
  data: {
    viewMatrix: new GLOW.Matrix4(),
    vertices: myFloat32ArrayWithVertices,
    uvs: myFloat32ArrayWithUVs,
    ...and all other uniforms and attributes...
  usage: {
    vertices: GL.DYNAMIC_DRAW,
    uvs: GL.STREAM_DRAW,
    triangles: GL.DYNAMIC_DRAW
  triangles: myUint16ArrayWithTriangles

As you see, I use the global GL object for parameters – make sure that a GLOW.Context has been created before you create the shader data object.

  • GL.DYNAMIC_DRAW is for buffers that are used often and updated often
  • GL.STREAM_DRAW is for buffers that are initialized once and seldom drawn.
  • GL.STATIC_DRAW (default) is for buffers that are initialized once and drawn often.

Note that the elements (in this case triangles) also can be subject to usage. You don’t have to define the usage property and if you do, you only have to set it for data that use GL.STREAM_DRAW or GL.DYNAMIC_DRAW.