-
Notifications
You must be signed in to change notification settings - Fork 0
/
luma-gl.html
48 lines (43 loc) · 1.08 KB
/
luma-gl.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<link rel="import" href="../polymer/polymer.html">
<dom-module id="luma-gl">
<script>
Polymer({
is: 'deck-gl',
properties: {
loaded: Boolean,
canvas: Object,
gl: {
type: Object,
notify: true,
readonly: true
},
vertexShader: {
type: String
},
fragmentShader: {
type: String
},
program: {
type: Object,
computed: '_initProgram(vertexShader, fragmentShader)'
}
},
attached: function() {
var self = this;
var script = document.createElement('script');
script.src = '../node_modules/luma.gl/dist/lumagl.min.js';
script.onload = function() {
self.loaded = true;
self.gl = LumaGL.createGLContext({canvas: self.canvas});
};
this.appendChild(script);
},
_initProgram: function(vertexShader, fragmentShader) {
return new Program(gl, {
vs: vertexShader,
fs: fragmentShader
});
}
});
</script>
</dom-module>