()
| 319 | |
| 320 | |
| 321 | private void initFBOLayerGL() { |
| 322 | // Copy the contents of the front and back screen buffers to the textures |
| 323 | // of the FBO, so they are properly initialized. Note that the front buffer |
| 324 | // of the default framebuffer (the screen) contains the previous frame: |
| 325 | // https://www.opengl.org/wiki/Default_Framebuffer |
| 326 | // so it is copied to the front texture of the FBO layer: |
| 327 | if (pclearColor || 0 < pgeomCount || !sketch.isLooping()) { |
| 328 | if (hasReadBuffer()) readBuffer(FRONT); |
| 329 | } else { |
| 330 | // ...except when the previous frame has not been cleared and nothing was |
| 331 | // rendered while looping. In this case the back buffer, which holds the |
| 332 | // initial state of the previous frame, still contains the most up-to-date |
| 333 | // screen state. |
| 334 | readBuffer(BACK); |
| 335 | } |
| 336 | bindFramebufferImpl(DRAW_FRAMEBUFFER, glColorFbo.get(0)); |
| 337 | framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0, |
| 338 | TEXTURE_2D, glColorTex.get(frontTex), 0); |
| 339 | if (hasDrawBuffer()) drawBuffer(COLOR_ATTACHMENT0); |
| 340 | blitFramebuffer(0, 0, fboWidth, fboHeight, |
| 341 | 0, 0, fboWidth, fboHeight, |
| 342 | COLOR_BUFFER_BIT, NEAREST); |
| 343 | |
| 344 | readBuffer(BACK); |
| 345 | bindFramebufferImpl(DRAW_FRAMEBUFFER, glColorFbo.get(0)); |
| 346 | framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0, |
| 347 | TEXTURE_2D, glColorTex.get(backTex), 0); |
| 348 | drawBuffer(COLOR_ATTACHMENT0); |
| 349 | blitFramebuffer(0, 0, fboWidth, fboHeight, |
| 350 | 0, 0, fboWidth, fboHeight, |
| 351 | COLOR_BUFFER_BIT, NEAREST); |
| 352 | |
| 353 | bindFramebufferImpl(FRAMEBUFFER, 0); |
| 354 | } |
| 355 | |
| 356 | |
| 357 | @Override |
no test coverage detected