MCPcopy Index your code
hub / github.com/processing/processing / endRender

Method endRender

core/src/processing/opengl/PGL.java:767–862  ·  view source on GitHub ↗
(int windowColor)

Source from the content-addressed store, hash-verified

765
766
767 protected void endRender(int windowColor) {
768 if (fboLayerEnabled) {
769 syncBackTexture();
770
771 // Draw the contents of the back texture to the screen framebuffer.
772 bindFramebufferImpl(FRAMEBUFFER, 0);
773
774 if (presentMode) {
775 float wa = ((windowColor >> 24) & 0xff) / 255.0f;
776 float wr = ((windowColor >> 16) & 0xff) / 255.0f;
777 float wg = ((windowColor >> 8) & 0xff) / 255.0f;
778 float wb = (windowColor & 0xff) / 255.0f;
779 clearDepth(1);
780 clearColor(wr, wg, wb, wa);
781 clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
782
783 if (showStopButton) {
784 if (closeButtonTex == null) {
785 closeButtonTex = allocateIntBuffer(1);
786 genTextures(1, closeButtonTex);
787 bindTexture(TEXTURE_2D, closeButtonTex.get(0));
788 texParameteri(TEXTURE_2D, TEXTURE_MIN_FILTER, NEAREST);
789 texParameteri(TEXTURE_2D, TEXTURE_MAG_FILTER, NEAREST);
790 texParameteri(TEXTURE_2D, TEXTURE_WRAP_S, CLAMP_TO_EDGE);
791 texParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE);
792 texImage2D(TEXTURE_2D, 0, RGBA, stopButtonWidth, stopButtonHeight, 0, RGBA, UNSIGNED_BYTE, null);
793
794 int[] color = new int[closeButtonPix.length];
795 PApplet.arrayCopy(closeButtonPix, color);
796
797
798 // Multiply the texture by the button color
799 float ba = ((stopButtonColor >> 24) & 0xFF) / 255f;
800 float br = ((stopButtonColor >> 16) & 0xFF) / 255f;
801 float bg = ((stopButtonColor >> 8) & 0xFF) / 255f;
802 float bb = ((stopButtonColor >> 0) & 0xFF) / 255f;
803 for (int i = 0; i < color.length; i++) {
804 int c = closeButtonPix[i];
805 int a = (int)(ba * ((c >> 24) & 0xFF));
806 int r = (int)(br * ((c >> 16) & 0xFF));
807 int g = (int)(bg * ((c >> 8) & 0xFF));
808 int b = (int)(bb * ((c >> 0) & 0xFF));
809 color[i] = javaToNativeARGB((a << 24) | (r << 16) | (g << 8) | b);
810 }
811 IntBuffer buf = allocateIntBuffer(color);
812 copyToTexture(TEXTURE_2D, RGBA, closeButtonTex.get(0), 0, 0, stopButtonWidth, stopButtonHeight, buf);
813 bindTexture(TEXTURE_2D, 0);
814 }
815 drawTexture(TEXTURE_2D, closeButtonTex.get(0), stopButtonWidth, stopButtonHeight,
816 0, 0, stopButtonX + stopButtonWidth, closeButtonY + stopButtonHeight,
817 0, stopButtonHeight, stopButtonWidth, 0,
818 stopButtonX, closeButtonY, stopButtonX + stopButtonWidth, closeButtonY + stopButtonHeight);
819 }
820 } else {
821 clearDepth(1);
822 clearColor(0, 0, 0, 0);
823 clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
824 }

Callers 2

endOnscreenDrawMethod · 0.80
displayMethod · 0.80

Calls 15

syncBackTextureMethod · 0.95
bindFramebufferImplMethod · 0.95
clearDepthMethod · 0.95
clearColorMethod · 0.95
clearMethod · 0.95
allocateIntBufferMethod · 0.95
genTexturesMethod · 0.95
bindTextureMethod · 0.95
texParameteriMethod · 0.95
texImage2DMethod · 0.95
arrayCopyMethod · 0.95
javaToNativeARGBMethod · 0.95

Tested by

no test coverage detected