I want to use spector.js metadata API to simplify debugging of a WebGL application compiled from C++ using emscripten. Spector.js API expects JavaScript WebGLBuffer objects created via WebGL API. The question is how to get them from the C++ side which operates with raw OpenGL handles. I see two options:
- Provide gl buffer handles to js via emscripten C++<->JS API and create WebGL objects from them somehow
- Create WebGLBufers on the js side and provide handles to C++ via C++<->JS API
Problem with the first option is that I can't find a way to create a WebGLBuffer from a raw OpenGL buffer handle. Problem with the second option is that I don't see any way to get a raw gl buffer handle from the js WebGLBuffer object to forward it to the C++ code.
Maybe there are also other options?