Skip to content

Commit

Permalink
Avoid using the same cache variable for different passes
Browse files Browse the repository at this point in the history
The cache variable LastWindowSize was used for checking whether
RenderToImage FBO needs to be updated as well as for checking
whether DepthPass FBO needs to be updated. If both the modes were
used together, the depth pass updates the cache value and never
lets RenderToImage mode update its FBO.
  • Loading branch information
sankhesh committed May 18, 2016
1 parent acd0c91 commit c7e852a
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx
Expand Up @@ -116,7 +116,9 @@ class vtkOpenGLGPUVolumeRayCastMapper::vtkInternal
this->TextureSize[0] = this->TextureSize[1] = this->TextureSize[2] = -1;
this->WindowLowerLeft[0] = this->WindowLowerLeft[1] = 0;
this->WindowSize[0] = this->WindowSize[1] = 0;
this->LastWindowSize[0] = this->LastWindowSize[1] = 0;
this->LastDepthPassWindowSize[0] = this->LastDepthPassWindowSize[1] = 0;
this->LastRenderToImageWindowSize[0] = 0;
this->LastRenderToImageWindowSize[1] = 0;
this->ScalarsRange[0][0] = this->ScalarsRange[0][1] = 0.0;
this->ScalarsRange[1][0] = this->ScalarsRange[1][1] = 0.0;
this->ScalarsRange[2][0] = this->ScalarsRange[2][1] = 0.0;
Expand Down Expand Up @@ -382,7 +384,8 @@ class vtkOpenGLGPUVolumeRayCastMapper::vtkInternal
int TextureSize[3];
int WindowLowerLeft[2];
int WindowSize[2];
int LastWindowSize[2];
int LastDepthPassWindowSize[2];
int LastRenderToImageWindowSize[2];

double ScalarsRange[4][2];
double LoadedBounds[6];
Expand Down Expand Up @@ -2214,11 +2217,11 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::SetupRenderToTexture(
{
if (this->Parent->RenderToImage && this->Parent->CurrentPass == RenderPass)
{
if ( (this->LastWindowSize[0] != this->WindowSize[0]) ||
(this->LastWindowSize[1] != this->WindowSize[1]) )
if ( (this->LastRenderToImageWindowSize[0] != this->WindowSize[0]) ||
(this->LastRenderToImageWindowSize[1] != this->WindowSize[1]) )
{
this->LastWindowSize[0] = this->WindowSize[0];
this->LastWindowSize[1] = this->WindowSize[1];
this->LastRenderToImageWindowSize[0] = this->WindowSize[0];
this->LastRenderToImageWindowSize[1] = this->WindowSize[1];
this->ReleaseRenderToTextureGraphicsResources(ren->GetRenderWindow());
}

Expand Down Expand Up @@ -2342,11 +2345,11 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::ExitRenderToTexture(
void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::SetupDepthPass(
vtkRenderer* ren)
{
if ( (this->LastWindowSize[0] != this->WindowSize[0]) ||
(this->LastWindowSize[1] != this->WindowSize[1]) )
if ( (this->LastDepthPassWindowSize[0] != this->WindowSize[0]) ||
(this->LastDepthPassWindowSize[1] != this->WindowSize[1]) )
{
this->LastWindowSize[0] = this->WindowSize[0];
this->LastWindowSize[1] = this->WindowSize[1];
this->LastDepthPassWindowSize[0] = this->WindowSize[0];
this->LastDepthPassWindowSize[1] = this->WindowSize[1];
this->ReleaseDepthPassGraphicsResources(ren->GetRenderWindow());
}

Expand Down

0 comments on commit c7e852a

Please sign in to comment.