------------------------------------------------------------------------------
| 1779 | |
| 1780 | //------------------------------------------------------------------------------ |
| 1781 | bool vtkOpenGLRenderWindow::ReadDepthComponent(int depthSize) |
| 1782 | { |
| 1783 | bool readDepthBuffer = false; |
| 1784 | if (!this->DepthReadQuad) |
| 1785 | { |
| 1786 | std::string shader = DepthReadShader; |
| 1787 | std::ostringstream os; |
| 1788 | os << "int depthSize = " << depthSize << ';'; |
| 1789 | vtkShaderProgram::Substitute(shader, "//VTK::DepthSize::Impl", os.str()); |
| 1790 | this->DepthReadQuad = new vtkOpenGLQuadHelper(this, nullptr, shader.c_str(), ""); |
| 1791 | if (!this->DepthReadQuad->Program || !this->DepthReadQuad->Program->GetCompiled()) |
| 1792 | { |
| 1793 | vtkErrorMacro("Couldn't build the shader program for reading depth component."); |
| 1794 | } |
| 1795 | } |
| 1796 | else |
| 1797 | { |
| 1798 | this->GetShaderCache()->ReadyShaderProgram(this->DepthReadQuad->Program); |
| 1799 | } |
| 1800 | |
| 1801 | if (this->DepthReadQuad->Program && this->DepthReadQuad->Program->GetCompiled()) |
| 1802 | { |
| 1803 | auto ostate = this->GetState(); |
| 1804 | vtkOpenGLState::ScopedglEnableDisable depthTestSaver(ostate, GL_DEPTH_TEST); |
| 1805 | ostate->vtkglDisable(GL_DEPTH_TEST); |
| 1806 | vtkOpenGLState::ScopedglEnableDisable blendSaver(ostate, GL_BLEND); |
| 1807 | ostate->vtkglDisable(GL_BLEND); |
| 1808 | auto tex = this->GetBufferNeedsResolving() |
| 1809 | ? this->ResolveFramebuffer->GetDepthAttachmentAsTextureObject() |
| 1810 | : this->RenderFramebuffer->GetDepthAttachmentAsTextureObject(); |
| 1811 | tex->Activate(); |
| 1812 | this->DepthReadQuad->Program->SetUniformi("tex", tex->GetTextureUnit()); |
| 1813 | this->DepthReadQuad->Render(); |
| 1814 | tex->Deactivate(); |
| 1815 | readDepthBuffer = true; |
| 1816 | } |
| 1817 | |
| 1818 | return readDepthBuffer; |
| 1819 | } |
| 1820 | |
| 1821 | //------------------------------------------------------------------------------ |
| 1822 | void vtkOpenGLRenderWindow::BlitDisplayFramebuffersToHardware() |
no test coverage detected