MCPcopy Index your code
hub / github.com/benfry/processing4 / beginRender

Method beginRender

core/src/processing/opengl/PGL.java:736–805  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

734
735
736 protected void beginRender() {
737 if (sketch == null) {
738 sketch = graphics.parent;
739 }
740
741 pgeomCount = geomCount;
742 geomCount = 0;
743
744 pclearColor = clearColor;
745 clearColor = false;
746
747 pclearDepth = clearDepth;
748 clearDepth = false;
749
750 pclearStencil = clearStencil;
751 clearStencil = false;
752
753 if (SINGLE_BUFFERED && sketch.frameCount == 1) {
754 restoreFirstFrame();
755 }
756
757 if (fboLayerEnabledReq) {
758 fboLayerEnabled = true;
759 fboLayerEnabledReq = false;
760 }
761
762 if (fboLayerEnabled) {
763 if (fbolayerResetReq) {
764 destroyFBOLayer();
765 fbolayerResetReq = false;
766 }
767 if (!fboLayerCreated) {
768 createFBOLayer();
769 }
770
771 // Draw to the back texture
772 bindFramebufferImpl(FRAMEBUFFER, glColorFbo.get(0));
773 framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0,
774 TEXTURE_2D, glColorTex.get(backTex), 0);
775
776 if (1 < numSamples) {
777 bindFramebufferImpl(FRAMEBUFFER, glMultiFbo.get(0));
778 }
779
780 if (sketch.frameCount == 0) {
781 // No need to draw back color buffer because we are in the first frame.
782 int argb = graphics.backgroundColor;
783 float ba = ((argb >> 24) & 0xff) / 255.0f;
784 float br = ((argb >> 16) & 0xff) / 255.0f;
785 float bg = ((argb >> 8) & 0xff) / 255.0f;
786 float bb = ((argb) & 0xff) / 255.0f;
787 clearColor(br, bg, bb, ba);
788 clear(COLOR_BUFFER_BIT);
789 } else if (!pclearColor || !sketch.isLooping()) {
790 // Render previous back texture (now is the front) as background,
791 // because no background() is being used ("incremental drawing")
792 int x = 0;
793 int y = 0;

Callers 2

beginOnscreenDrawMethod · 0.80
displayMethod · 0.80

Calls 11

restoreFirstFrameMethod · 0.95
destroyFBOLayerMethod · 0.95
createFBOLayerMethod · 0.95
bindFramebufferImplMethod · 0.95
framebufferTexture2DMethod · 0.95
clearColorMethod · 0.95
clearMethod · 0.95
getPixelScaleMethod · 0.95
drawTextureMethod · 0.95
isLoopingMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected