From d9bb507322969811ca456fc14cec5c52126ba778 Mon Sep 17 00:00:00 2001 From: 1chandu Date: Tue, 4 Jun 2019 10:39:01 -0700 Subject: [PATCH] Fix deprecation and texture in lesson 16 (#1141) --- examples/core/transform/app.js | 8 ++++---- examples/lessons/16/app.js | 3 ++- modules/webgl/src/classes/vertex-array.js | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/core/transform/app.js b/examples/core/transform/app.js index c8fb2edf11..5cb2d5797f 100644 --- a/examples/core/transform/app.js +++ b/examples/core/transform/app.js @@ -270,8 +270,8 @@ export default class AppAnimationLoop extends AnimationLoop { const offsetBuffer = transform.getBuffer('v_offset'); const rotationBuffer = transform.getBuffer('v_rotation'); - offsetBuffer.updateAccessor({divisor: 1}); - rotationBuffer.updateAccessor({divisor: 1}); + offsetBuffer.setAccessor({divisor: 1}); + rotationBuffer.setAccessor({divisor: 1}); renderModel.clear({color: [0.0, 0.0, 0.0, 1.0], depth: true}); renderModel.draw({ @@ -285,8 +285,8 @@ export default class AppAnimationLoop extends AnimationLoop { } }); - offsetBuffer.updateAccessor({divisor: 0}); - rotationBuffer.updateAccessor({divisor: 0}); + offsetBuffer.setAccessor({divisor: 0}); + rotationBuffer.setAccessor({divisor: 0}); if (pickPosition) { const dpr = useDevicePixels ? getDevicePixelRatio() : 1; diff --git a/examples/lessons/16/app.js b/examples/lessons/16/app.js index 19e964a719..d07525536c 100644 --- a/examples/lessons/16/app.js +++ b/examples/lessons/16/app.js @@ -208,7 +208,7 @@ export default class AppAnimationLoop extends AnimationLoop { }); const tCrate = new Texture2D(gl, { - urls: 'crate.gif', + data: 'crate.gif', parameters: { [gl.TEXTURE_MAG_FILTER]: gl.LINEAR, [gl.TEXTURE_MIN_FILTER]: gl.LINEAR_MIPMAP_NEAREST @@ -243,6 +243,7 @@ export default class AppAnimationLoop extends AnimationLoop { }); const cube = new ModelNode(gl, { + id: 'cube-model', geometry: new CubeGeometry(), vs: VERTEX_SHADER, fs: FRAGMENT_SHADER, diff --git a/modules/webgl/src/classes/vertex-array.js b/modules/webgl/src/classes/vertex-array.js index 6c37616675..f19857fdee 100644 --- a/modules/webgl/src/classes/vertex-array.js +++ b/modules/webgl/src/classes/vertex-array.js @@ -219,7 +219,7 @@ export default class VertexArray { // so we need to offer and unbind facility // WebGL offers disabling, but no clear way to set a VertexArray buffer to `null` // So we just bind all the attributes to the dummy "attribute zero" buffer - this.buffer = this.buffer || new Buffer(this.gl, {size: 4}); + this.buffer = this.buffer || new Buffer(this.gl, {accessor: {size: 4}}); for (let location = 0; location < this.vertexArrayObject.MAX_ATTRIBUTES; location++) { if (this.values[location] instanceof Buffer) {