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

Method initFBOLayerGL

core/src/processing/opengl/PJOGL.java:321–354  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

initFBOLayerMethod · 0.95

Calls 9

readBufferMethod · 0.95
bindFramebufferImplMethod · 0.95
framebufferTexture2DMethod · 0.95
drawBufferMethod · 0.95
blitFramebufferMethod · 0.95
isLoopingMethod · 0.80
hasReadBufferMethod · 0.80
hasDrawBufferMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected