Phil 3.25.14

8:00 – 5:30 SR

  • Backups
  • Deployed new FA, VSS, and some new views
  • Meeting with Chris, Tangie, Carla, Betty, Pat and Lenny going over the VizTool presentation
  • Back to JavaScript and WebGL
  • Spent a good deal of time working with how to get multiple buffers to work. Here’s the basic pattern:
function draw(gl, n) {
    // Clear <canvas>
    gl.clear(gl.COLOR_BUFFER_BIT);

    // repeat the following two lines for all your buffers
    gl.bindBuffer(gl.ARRAY_BUFFER, g_vertexSizeBuffer);
    gl.bufferData(gl.ARRAY_BUFFER, g_verticesSizes, gl.STATIC_DRAW);
 
    // once done with updating the data unbind.
    gl.bindBuffer(gl.ARRAY_BUFFER, null);

    // Draw the points
    gl.drawArrays(gl.POINTS, 0, n);
}
  • The basic idea is to bind a buffer, then write into it, write into another, rinse, lather repeat until all the buffers (or whichever ones you pick) are updated. Then tell WebGL to go draw all the buffers. Here’s an example:
  • points
  • Starting on textures.