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

Method endRender

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

Source from the content-addressed store, hash-verified

806
807
808 protected void endRender(int windowColor) {
809 if (fboLayerEnabled) {
810 syncBackTexture();
811
812 // Draw the contents of the back texture to the screen framebuffer.
813 bindFramebufferImpl(FRAMEBUFFER, 0);
814
815 if (presentMode) {
816 float wa = ((windowColor >> 24) & 0xff) / 255.0f;
817 float wr = ((windowColor >> 16) & 0xff) / 255.0f;
818 float wg = ((windowColor >> 8) & 0xff) / 255.0f;
819 float wb = (windowColor & 0xff) / 255.0f;
820 clearDepth(1);
821 clearColor(wr, wg, wb, wa);
822 clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
823
824 if (showStopButton) {
825 if (closeButtonTex == null) {
826 closeButtonTex = allocateIntBuffer(1);
827 genTextures(1, closeButtonTex);
828 bindTexture(TEXTURE_2D, closeButtonTex.get(0));
829 texParameteri(TEXTURE_2D, TEXTURE_MIN_FILTER, NEAREST);
830 texParameteri(TEXTURE_2D, TEXTURE_MAG_FILTER, NEAREST);
831 texParameteri(TEXTURE_2D, TEXTURE_WRAP_S, CLAMP_TO_EDGE);
832 texParameteri(TEXTURE_2D, TEXTURE_WRAP_T, CLAMP_TO_EDGE);
833 texImage2D(TEXTURE_2D, 0, RGBA, stopButtonWidth, stopButtonHeight, 0, RGBA, UNSIGNED_BYTE, null);
834
835 int[] color = new int[closeButtonPix.length];
836 PApplet.arrayCopy(closeButtonPix, color);
837
838
839 // Multiply the texture by the button color
840 float ba = ((stopButtonColor >> 24) & 0xFF) / 255f;
841 float br = ((stopButtonColor >> 16) & 0xFF) / 255f;
842 float bg = ((stopButtonColor >> 8) & 0xFF) / 255f;
843 float bb = (stopButtonColor & 0xFF) / 255f;
844 for (int i = 0; i < color.length; i++) {
845 int c = closeButtonPix[i];
846 int a = (int)(ba * ((c >> 24) & 0xFF));
847 int r = (int)(br * ((c >> 16) & 0xFF));
848 int g = (int)(bg * ((c >> 8) & 0xFF));
849 int b = (int)(bb * (c & 0xFF));
850 color[i] = javaToNativeARGB((a << 24) | (r << 16) | (g << 8) | b);
851 }
852 IntBuffer buf = allocateIntBuffer(color);
853 copyToTexture(TEXTURE_2D, RGBA, closeButtonTex.get(0), 0, 0, stopButtonWidth, stopButtonHeight, buf);
854 bindTexture(TEXTURE_2D, 0);
855 }
856 drawTexture(TEXTURE_2D, closeButtonTex.get(0), stopButtonWidth, stopButtonHeight,
857 0, 0, stopButtonX + stopButtonWidth, closeButtonY + stopButtonHeight,
858 0, stopButtonHeight, stopButtonWidth, 0,
859 stopButtonX, closeButtonY, stopButtonX + stopButtonWidth, closeButtonY + stopButtonHeight);
860 }
861 } else {
862 clearDepth(1);
863 clearColor(0, 0, 0, 0);
864 clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
865 }

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