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

Method SetupDepthPass

Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx:1995–2060  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1993
1994//------------------------------------------------------------------------------
1995void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::SetupDepthPass(vtkRenderer* ren)
1996{
1997 if (this->Parent->ImageSampleDistance != 1.f)
1998 {
1999 this->WindowSize[0] /= this->Parent->ImageSampleDistance;
2000 this->WindowSize[1] /= this->Parent->ImageSampleDistance;
2001 }
2002
2003 if ((this->LastDepthPassWindowSize[0] != this->WindowSize[0]) ||
2004 (this->LastDepthPassWindowSize[1] != this->WindowSize[1]))
2005 {
2006 this->LastDepthPassWindowSize[0] = this->WindowSize[0];
2007 this->LastDepthPassWindowSize[1] = this->WindowSize[1];
2008 this->ReleaseDepthPassGraphicsResources(ren->GetRenderWindow());
2009 }
2010
2011 if (!this->DPFBO)
2012 {
2013 this->DPFBO = vtkOpenGLFramebufferObject::New();
2014 }
2015
2016 vtkOpenGLRenderWindow* renWin = vtkOpenGLRenderWindow::SafeDownCast(ren->GetRenderWindow());
2017 this->DPFBO->SetContext(renWin);
2018
2019 renWin->GetState()->PushFramebufferBindings();
2020 this->DPFBO->Bind();
2021 this->DPFBO->InitializeViewport(this->WindowSize[0], this->WindowSize[1]);
2022
2023 if (!this->DPDepthBufferTextureObject || !this->DPColorTextureObject)
2024 {
2025 this->DPDepthBufferTextureObject = vtkTextureObject::New();
2026 this->DPDepthBufferTextureObject->SetContext(renWin);
2027 this->DPDepthBufferTextureObject->AllocateDepth(
2028 this->WindowSize[0], this->WindowSize[1], vtkTextureObject::Native);
2029 this->DPDepthBufferTextureObject->Activate();
2030 this->DPDepthBufferTextureObject->SetMinificationFilter(vtkTextureObject::Nearest);
2031 this->DPDepthBufferTextureObject->SetMagnificationFilter(vtkTextureObject::Nearest);
2032 this->DPDepthBufferTextureObject->SetAutoParameters(0);
2033 this->DPDepthBufferTextureObject->Bind();
2034
2035 this->DPColorTextureObject = vtkTextureObject::New();
2036
2037 this->DPColorTextureObject->SetContext(renWin);
2038 this->DPColorTextureObject->Create2D(
2039 this->WindowSize[0], this->WindowSize[1], 4, VTK_UNSIGNED_CHAR, false);
2040 this->DPColorTextureObject->Activate();
2041 this->DPColorTextureObject->SetMinificationFilter(vtkTextureObject::Nearest);
2042 this->DPColorTextureObject->SetMagnificationFilter(vtkTextureObject::Nearest);
2043 this->DPColorTextureObject->SetAutoParameters(0);
2044
2045 this->DPFBO->AddDepthAttachment(this->DPDepthBufferTextureObject);
2046
2047 this->DPFBO->AddColorAttachment(0U, this->DPColorTextureObject);
2048 }
2049
2050 this->DPFBO->ActivateDrawBuffers(1);
2051 this->DPFBO->CheckFrameBufferStatus(GL_FRAMEBUFFER);
2052

Callers 1

RenderContourPassMethod · 0.95

Calls 15

InitializeViewportMethod · 0.80
AllocateDepthMethod · 0.80
Create2DMethod · 0.80
AddDepthAttachmentMethod · 0.80
AddColorAttachmentMethod · 0.80
vtkglClearColorMethod · 0.80
vtkglClearMethod · 0.80
vtkglEnableMethod · 0.80
NewFunction · 0.50
GetRenderWindowMethod · 0.45

Tested by

no test coverage detected