MCPcopy
hub / github.com/processing/p5.js / testDepthGetsCleared

Function testDepthGetsCleared

test/unit/webgl/p5.RendererGL.js:1306–1323  ·  view source on GitHub ↗
(target)

Source from the content-addressed store, hash-verified

1304 }
1305
1306 function testDepthGetsCleared(target) {
1307 target.pixelDensity(1);
1308 target.noStroke();
1309 target.fill(255, 0, 0);
1310 target.plane(target.width, target.height);
1311 assertAllPixelsAreColor(target, 255, 0, 0, 255);
1312
1313 target.background(255);
1314 target.push();
1315 target.translate(0, 0, -10); // Move farther away
1316 target.fill(0, 0, 255);
1317 // expanded to fill the screen
1318 target.plane(target.width * 4, target.height * 4);
1319 target.pop();
1320 // The farther-away plane should not be occluded because we cleared
1321 // the screen with background()
1322 assertAllPixelsAreColor(target, 0, 0, 255, 255);
1323 }
1324
1325 test('background() resets the depth buffer of the main canvas', function() {
1326 myp5.createCanvas(10, 10, myp5.WEBGL);

Callers 1

p5.RendererGL.jsFile · 0.85

Calls 8

assertAllPixelsAreColorFunction · 0.85
noStrokeMethod · 0.80
pixelDensityMethod · 0.45
fillMethod · 0.45
backgroundMethod · 0.45
pushMethod · 0.45
translateMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected