Skip to content

Commit

Permalink
Fix deprecation and texture in lesson 16 (#1141)
Browse files Browse the repository at this point in the history
  • Loading branch information
1chandu committed Jun 4, 2019
1 parent 761e84b commit d9bb507
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions examples/core/transform/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion examples/lessons/16/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion modules/webgl/src/classes/vertex-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d9bb507

Please sign in to comment.