Skip to content

Commit

Permalink
Low level examples IE
Browse files Browse the repository at this point in the history
  • Loading branch information
tsherif committed Dec 18, 2019
1 parent f9209c8 commit 7362639
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 32 deletions.
19 changes: 4 additions & 15 deletions examples/getting-started/external-context/app.js
@@ -1,4 +1,5 @@
/* global window, requestAnimationFrame, cancelAnimationFrame */
import 'core-js';
import {Model} from '@luma.gl/engine';
import {Buffer, clear} from '@luma.gl/webgl';
import {instrumentGLContext} from '@luma.gl/gltools';
Expand All @@ -15,13 +16,9 @@ export default class AppAnimationLoop extends MiniAnimationLoop {

start(props) {
const canvas = this._getCanvas(props);

this.isDemoSupported = Boolean(canvas.getContext('webgl'));
if (!this.isDemoSupported) {
return;
}

const gl = instrumentGLContext(canvas.getContext('webgl'));
const gl = instrumentGLContext(
canvas.getContext('webgl') || canvas.getContext('experimental-webgl')
);
gl.clearColor(0, 0, 0, 1);

const positionBuffer = new Buffer(gl, new Float32Array([-0.5, -0.5, 0.5, -0.5, 0.0, 0.5]));
Expand Down Expand Up @@ -78,18 +75,10 @@ export default class AppAnimationLoop extends MiniAnimationLoop {
}

stop() {
if (!this.isDemoSupported) {
return;
}

cancelAnimationFrame(this.resources.rafHandle);
}

delete() {
if (!this.isDemoSupported) {
return;
}

const {positionBuffer, colorBuffer, model} = this.resources;
positionBuffer.delete();
colorBuffer.delete();
Expand Down
3 changes: 2 additions & 1 deletion examples/getting-started/external-context/package.json
Expand Up @@ -7,7 +7,8 @@
"dependencies": {
"@luma.gl/gltools": "^8.0.0-alpha.9",
"@luma.gl/webgl": "^8.0.0-alpha.9",
"@luma.gl/engine": "^8.0.0-alpha.9"
"@luma.gl/engine": "^8.0.0-alpha.9",
"core-js": "^3.5.0"
},
"devDependencies": {
"html-webpack-plugin": "^3.2.0",
Expand Down
17 changes: 2 additions & 15 deletions examples/getting-started/shader-modules-low/app.js
@@ -1,4 +1,5 @@
/* global window, requestAnimationFrame, cancelAnimationFrame */
import 'core-js';
import {assembleShaders} from '@luma.gl/shadertools';
import {MiniAnimationLoop} from '../../utils';

Expand Down Expand Up @@ -43,13 +44,7 @@ export default class AppAnimationLoop extends MiniAnimationLoop {

start(props) {
const canvas = this._getCanvas(props);

this.isDemoSupported = Boolean(canvas.getContext('webgl'));
if (!this.isDemoSupported) {
return;
}

const gl = canvas.getContext('webgl');
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
gl.clearColor(0, 0, 0, 1);

// Program 1
Expand Down Expand Up @@ -144,18 +139,10 @@ export default class AppAnimationLoop extends MiniAnimationLoop {
}

stop() {
if (!this.isDemoSupported) {
return;
}

cancelAnimationFrame(this.resources.rafHandle);
}

delete() {
if (!this.isDemoSupported) {
return;
}

const {gl, positionBuffer, program1, program2} = this.resources;
gl.deleteBuffer(positionBuffer);
gl.deleteProgram(program1);
Expand Down
3 changes: 2 additions & 1 deletion examples/getting-started/shader-modules-low/package.json
Expand Up @@ -7,7 +7,8 @@
"dependencies": {
"@luma.gl/engine": "^8.0.0-alpha.9",
"@luma.gl/gltools": "^8.0.0-alpha.9",
"@luma.gl/shadertools": "^8.0.0-alpha.9"
"@luma.gl/shadertools": "^8.0.0-alpha.9",
"core-js": "^3.5.0"
},
"devDependencies": {
"html-webpack-plugin": "^3.2.0",
Expand Down

0 comments on commit 7362639

Please sign in to comment.