Reputation: 1329
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:
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?
Upvotes: 0
Views: 213
Reputation:
Augment the emscripten library. The WebGLObjects are tracked right here
For example
javascriptWebGLBuffer = $GL.buffers[openGLBufferId];
openglBufferId = $GL.buffers.indexOf(javascriptWebGLBuffer);
also see _glGenObject
and its usage on how to generate a new WebGLBuffer for both JavaScript and C++
You can plugin spector in that file.
You can use --js-library path-to-file
to use your modified library to use it
Upvotes: 2