MCPcopy Index your code
hub / github.com/processing/processing / initFBOLayerGL

Method initFBOLayerGL

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

Source from the content-addressed store, hash-verified

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