@@ -761,7 +761,7 @@ protected void endDraw(boolean clear, int windowColor) {
761761 int temp = frontTex ;
762762 frontTex = backTex ;
763763 backTex = temp ;
764- } else if (!clear && pg .parent .frameCount == 1 ) {
764+ } else if (!clear && 0 < pg .parent .frameCount || ! pg . parent . isLooping () ) {
765765 requestFBOLayer ();
766766 }
767767 }
@@ -884,18 +884,32 @@ private void createFBOLayer() {
884884 if (0 < pg .parent .frameCount ) {
885885 // Copy the contents of the front and back screen buffers to the textures
886886 // of the FBO, so they are properly initialized.
887- bindFramebufferImpl (READ_FRAMEBUFFER , BACK );
887+ if (pg .parent .isLooping ()) {
888+ bindFramebufferImpl (READ_FRAMEBUFFER , FRONT );
889+ readBuffer (FRONT );
890+ } else {
891+ bindFramebufferImpl (READ_FRAMEBUFFER , BACK );
892+ readBuffer (BACK );
893+ }
888894 bindFramebufferImpl (DRAW_FRAMEBUFFER , glColorFbo .get (0 ));
889895 framebufferTexture2D (FRAMEBUFFER , COLOR_ATTACHMENT0 ,
890896 TEXTURE_2D , glColorTex .get (backTex ), 0 );
897+ drawBuffer (COLOR_ATTACHMENT0 );
891898 blitFramebuffer (0 , 0 , fboWidth , fboHeight ,
892899 0 , 0 , fboWidth , fboHeight ,
893900 COLOR_BUFFER_BIT , NEAREST );
894901
895- bindFramebufferImpl (READ_FRAMEBUFFER , FRONT );
902+ if (pg .parent .isLooping ()) {
903+ bindFramebufferImpl (READ_FRAMEBUFFER , BACK );
904+ readBuffer (BACK );
905+ } else {
906+ bindFramebufferImpl (READ_FRAMEBUFFER , FRONT );
907+ readBuffer (FRONT );
908+ }
896909 bindFramebufferImpl (DRAW_FRAMEBUFFER , glColorFbo .get (0 ));
897910 framebufferTexture2D (FRAMEBUFFER , COLOR_ATTACHMENT0 ,
898911 TEXTURE_2D , glColorTex .get (frontTex ), 0 );
912+ drawBuffer (COLOR_ATTACHMENT0 );
899913 blitFramebuffer (0 , 0 , fboWidth , fboHeight ,
900914 0 , 0 , fboWidth , fboHeight ,
901915 COLOR_BUFFER_BIT , NEAREST );
0 commit comments