How to add 3d context works in JsBridge by adding WebGLRenderingContext?

非 Y 不嫁゛ 提交于 2019-12-25 09:05:21

问题


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:

  1. For UWP, the first step is to get OpenGL ES for c# to work through the Microsoft Angle
  2. Using the OpenGL ES C# interface to develop WebGL4UWP libraries and then test that with WebGL examples.
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!