问题
Currently JsBridge supports only getContext("2d") and not getContext("webgl").
public object getContext(string contextType)
{
if (contextType == "2d") {
if (this.context == null) {
this.context = new CanvasRenderingContext2D(this.window, this);
}
return this.context;
}
return null;
}
Ideally, to make JsBridge supports 3D, one needs
public object getContext(string contextType)
{
if (contextType == "2d") {
if (this.context == null) {
this.context = new CanvasRenderingContext2D(this.window, this);
}
return this.context;
}
else if (contextType == "experimental-webgl" || contextType == "webgl")
{
if (this.context == null)
{
this.context = new WebGLRenderingContext(this.window, this);
}
return this.context;
}
return null;
}
My guess is that We needs to code a new class WebGLRenderingContext.cs to make JsBridge works with e.g. three.js ?
The Microsoft Chakra github has OpenGL example
Anyone can provides suggestion based on JsBridge and the Microsoft Chakra opengl example, how to start coding the WebGLRenderingContext.cs?
Revision 14th Sept 2016 To make ChakraBridge to work with WebGl.js or derived framework e.g. Three.js, one needs to address multiple gaps to target WebGL 3D context:
- For UWP, the first step is to get OpenGL ES for c# to work through the Microsoft Angle
- Using the OpenGL ES C# interface to develop WebGL4UWP libraries and then test that with WebGL examples.
- Then it is feasible to bring (b) to ChakraBridge to address the question which started this project.
来源:https://stackoverflow.com/questions/39290861/how-to-add-3d-context-works-in-jsbridge-by-adding-webglrenderingcontext