MCPcopy Create free account
hub / github.com/Kitware/VTK / ClearBuffer

Function ClearBuffer

Rendering/LICOpenGL2/vtkLineIntegralConvolution2D.cxx:298–334  ·  view source on GitHub ↗

Description: Clear the given buffer

Source from the content-addressed store, hash-verified

296 // Description:
297 // Clear the given buffer
298 void ClearBuffer(vtkOpenGLFramebufferObject* fbo, vtkTextureObject* tex,
299 const vtkPixelExtent& viewExt, const deque<vtkPixelExtent>& extents)
300 {
301 vtkOpenGLState* ostate = fbo->GetContext()->GetState();
302
303 // attach
304 fbo->AddColorAttachment(0U, tex);
305 fbo->ActivateDrawBuffers(1);
306 DEBUG3CheckFrameBufferStatusMacro(GL_DRAW_FRAMEBUFFER);
307
308 // clear the parts of the screen which we will modify
309 // initially mask all fragments
310 ostate->vtkglClearColor(0.0, 1.0, 0.0, 0.0);
311 ostate->vtkglEnable(GL_SCISSOR_TEST);
312 size_t nBlocks = extents.size();
313 for (size_t e = 0; e < nBlocks; ++e)
314 {
315 vtkPixelExtent ext = extents[e];
316 // add halo for linear filtering
317 // since at most linear filtering requires
318 // 4 pixels , clearing an extra 4 here
319 // ensures we never access uninitialized
320 // memory.
321 ext.Grow(4);
322 ext &= viewExt;
323
324 unsigned int extSize[2];
325 ext.Size(extSize);
326
327 ostate->vtkglScissor(ext[0], ext[2], extSize[0], extSize[1]);
328 ostate->vtkglClear(GL_COLOR_BUFFER_BIT);
329 }
330 ostate->vtkglDisable(GL_SCISSOR_TEST);
331 // detach
332 fbo->RemoveColorAttachments(1);
333 fbo->DeactivateDrawBuffers();
334 }
335
336 // Description:
337 // Activates the input textures. These are read only.

Callers

nothing calls this directly

Calls 14

AddColorAttachmentMethod · 0.80
vtkglClearColorMethod · 0.80
vtkglEnableMethod · 0.80
vtkglScissorMethod · 0.80
vtkglClearMethod · 0.80
vtkglDisableMethod · 0.80
DeactivateDrawBuffersMethod · 0.80
GetStateMethod · 0.45
GetContextMethod · 0.45
ActivateDrawBuffersMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected