目前JsBridge只支持 getContext("2d") 而不是 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;
}
理想情况下,要使 JsBridge 支持 3D,需要
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;
}
我的猜测是我们需要编写一个新类 WebGLRenderingContext.cs 以使 JsBridge 与例如 three.js 一起工作?
Microsoft Chakra github 有OpenGL 示例
任何人都可以提供基于 JsBridge 和 Microsoft Chakra opengl 示例的建议,如何开始编写 WebGLRenderingContext.cs?
2016 年 9 月 14 日修订 为了使 ChakraBridge 与 WebGl.js 或派生框架(例如 Three.js)一起工作,需要解决多个差距以针对 WebGL 3D 上下文:
- 对于 UWP,第一步是通过 Microsoft Angle 让 c# 的 OpenGL ES 工作
- 使用 OpenGL ES C# 接口开发 WebGL4UWP 库,然后使用 WebGL 示例对其进行测试。
- 然后将 (b) 带到 ChakraBridge 来解决启动这个项目的问题是可行的。