我正在製作一個WebGL程序,需要gl函數glGenVertexArrays和glBindVertexArrays。有人知道在WebGL中是否有這些相同的東西?這是我到目前爲止:是否有與glGenVertexArrays和glBindVertexArrays等價的WebGL?
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