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

Function ClearBuffers

Rendering/LICOpenGL2/vtkLineIntegralConvolution2D.cxx:250–294  ·  view source on GitHub ↗

Description: Clear all the buffers used for writing.

Source from the content-addressed store, hash-verified

248 // Description:
249 // Clear all the buffers used for writing.
250 void ClearBuffers(vtkOpenGLFramebufferObject* fbo, const vtkPixelExtent& viewExt,
251 const deque<vtkPixelExtent>& extents, int clearEETex = 0)
252 {
253 vtkOpenGLState* ostate = fbo->GetContext()->GetState();
254
255 // attach
256 fbo->AddColorAttachment(0U, this->LICTexture0);
257 fbo->AddColorAttachment(1U, this->SeedTexture0);
258 fbo->AddColorAttachment(2U, this->LICTexture1);
259 fbo->AddColorAttachment(3U, this->SeedTexture1);
260 unsigned int num = 4U;
261 if (clearEETex)
262 {
263 fbo->AddColorAttachment(4U, this->EETexture);
264 num = 5U;
265 }
266 fbo->ActivateDrawBuffers(num);
267 DEBUG3CheckFrameBufferStatusMacro(GL_DRAW_FRAMEBUFFER);
268
269 // clear the parts of the screen which we will modify
270 // initially mask all fragments
271 ostate->vtkglClearColor(0.0, 1.0, 0.0, 0.0);
272 ostate->vtkglEnable(GL_SCISSOR_TEST);
273 size_t nBlocks = extents.size();
274 for (size_t e = 0; e < nBlocks; ++e)
275 {
276 vtkPixelExtent ext = extents[e];
277 // add halo for linear filtering
278 // since at most linear filtering requires
279 // 4 pixels , clearing an extra 4 here
280 // ensures we never access uninitialized
281 // memory.
282 ext.Grow(4);
283 ext &= viewExt;
284
285 unsigned int extSize[2];
286 ext.Size(extSize);
287
288 ostate->vtkglScissor(ext[0], ext[2], extSize[0], extSize[1]);
289 ostate->vtkglClear(GL_COLOR_BUFFER_BIT);
290 }
291 ostate->vtkglDisable(GL_SCISSOR_TEST);
292 fbo->RemoveColorAttachments(num);
293 fbo->DeactivateDrawBuffers();
294 }
295
296 // Description:
297 // Clear the given buffer

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