@@ -923,45 +923,12 @@ private void createFBOLayer() {
923
923
clear (DEPTH_BUFFER_BIT | STENCIL_BUFFER_BIT | COLOR_BUFFER_BIT );
924
924
925
925
bindFramebufferImpl (FRAMEBUFFER , 0 );
926
-
927
- if (0 < sketch .frameCount ) {
928
- // Copy the contents of the front and back screen buffers to the textures
929
- // of the FBO, so they are properly initialized. Note that the front buffer
930
- // of the default framebuffer (the screen) contains the previous frame:
931
- // https://www.opengl.org/wiki/Default_Framebuffer
932
- // so it is copied to the front texture of the FBO layer:
933
- if (pclearColor || 0 < pgeomCount || !sketch .isLooping ()) {
934
- readBuffer (FRONT );
935
- } else {
936
- // ...except when the previous frame has not been cleared and nothing was
937
- // renderered while looping. In this case the back buffer, which holds the
938
- // initial state of the previous frame, still contains the most up-to-date
939
- // screen state.
940
- readBuffer (BACK );
941
- }
942
- bindFramebufferImpl (DRAW_FRAMEBUFFER , glColorFbo .get (0 ));
943
- framebufferTexture2D (FRAMEBUFFER , COLOR_ATTACHMENT0 ,
944
- TEXTURE_2D , glColorTex .get (frontTex ), 0 );
945
- drawBuffer (COLOR_ATTACHMENT0 );
946
- blitFramebuffer (0 , 0 , fboWidth , fboHeight ,
947
- 0 , 0 , fboWidth , fboHeight ,
948
- COLOR_BUFFER_BIT , NEAREST );
949
-
950
- readBuffer (BACK );
951
- bindFramebufferImpl (DRAW_FRAMEBUFFER , glColorFbo .get (0 ));
952
- framebufferTexture2D (FRAMEBUFFER , COLOR_ATTACHMENT0 ,
953
- TEXTURE_2D , glColorTex .get (backTex ), 0 );
954
- drawBuffer (COLOR_ATTACHMENT0 );
955
- blitFramebuffer (0 , 0 , fboWidth , fboHeight ,
956
- 0 , 0 , fboWidth , fboHeight ,
957
- COLOR_BUFFER_BIT , NEAREST );
958
-
959
- bindFramebufferImpl (FRAMEBUFFER , 0 );
960
- }
926
+ initFBOLayer ();
961
927
962
928
fboLayerCreated = true ;
963
929
}
964
930
931
+ protected abstract void initFBOLayer ();
965
932
966
933
protected void destroyFBOLayer () {
967
934
if (threadIsCurrent () && fboLayerCreated ) {
0 commit comments