on master help sign in
initial file
commiteef3a4bb95bc531e5967b25f56585e7a0d97d262 authorJohn P Mayer Jr <john.p.mayer.jr@gmail.com> dateMon 11 Nov 2013, 14:09 (13 years ago) parent4b480a9
1 file changed+52
libraries/Native/Graphics/WebGL.js+52
libraries/Native/Graphics/WebGL.jsnew file+52
@@ -0,0 +1,52 @@
1+Elm.Native.Graphics.WebGL = {};
2+Elm.Native.Graphics.WebGL.make = function(elm) {
3+
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;
8+
9+ //var Render = ElmRuntime.use(ElmRuntime.Render.Element);
10+ var newNode = ElmRuntime.use(ElmRuntime.Render.Utils).newElement;
11+
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;
17+
18+ function glContext(w,h,scene) {
19+
20+ function drawGL(ctx,model) {
21+ throw "Not implemented"
22+ }
23+
24+ function render(model) {
25+ var canvas = newNode('canvas');
26+ gl = canvas.getContext("webgl");
27+ drawGL(gl,model);
28+ return canvas;
29+ }
30+
31+ function update(canvasNode, _oldModel, newModel) {
32+ gl = canvasNode.getContext("webgl");
33+ drawGL(gl,newModel)
34+ }
35+
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+ }
45+
46+ }
47+
48+ return elm.Native.Graphics.Input.values = {
49+ glContext:glContext,
50+ };
51+
52+};