exception thrown: TypeError: Object doesn't support property or method 'createVertexArray' (emscripten)

exception thrown: TypeError: Object doesn't support property or method 'createVertexArray' (emscripten)

我创建了一个简单的 SDL2 和 Opengl ES2 演示。它适用于 Chrome 和 Firefox,但在 Edge 中我收到此错误:

exception thrown: TypeError: Object doesn't support property or method 'createVertexArray'

抛出异常的C++代码:

// Create Vertex Array Object
GLuint vao;
glGenVertexArraysOES(1, &vao);
glBindVertexArrayOES(vao);

是我的错,还是Edge浏览器或Emscripten的bug?

如果您打开控制台并输入

document.createElement('canvas').getContext("webgl").getSupportedExtensions();

它打印什么?

可能边不支持 OES_vertex_array_object extension

这里有一个 polyfill

https://github.com/greggman/oes-vertex-array-object-polyfill