diff --git a/preview/index.html b/preview/index.html index ac5bedefcc..d87cbcaf86 100644 --- a/preview/index.html +++ b/preview/index.html @@ -20,25 +20,28 @@ import p5 from '../src/app.js'; const sketch = function (p) { - let g, f; + let g, f,s,fragSrc; p.setup = function () { p.createCanvas(200, 200); g = p.createGraphics(200, 200); f = p.createGraphics(200, 200, p.WEBGL); - }; - - p.draw = function () { - p.background(0, 50, 50); - p.circle(100, 100, 50); - - p.fill('white'); - p.textSize(30); - p.text('hello', 10, 30); - - // f.fill('red'); - f.sphere(); - p.image(f, 0, 0); + fragSrc = ` + precision highp float; + void main() { + gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0); + }`; + s = p.createFilterShader(fragSrc); + p.fill('red'); + p.rect(0,0,100,100) + p.filter(s); + p.filter(p.POSTERIZE, 64); + // p.filter(p.POSTERIZE,64); + // p.filter(s); + }; + + p.draw = function () { + p.image(f,0,0); }; }; diff --git a/test/unit/webgl/p5.RendererGL.js b/test/unit/webgl/p5.RendererGL.js index 8fd8b0fa06..5843e36d2f 100644 --- a/test/unit/webgl/p5.RendererGL.js +++ b/test/unit/webgl/p5.RendererGL.js @@ -412,18 +412,6 @@ suite('p5.RendererGL', function() { assert.doesNotThrow(testDefaultParams, 'this should not throw'); }); - test('filter() uses WEBGL implementation behind main P2D canvas', function() { - let renderer = myp5.createCanvas(3,3); - myp5.filter(myp5.BLUR); - assert.isDefined(renderer.filterGraphicsLayer); - }); - - test('filter() can opt out of WEBGL implementation', function() { - let renderer = myp5.createCanvas(3,3); - myp5.filter(myp5.BLUR, false); - assert.isUndefined(renderer.filterGraphicsLayer); - }); - test('filters make changes to canvas', function() { myp5.createCanvas(20,20); myp5.circle(10,10,12);