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

Method GetZbufferData

Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx:2515–2644  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2513
2514//------------------------------------------------------------------------------
2515int vtkOpenGLRenderWindow::GetZbufferData(int x1, int y1, int x2, int y2, float* z_data)
2516{
2517 int y_low;
2518 int x_low;
2519 int width, height;
2520
2521 // set the current window
2522 this->MakeCurrent();
2523
2524 if (y1 < y2)
2525 {
2526 y_low = y1;
2527 }
2528 else
2529 {
2530 y_low = y2;
2531 }
2532
2533 if (x1 < x2)
2534 {
2535 x_low = x1;
2536 }
2537 else
2538 {
2539 x_low = x2;
2540 }
2541
2542 width = abs(x2 - x1) + 1;
2543 height = abs(y2 - y1) + 1;
2544
2545 // Error checking
2546 // Must clear previous errors first.
2547 while (glGetError() != GL_NO_ERROR)
2548 {
2549 }
2550
2551 this->GetState()->vtkglDisable(GL_SCISSOR_TEST);
2552
2553 // Calling pack alignment ensures that we can grab the any size window
2554 this->GetState()->vtkglPixelStorei(GL_PACK_ALIGNMENT, 1);
2555
2556 this->GetState()->PushReadFramebufferBinding();
2557
2558 this->RenderFramebuffer->Bind(GL_READ_FRAMEBUFFER);
2559 this->RenderFramebuffer->ActivateReadBuffer(0);
2560
2561 // Let's determine if we're reading from an FBO.
2562 bool resolveMSAA = this->GetBufferNeedsResolving();
2563
2564 if (resolveMSAA)
2565 {
2566 this->GetState()->PushDrawFramebufferBinding();
2567 int* fbsize = this->RenderFramebuffer->GetLastSize();
2568 this->ResolveFramebuffer->Resize(fbsize[0], fbsize[1]);
2569 this->ResolveFramebuffer->Bind(GL_DRAW_FRAMEBUFFER);
2570
2571 // Now blit to resolve the MSAA and get an anti-aliased rendering in
2572 // resolvedFBO.

Callers

nothing calls this directly

Calls 15

GetDepthBufferSizeMethod · 0.95
ReadDepthComponentMethod · 0.95
vtkglDisableMethod · 0.80
vtkglPixelStoreiMethod · 0.80
ActivateReadBufferMethod · 0.80
vtkglBlitFramebufferMethod · 0.80
ActivateDrawBufferMethod · 0.80
vtkglViewportMethod · 0.80

Tested by

no test coverage detected