Hey everyone,
I wanted to ask if anyone of you knows a possibility to have the capability of defining accessors of Objects inside the javascript side.
Why am I asking?
For my V8GL environment, I have the glut bindings in place. That means they are available inside the javascript context via:
glut.get(glut.WINDOW_WIDTH);
Now I want to emulate the WebGL API on top of the usual GL/GLES/GLUT stuff. But, for example, I want to offer the glut functionality wrapped with JavaScript polyfills. I think that this is the best way to get there to not having obsolete or duplicated code on the C++ side.
For example, I wanted to do something like this:
var Window = function(width, height) {
};
Window.__SETACCESSOR('x', function() {
glut.get(glut.WINDOW_X);
});
I know that on the native side, you can use setAccessor() on templates, but I don't know if there's a possibility to offer the same functionality here on the javascript side somehow via extending the native Object in JS or something.
Does anyone of you have a clue where to start or if that is possible?
Thanks!
Christoph