Skip to content

Commit

Permalink
Merge pull request #5555 from aferriss/webgl-alpha-false
Browse files Browse the repository at this point in the history
Changes webGL alpha buffer to false.
  • Loading branch information
stalgiag authored Jan 20, 2022
2 parents ef17670 + 43d8fa8 commit 0f577f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/webgl/p5.RendererGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ p5.RendererGL.prototype._setAttributeDefaults = function(pInst) {
// See issue #3850, safer to enable AA in Safari
const applyAA = navigator.userAgent.toLowerCase().includes('safari');
const defaults = {
alpha: true,
alpha: false,
depth: true,
stencil: true,
antialias: applyAA,
Expand Down Expand Up @@ -345,7 +345,7 @@ p5.RendererGL.prototype._resetContext = function(options, callback) {
* The available attributes are:
* <br>
* alpha - indicates if the canvas contains an alpha buffer
* default is true
* default is false
*
* depth - indicates whether the drawing buffer has a depth buffer
* of at least 16 bits - default is true
Expand Down
12 changes: 6 additions & 6 deletions test/unit/webgl/p5.RendererGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ suite('p5.RendererGL', function() {
pg.clear();
myp5.image(pg, -myp5.width / 2, -myp5.height / 2);
pixel = myp5.get(0, 0);
assert.deepEqual(pixel, [0, 255, 255, 255]);
assert.deepEqual(pixel, [0, 0, 0, 255]);
done();
});

Expand All @@ -356,7 +356,7 @@ suite('p5.RendererGL', function() {
pg.background(100, 100, 100, 100);
myp5.image(pg, -myp5.width / 2, -myp5.height / 2);
pixel = myp5.get(0, 0);
assert.deepEqual(pixel, [39, 194, 194, 194]);
assert.deepEqual(pixel, [100, 100, 100, 255]);
done();
});

Expand All @@ -378,7 +378,7 @@ suite('p5.RendererGL', function() {
pg.clear();
myp5.image(pg, 0, 0);
pixel = myp5.get(0, 0);
assert.deepEqual(pixel, [0, 255, 255, 255]);
assert.deepEqual(pixel, [0, 0, 0, 255]);
done();
});

Expand All @@ -389,7 +389,7 @@ suite('p5.RendererGL', function() {
pg.background(100, 100, 100, 100);
myp5.image(pg, 0, 0);
pixel = myp5.get(0, 0);
assert.deepEqual(pixel, [39, 194, 194, 255]);
assert.deepEqual(pixel, [100, 100, 100, 255]);
done();
});
});
Expand Down Expand Up @@ -437,8 +437,8 @@ suite('p5.RendererGL', function() {
test('blendModes change pixel colors as expected', function(done) {
myp5.createCanvas(10, 10, myp5.WEBGL);
myp5.noStroke();
assert.deepEqual([133, 69, 191, 158], mixAndReturn(myp5.ADD, 255));
assert.deepEqual([0, 0, 255, 122], mixAndReturn(myp5.REPLACE, 255));
assert.deepEqual([133, 69, 191, 255], mixAndReturn(myp5.ADD, 255));
assert.deepEqual([0, 0, 255, 255], mixAndReturn(myp5.REPLACE, 255));
assert.deepEqual([133, 255, 133, 255], mixAndReturn(myp5.SUBTRACT, 255));
assert.deepEqual([255, 0, 255, 255], mixAndReturn(myp5.SCREEN, 0));
assert.deepEqual([0, 255, 0, 255], mixAndReturn(myp5.EXCLUSION, 255));
Expand Down

0 comments on commit 0f577f1

Please sign in to comment.