Sup*_*tar 4 html5 opengl-es webgl
我正在制作一个WebGL程序,需要GL函数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
Run Code Online (Sandbox Code Playgroud)
仅在实现OES_vertex_array_object扩展时.
但是,您不需要这些功能.没有它们你可以做得很好.在渲染网格(或一组网格或其他)之前,您只需绑定缓冲区并使用glVertexAttribPointer及其同类.