I'm making a WebGL program and require the GL functions glGenVertexArrays and glBindVertexArrays. Does anybody know if there is an equivalent of these in WebGL? Here's what I have so far:
canvas = document.getElementById("WEB_GL_CANVAS");//Specify the viewing window
gl = WebGLUtils.setupWebGL(canvas);
if (!gl)
alert("WebGL isn't available");
gl.viewport(0, 0, canvas.width, canvas.height);
{
var color = getRandomColor();
gl.clearColor((color[0] / 2) + 0.5, (color[1] / 2) + 0.5, (color[2] / 2) + 0.5, 1);
}
gl.enable(gl.DEPTH_TEST);
// Create a vertex array object
GLuint vao;
gl.genVertexArrays( 1, &vao );//Won't work
gl.bindVertexArray( vao );//Need a WebGL version
Only if the OES_vertex_array_object extension is implemented.
However, you don't need these functions. You can do just fine without them. You just have to bind your buffers and use glVertexAttribPointer and its ilk before you render a mesh (or set of meshes, or whatever).