[vtkusers] Reusing of vtkOpenGLGPUVolumeRayCastMapper...
AGPX
agpxnet at yahoo.it
Thu Jun 17 06:09:37 EDT 2010
Hi,
I mean that (as far as I understand from VTK source code) by design you cannot change the render window of a (at least) volume mapper because once the shader program is loaded and the context is setup by the following code:
...
if(this->Program==0)
{
this->Program=vtkShaderProgram2::New();
this->Program->SetContext(static_cast<vtkOpenGLRenderWindow
*>(w));
}
...
the Program->SetContext is never called again because the object Program will be never destroyed (this->Program is always != 0) for the entire life of the mapper. So, I cannot reuse a mapper with (and only with) a new render window. This is a serious problem. There's no way to destroy the shader program inside the mapper?
P.S.: The gradients are computed on-the-fly? That's a really good thing, I haven't noticed this. So probably the slow initialization (few seconds is too much for my purposes) is due to volume upload in video memory card? (512x512x416 16 bit).
________________________________
Da: Francois Bertel <francois.bertel at kitware.com>
A: vtk vtk <vtkusers at vtk.org>
Inviato: Mer 16 giugno 2010, 16:51:44
Oggetto: Re: [vtkusers] Reusing of vtkOpenGLGPUVolumeRayCastMapper...
A side note: you are talking about a very slow initialization due to
the gradients computation. But there is no gradient precomputation for
the vtkOpenGLGPUVolumeRayCastMapper. It is done on-the-fly during
rendering.
On Wed, Jun 16, 2010 at 10:48 AM, Francois Bertel
<francois.bertel at kitware.com> wrote:
> Hello,
>
> Please post a minimal example to reproduce the problem.
>
> Regards.
>
> On Wed, Jun 16, 2010 at 6:01 AM, AGPX <agpxnet at yahoo.it> wrote:
>> 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.
>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
>
>
> --
> François Bertel, PhD | Kitware Inc. Suite 204
> 1 (518) 371 3971 x113 | 28 Corporate Drive
> | Clifton Park NY 12065, USA
>
--
François Bertel, PhD | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
| Clifton Park NY 12065, USA
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100617/be2447cc/attachment.htm>
More information about the vtkusers
mailing list