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

Method AllocateDepth

Rendering/OpenGL2/vtkTextureObject.cxx:1786–1839  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1784
1785//------------------------------------------------------------------------------
1786bool vtkTextureObject::AllocateDepth(unsigned int width, unsigned int height, int internalFormat)
1787{
1788 assert("pre: context_exists" && this->GetContext() != nullptr);
1789 assert(
1790 "pre: valid_internalFormat" && internalFormat >= 0 && internalFormat < NumberOfDepthFormats);
1791
1792#ifdef glTexImage2DMultisample
1793 this->Target = (this->Samples ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D);
1794#else
1795 this->Target = GL_TEXTURE_2D;
1796#endif
1797
1798 this->Format = GL_DEPTH_COMPONENT;
1799
1800 // Try to match vtk type to internal fmt
1801 if (!this->Type)
1802 {
1803 this->Type = OpenGLDepthInternalFormatType[internalFormat];
1804 }
1805
1806 if (!this->InternalFormat)
1807 {
1808 this->InternalFormat = OpenGLDepthInternalFormat[internalFormat];
1809 }
1810
1811 this->Width = width;
1812 this->Height = height;
1813 this->Depth = 1;
1814 this->NumberOfDimensions = 2;
1815 this->Components = 1;
1816
1817 this->Context->ActivateTexture(this);
1818 this->CreateTexture();
1819 this->Bind();
1820
1821#ifdef glTexImage2DMultisample
1822 if (this->Samples)
1823 {
1824 glTexImage2DMultisample(this->Target, this->Samples, static_cast<GLint>(this->InternalFormat),
1825 static_cast<GLsizei>(this->Width), static_cast<GLsizei>(this->Height), GL_TRUE);
1826 }
1827 else
1828#endif
1829 {
1830 glTexImage2D(this->Target, 0, static_cast<GLint>(this->InternalFormat),
1831 static_cast<GLsizei>(this->Width), static_cast<GLsizei>(this->Height), 0, this->Format,
1832 this->Type, nullptr);
1833 }
1834
1835 vtkOpenGLCheckErrorMacro("failed at glTexImage2D");
1836
1837 this->Deactivate();
1838 return true;
1839}
1840
1841bool vtkTextureObject::AllocateDepthStencil(unsigned int width, unsigned int height)
1842{

Callers 15

RenderMethod · 0.80
RenderMethod · 0.80
RenderMethod · 0.80
RenderMethod · 0.80
RenderMethod · 0.80
PopulateFramebufferMethod · 0.80
SetupBuffersMethod · 0.80
CaptureDepthTextureMethod · 0.80

Calls 6

GetContextMethod · 0.95
BindMethod · 0.95
DeactivateMethod · 0.95
assertFunction · 0.50
ActivateTextureMethod · 0.45
CreateTextureMethod · 0.45

Tested by

no test coverage detected