------------------------------------------------------------------------------
| 1780 | |
| 1781 | //------------------------------------------------------------------------------ |
| 1782 | void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::EndImageSample(vtkRenderer* ren) |
| 1783 | { |
| 1784 | if (this->Parent->ImageSampleDistance != 1.f) |
| 1785 | { |
| 1786 | this->ImageSampleFBO->DeactivateDrawBuffers(); |
| 1787 | if (this->RenderPassAttached) |
| 1788 | { |
| 1789 | this->ImageSampleFBO->ActivateDrawBuffers( |
| 1790 | static_cast<unsigned int>(this->NumImageSampleDrawBuffers)); |
| 1791 | } |
| 1792 | vtkOpenGLRenderWindow* win = static_cast<vtkOpenGLRenderWindow*>(ren->GetRenderWindow()); |
| 1793 | win->GetState()->PopDrawFramebufferBinding(); |
| 1794 | |
| 1795 | // Render the contents of ImageSampleFBO as a quad to intermix with the |
| 1796 | // rest of the scene. |
| 1797 | typedef vtkOpenGLRenderUtilities GLUtil; |
| 1798 | |
| 1799 | if (this->RebuildImageSampleProg) |
| 1800 | { |
| 1801 | std::string frag = GLUtil::GetFullScreenQuadFragmentShaderTemplate(); |
| 1802 | |
| 1803 | vtkShaderProgram::Substitute(frag, "//VTK::FSQ::Decl", |
| 1804 | vtkvolume::ImageSampleDeclarationFrag( |
| 1805 | this->ImageSampleTexNames, this->NumImageSampleDrawBuffers)); |
| 1806 | vtkShaderProgram::Substitute(frag, "//VTK::FSQ::Impl", |
| 1807 | vtkvolume::ImageSampleImplementationFrag( |
| 1808 | this->ImageSampleTexNames, this->NumImageSampleDrawBuffers)); |
| 1809 | |
| 1810 | this->ImageSampleProg = |
| 1811 | win->GetShaderCache()->ReadyShaderProgram(GLUtil::GetFullScreenQuadVertexShader().c_str(), |
| 1812 | frag.c_str(), GLUtil::GetFullScreenQuadGeometryShader().c_str()); |
| 1813 | } |
| 1814 | else |
| 1815 | { |
| 1816 | win->GetShaderCache()->ReadyShaderProgram(this->ImageSampleProg); |
| 1817 | } |
| 1818 | |
| 1819 | if (!this->ImageSampleProg) |
| 1820 | { |
| 1821 | vtkGenericWarningMacro(<< "Failed to initialize ImageSampleProgram!"); |
| 1822 | return; |
| 1823 | } |
| 1824 | |
| 1825 | if (!this->ImageSampleVAO) |
| 1826 | { |
| 1827 | this->ImageSampleVAO = vtkOpenGLVertexArrayObject::New(); |
| 1828 | GLUtil::PrepFullScreenVAO(win, this->ImageSampleVAO, this->ImageSampleProg); |
| 1829 | } |
| 1830 | |
| 1831 | vtkOpenGLState* ostate = win->GetState(); |
| 1832 | |
| 1833 | // Adjust the GL viewport to VTK's defined viewport |
| 1834 | ren->GetTiledSizeAndOrigin( |
| 1835 | this->WindowSize, this->WindowSize + 1, this->WindowLowerLeft, this->WindowLowerLeft + 1); |
| 1836 | ostate->vtkglViewport( |
| 1837 | this->WindowLowerLeft[0], this->WindowLowerLeft[1], this->WindowSize[0], this->WindowSize[1]); |
| 1838 | |
| 1839 | // Bind objects and draw |
no test coverage detected