()
| 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; |
no test coverage detected