Skip to content

Commit

Permalink
Get rid of WebGL warning
Browse files Browse the repository at this point in the history
This fixes sirxemic#40
  • Loading branch information
sirxemic committed Sep 5, 2017
1 parent 5e0f49b commit ca11051
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ var Ripples = function (el, options) {
this.bufferWriteIndex = 0;
this.bufferReadIndex = 1;

var textureData = new Float32Array(this.resolution * this.resolution * 4);

for (var i = 0; i < 2; i++) {
var texture = gl.createTexture();
var framebuffer = gl.createFramebuffer();
Expand All @@ -271,7 +273,7 @@ var Ripples = function (el, options) {
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, config.linearSupport ? gl.LINEAR : gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.resolution, this.resolution, 0, gl.RGBA, config.type, null);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, this.resolution, this.resolution, 0, gl.RGBA, config.type, textureData);

gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);

Expand Down

0 comments on commit ca11051

Please sign in to comment.