<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:Courier New,courier,monaco,monospace,sans-serif;font-size:10pt"><div><span style="font-family: arial,helvetica,sans-serif;">Ok,</span><br style="font-family: arial,helvetica,sans-serif;"><br style="font-family: arial,helvetica,sans-serif;"><span style="font-family: arial,helvetica,sans-serif;">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:<br></span><br></div><div style="font-family: Courier New,courier,monaco,monospace,sans-serif; font-size: 10pt;">void vtkOpenGLGPUVolumeRayCastMapper::BuildProgram(vtkRenderWindow
 *w,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int parallelProjection,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int raycastMethod,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int
 shadeMethod,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int componentMethod)<br>{<br><br>&nbsp; assert("pre: valid_raycastMethod" &amp;&amp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raycastMethod&gt;= vtkOpenGLGPUVolumeRayCastMapperMethodMIP<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;&amp; raycastMethod&lt;=vtkOpenGLGPUVolumeRayCastMapperMethodAdditive);<br><br>&nbsp; <span style="font-weight: bold;">if(this-&gt;Program==0)</span><br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; this-&gt;Program=vtkShaderProgram2::New();<br>&nbsp;&nbsp;&nbsp; this-&gt;Program-&gt;<span style="font-weight: bold;">SetContext</span>(static_cast&lt;vtkOpenGLRenderWindow
 *&gt;(w));<br>&nbsp;&nbsp;&nbsp; }<br>...<br>}<br><br><span style="font-family: arial,helvetica,sans-serif;">The</span> Program <span style="font-family: arial,helvetica,sans-serif;">variable isn't 0 and so the new context will never be setup. How I can solve this?</span><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">Da:</span></b> AGPX &lt;agpxnet@yahoo.it&gt;<br><b><span style="font-weight: bold;">A:</span></b> vtk vtk &lt;vtkusers@vtk.org&gt;<br><b><span style="font-weight: bold;">Inviato:</span></b> Mer 16 giugno 2010, 10:40:35<br><b><span style="font-weight: bold;">Oggetto:</span></b> [vtkusers] Reusing of vtkOpenGLGPUVolumeRayCastMapper...<br></font><br><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><div>Hello,<br><br>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:<br><br><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">// ----------------------------------------------------------------------------</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">// Description:</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">// Use the shader program.</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">// It saves the current shader program or fixed-pipeline in use.</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span
 style="font-family: Courier New,courier,monaco,monospace,sans-serif;">// It also set the uniform variables.</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">void vtkShaderProgram2::Use()</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">{</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">&nbsp; assert("pre: context_is_set" &amp;&amp; this-&gt;Context!=0);</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">&nbsp; assert("pre: current_context_matches" &amp;&amp; this-&gt;Context-&gt;IsCurrent());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &lt;---------------- Fail here!</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">&nbsp; this-&gt;Build();</span><br><br>....<br><br>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?<br><br>Thanks in advance.<br></div>
</div><br>



      </div></div>
</div><br>



      </body></html>