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

Method begin

src/webgl/p5.Framebuffer.js:763–787  ·  view source on GitHub ↗

* Begins drawing shapes to the framebuffer. * * `myBuffer.begin()` and myBuffer.end() * allow shapes to be drawn to the framebuffer. `myBuffer.begin()` begins * drawing to the framebuffer and * myBuffer.end() stops

()

Source from the content-addressed store, hash-verified

761 * }
762 */
763 begin() {
764 this.prevFramebuffer = this.renderer.activeFramebuffer();
765 if (this.prevFramebuffer) {
766 this.prevFramebuffer._beforeEnd();
767 }
768 this.renderer.activeFramebuffers.push(this);
769 this._beforeBegin();
770 this.renderer.push();
771 // Apply the framebuffer's camera. This does almost what
772 // RendererGL.reset() does, but this does not try to clear any buffers;
773 // it only sets the camera.
774 // this.renderer.setCamera(this.defaultCamera);
775 this.renderer.states.setValue('curCamera', this.defaultCamera);
776 // set the projection matrix (which is not normally updated each frame)
777 this.renderer.states.setValue('uPMatrix', this.renderer.states.uPMatrix.clone());
778 this.renderer.states.uPMatrix.set(this.defaultCamera.projMatrix);
779 this.renderer.states.setValue('uViewMatrix', this.renderer.states.uViewMatrix.clone());
780 this.renderer.states.uViewMatrix.set(this.defaultCamera.cameraMatrix);
781
782 this.renderer.resetMatrix();
783 this.renderer.states.uViewMatrix
784 .set(this.renderer.states.curCamera.cameraMatrix);
785 this.renderer.states.uModelMatrix.reset();
786 this.renderer._applyStencilTestIfClipping();
787 }
788
789 /**
790 * When making a p5.Framebuffer active so that it may be drawn to, this method

Callers 15

drawMethod · 0.95
drawFunction · 0.80
drawFunction · 0.80
p5.Framebuffer.jsFile · 0.80
p5.Shader.jsFile · 0.80
p5.RendererGL.jsFile · 0.80
maskFunction · 0.80
p5.Shader.jsFile · 0.80
webgpu.jsFile · 0.80
webgl.jsFile · 0.80
strandsFunction · 0.80

Calls 10

_beforeBeginMethod · 0.95
activeFramebufferMethod · 0.80
_beforeEndMethod · 0.80
pushMethod · 0.45
setValueMethod · 0.45
cloneMethod · 0.45
setMethod · 0.45
resetMatrixMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected