[vtkusers] Reusing of vtkOpenGLGPUVolumeRayCastMapper...

AGPX agpxnet at yahoo.it
Wed Jun 16 06:01:28 EDT 2010


Ok,

it not the assert that fails. The variable Context is invalid, it still point to the old destroyed object. This happen because we never change the Context of the class vtkShaderProgram2 to the new render window. That is the code:


void vtkOpenGLGPUVolumeRayCastMapper::BuildProgram(vtkRenderWindow *w,
                                                   int parallelProjection,
                                                   int raycastMethod,
                                                   int shadeMethod,
                                                   int componentMethod)
{

  assert("pre: valid_raycastMethod" &&
         raycastMethod>= vtkOpenGLGPUVolumeRayCastMapperMethodMIP
         && raycastMethod<=vtkOpenGLGPUVolumeRayCastMapperMethodAdditive);

  if(this->Program==0)
    {
    this->Program=vtkShaderProgram2::New();
    this->Program->SetContext(static_cast<vtkOpenGLRenderWindow *>(w));
    }
...
}

The Program variable isn't 0 and so the new context will never be setup. How I can solve this?



________________________________
Da: AGPX <agpxnet at yahoo.it>
A: vtk vtk <vtkusers at vtk.org>
Inviato: Mer 16 giugno 2010, 10:40:35
Oggetto: [vtkusers] Reusing of vtkOpenGLGPUVolumeRayCastMapper...


Hello,

I have a vtkOpenGLGPUVolumeRayCastMapper that I have previously used with another actor, renderer and render window. I wish to reuse it (creating a new actor, renderer and renderwindow), but I obtain an assert error:

// ----------------------------------------------------------------------------
// Description:
// Use the shader program.
// It saves the current shader program or fixed-pipeline in use.
// It also set the uniform variables.
void vtkShaderProgram2::Use()
{
  assert("pre: context_is_set" && this->Context!=0);
  assert("pre: current_context_matches" && this->Context->IsCurrent());      <---------------- Fail here!
  this->Build();

....

Look like that the context isn't current. There's a way to "reset" the mapper internal state? Note that the volume data input is the same, so I wish to reuse the mapper in order to avoid the very slow initialization (especially the gradients computation). Any hints?

Thanks in advance.


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100616/98cc8b29/attachment.htm>


More information about the vtkusers mailing list