This is largely undocumented. From reading what documentation there is, I was under the impression that all that is needed is to set Module.preinitializedWebGLContext prior to creating the module. However it appears that you also need to do
Module.GL.makeContextCurrent(Module.GL.createContext(null, { majorVersion: 2.0 }));
in the then() method when Module is created. Until I did that I was getting GLctx undefined errors.
So you could just as easily skip Module.preinitializedWebGLContext and pass the WebGL context to Module.GL.createContext instead of the null I have shown here.
Am I missing something, i.e. doing something wrong, or is Module.preinitializedWebGLContext essentially useless?
By the way the Embind documentation really needs to say more about creating Modules. The noddy example didn’t help me at all in the case of creating a class binding.
Regards
-Mark