<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt">Hi,<br><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><div><br>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:<br><br>...<br>if(this->Program==0)<br> {<br>
this->Program=vtkShaderProgram2::New();<br>
this->Program->SetContext(static_cast<vtkOpenGLRenderWindow
*>(w));<br> }<br>...<br><br>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?<br><br>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).<br><br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">Da:</span></b> Francois Bertel <francois.bertel@kitware.com><br><b><span style="font-weight: bold;">A:</span></b>
vtk vtk <vtkusers@vtk.org><br><b><span style="font-weight: bold;">Inviato:</span></b> Mer 16 giugno 2010, 16:51:44<br><b><span style="font-weight: bold;">Oggetto:</span></b> Re: [vtkusers] Reusing of vtkOpenGLGPUVolumeRayCastMapper...<br></font><br>A side note: you are talking about a very slow initialization due to<br>the gradients computation. But there is no gradient precomputation for<br>the vtkOpenGLGPUVolumeRayCastMapper. It is done on-the-fly during<br>rendering.<br><br>On Wed, Jun 16, 2010 at 10:48 AM, Francois Bertel<br><<a rel="nofollow" ymailto="mailto:francois.bertel@kitware.com" target="_blank" href="mailto:francois.bertel@kitware.com">francois.bertel@kitware.com</a>> wrote:<br>> Hello,<br>><br>> Please post a minimal example to reproduce the problem.<br>><br>> Regards.<br>><br>> On Wed, Jun 16, 2010 at 6:01 AM, AGPX <<a rel="nofollow" ymailto="mailto:agpxnet@yahoo.it" target="_blank"
href="mailto:agpxnet@yahoo.it">agpxnet@yahoo.it</a>> wrote:<br>>>
Ok,<br>>><br>>> it not the assert that fails. The variable Context is invalid, it still<br>>> point to the old destroyed object. This happen because we never change the<br>>> Context of the class vtkShaderProgram2 to the new render window. That is the<br>>> code:<br>>><br>>> void vtkOpenGLGPUVolumeRayCastMapper::BuildProgram(vtkRenderWindow *w,<br>>> int parallelProjection,<br>>>
int raycastMethod,<br>>> int shadeMethod,<br>>> int
componentMethod)<br>>> {<br>>><br>>> assert("pre: valid_raycastMethod" &&<br>>> raycastMethod>= vtkOpenGLGPUVolumeRayCastMapperMethodMIP<br>>> && raycastMethod<=vtkOpenGLGPUVolumeRayCastMapperMethodAdditive);<br>>><br>>> if(this->Program==0)<br>>> {<br>>> this->Program=vtkShaderProgram2::New();<br>>> this->Program->SetContext(static_cast<vtkOpenGLRenderWindow *>(w));<br>>> }<br>>> ...<br>>> }<br>>><br>>> The Program variable isn't 0 and so the new context will never be setup. How<br>>> I can solve this?<br>>><br>>> ________________________________<br>>> Da: AGPX <<a rel="nofollow" ymailto="mailto:agpxnet@yahoo.it"
target="_blank" href="mailto:agpxnet@yahoo.it">agpxnet@yahoo.it</a>><br>>> A: vtk vtk <<a rel="nofollow" ymailto="mailto:vtkusers@vtk.org" target="_blank" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>><br>>> Inviato: Mer 16 giugno 2010, 10:40:35<br>>> Oggetto: [vtkusers] Reusing of vtkOpenGLGPUVolumeRayCastMapper...<br>>><br>>> Hello,<br>>><br>>> I have a vtkOpenGLGPUVolumeRayCastMapper that I have previously used with<br>>> another actor, renderer and render window. I wish to reuse it (creating a<br>>> new actor, renderer and renderwindow), but I obtain an assert error:<br>>><br>>> //<br>>> ----------------------------------------------------------------------------<br>>> // Description:<br>>> // Use the shader program.<br>>> // It saves the current shader program or fixed-pipeline in use.<br>>> // It also set the uniform
variables.<br>>> void vtkShaderProgram2::Use()<br>>>
{<br>>> assert("pre: context_is_set" && this->Context!=0);<br>>> assert("pre: current_context_matches" && this->Context->IsCurrent());<br>>> <---------------- Fail here!<br>>> this->Build();<br>>><br>>> ....<br>>><br>>> Look like that the context isn't current. There's a way to "reset" the<br>>> mapper internal state? Note that the volume data input is the same, so I<br>>> wish to reuse the mapper in order to avoid the very slow initialization<br>>> (especially the gradients computation). Any hints?<br>>><br>>> Thanks in advance.<br>>><br>>><br>>><br>>> _______________________________________________<br><span>>> Powered by <a rel="nofollow" target="_blank" href="http://www.kitware.com">www.kitware.com</a></span><br>>><br>>> Visit other Kitware open-source projects at<br>>> <a
rel="nofollow" target="_blank" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>>><br>>> Please keep messages on-topic and check the VTK FAQ at:<br>>> <a rel="nofollow" target="_blank" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>>><br>>> Follow this link to subscribe/unsubscribe:<br>>> <a rel="nofollow" target="_blank" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>>><br>>><br>><br>><br>><br>> --<br>> François Bertel, PhD | Kitware Inc. Suite 204<br>> 1 (518) 371 3971 x113 | 28 Corporate Drive<br>> | Clifton Park NY 12065, USA<br>><br><br><br><br>-- <br>François Bertel, PhD | Kitware Inc. Suite 204<br>1 (518) 371 3971 x113 | 28 Corporate
Drive<br>
| Clifton Park NY 12065, USA<br>_______________________________________________<br><span>Powered by <a rel="nofollow" target="_blank" href="http://www.kitware.com">www.kitware.com</a></span><br><br>Visit other Kitware open-source projects at <a rel="nofollow" target="_blank" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the VTK FAQ at: <a rel="nofollow" target="_blank" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a rel="nofollow" target="_blank" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></div></div>
</div><br>
</div></div>
</div><br>
</body></html>