Hi,
There was a similar requirement in our app. And this is what I did.
Although I am not sure if this is the official way or if there are any
better way to do it.
1) Added method to Module["getNewId"] = function() {...} to a new JS file
call it EmscriptenExtension.js
2) Link this JS file using em_link_post_js
3) This would make getNewId available to the Module object, that you
receive as an argument, upon instantiating the Wasm.
Hope this helps.
On Tuesday, August 25, 2020 at 5:09:37 PM UTC+5:30 [email protected] wrote:
> Hi,
> My app is using the Module.GL.getNewId function in order to create handles
> to WebGL textures, This is done so that I'll be able to load the textures
> on the JS side, and use them via OpenGL APIs in WASM. We want to start
> building with MODULARIZE=1, but this hides the GL object in the Module's
> closure.
> I know that this can be fixed with post-js operations, but I'd like to
> have a solution that is less likely to be broken by future versions of
> Emscripten, so I want to open a PR that will fix this situation. I see 3
> possible solutions:
> 1. Expose the GL object as-is on the Module.
> 2. Expose a wrapper to the getNewId function, and a matching function that
> allows removal of said handle.
> 3. Add to the module a JS function that returns a pair - a WebGL texture,
> and its OpenGL handle, and a matching function to remove said handle.
>
> Are any of these ideas worth pursuing? Anything I might be missing?
>
>
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/emscripten-discuss/115207d8-284d-4d37-b164-d4851fdb1d70n%40googlegroups.com.