on eef3a4b help sign in
52 lines 1.5 kB history raw
1Elm.Native.Graphics.WebGL = {};
2Elm.Native.Graphics.WebGL.make = function(elm) {
4 elm.Native = elm.Native || {};
5 elm.Native.Graphics = elm.Native.Graphics || {};
6 elm.Native.Graphics.WebGL = elm.Native.Graphics.WebGL || {};
7 if (elm.Native.Graphics.WebGL.values) return elm.Native.Graphics.WebGL.values;
9 //var Render = ElmRuntime.use(ElmRuntime.Render.Element);
10 var newNode = ElmRuntime.use(ElmRuntime.Render.Utils).newElement;
12 //var Signal = Elm.Signal.make(elm);
13 var newElement = Elm.Graphics.Element.make(elm).newElement;
14 //var JS = Elm.Native.JavaScript.make(elm);
15 //var Utils = Elm.Native.Utils.make(elm);
16 //var Tuple2 = Utils.Tuple2;
18 function glContext(w,h,scene) {
20 function drawGL(ctx,model) {
21 throw "Not implemented"
22 }
24 function render(model) {
25 var canvas = newNode('canvas');
26 gl = canvas.getContext("webgl");
27 drawGL(gl,model);
28 return canvas;
29 }
31 function update(canvasNode, _oldModel, newModel) {
32 gl = canvasNode.getContext("webgl");
33 drawGL(gl,newModel)
34 }
36 return function (scene) {
37 return A3(newElement, 100, 40, {
38 ctor: 'Custom',
39 type: 'WebGL',
40 render: render,
41 update: update,
42 model: scene,
43 });
44 }
46 }
48 return elm.Native.Graphics.Input.values = {
49 glContext:glContext,
50 };
52};