Example #1
0
 //------------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------------
 public WebGLGraphics(CanvasElementGl canvas)
 {
     this._canvas = canvas;
     this._context = canvas.GetContext("experimental-webgl", new WebGLContextAttributes());
 }
Example #2
0
 public ShaderLoader(WebGL gl)
 {
     this._gl = gl;
 }
Example #3
0
        public PhongBinder(Library library, WebGL graphics, ShaderGroup parent)
        {
            if(parent == null)
                throw new Exception("Parent cannot be null");
            if (graphics == null)
                throw new Exception("Graphics cannot be null");
            if (library == null)
                throw new Exception("Library cannot be null");

            this._library = library;
            this._graphics = graphics;
            this._parent = parent;

            this._vertexBuffer = this._graphics.CreateBuffer();
            this._graphics.BindBuffer(WebGLE.ArrayBuffer, _vertexBuffer);
            float[] vertices = SystemCore.Environment.CreateFloat32ArrayFromArray(new float[] {
                1.0f, 1.0f, 0.0f,
                -1.0f, 1.0f, 0.0f,
                1.0f, -1.0f, 0.0f,
                -1.0f, -1.0f, 0.0f
            });
            this._graphics.BufferData(WebGLE.ArrayBuffer, vertices, WebGLE.StaticDraw);
        }