如何通过添加WebGLRenderingContext在JsBridge中添加3d上下文?

时间:2016-09-02 11:04:03

标签: c# opengl-es three.js webgl chakra

目前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 example

任何人都可以提供基于JsBridge和Microsoft Chakra opengl示例的建议,如何开始编写WebGLRenderingContext.cs?

2016年9月14日修订 使ChakraBridge与WebGl.js或派生框架一起工作,例如Three.js,需要解决多个差距以定位WebGL 3D上下文:

  1. 对于UWP,第一步是让OpenGL ES让c#通过Microsoft Angle
  2. 使用OpenGL ES C#接口开发WebGL4UWP库,然后使用WebGL示例进行测试。
  3. 然后将(b)带到ChakraBridge以解决启动该项目的问题是可行的。

0 个答案:

没有答案