I can offer some thoughts, but I don't have time to run any tests right now.<div><br></div><div>The vtkImageActor keeps reusing the same texture memory until the texture</div><div>size changes. But I don't think that it checks to see if the number of</div>
<div>components changes. So in the case where you see a failure, OpenGL</div><div>is converting an RGB image to greyscale so that it can fit in the greyscale</div><div>texture that was originally allocated.</div><div><br>
</div><div>The problem is in vtkOpenGLImageActor::MakeDataSuitable() at around</div><div>line 193.</div><div><br></div><div> David</div><div><br></div><div><br><div class="gmail_quote">On Mon, Nov 29, 2010 at 2:08 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Any thoughts on this?<br>
<br>
David<br>
<div><div></div><div class="h5"><br>
<br>
On Tue, Nov 23, 2010 at 12:41 PM, David Doria <<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>> wrote:<br>
> I setup a demo and tried a few cases. (1) - (3) work properly, and (4)<br>
> is the issue.<br>
><br>
> 1) If I create an image with image->SetNumberOfScalarComponents(1), then call:<br>
><br>
> vtkImageActor* actor = vtkImageActor::New()<br>
> actor->SetInput(image);<br>
><br>
> it works as expected, a grayscale image is displayed.<br>
><br>
> 2) If I create an image with image->SetNumberOfScalarComponents(3), then call:<br>
><br>
> vtkImageActor* actor = vtkImageActor::New()<br>
> actor->SetInput(image);<br>
><br>
> it works as expected, a color image is displayed.<br>
><br>
> 3) If I create an image with image->SetNumberOfScalarComponents(3), then call:<br>
><br>
> vtkImageActor* actor = vtkImageActor::New()<br>
> actor->SetInput(image);<br>
><br>
> then change the image:<br>
> image->SetNumberOfScalarComponents(1)<br>
> ... update image ...<br>
><br>
> it works as expected, a grayscale image is displayed.<br>
><br>
> 4) HOWEVER, if I create an image with<br>
> image->SetNumberOfScalarComponents(1), then call:<br>
><br>
> vtkImageActor* actor = vtkImageActor::New()<br>
> actor->SetInput(image);<br>
><br>
> then change the image:<br>
> image->SetNumberOfScalarComponents(3)<br>
> ... update image ...<br>
><br>
> A GRAYSCALE image is still displayed. I have attached a demonstration<br>
> of the problem (comment or uncomment #define DemonstrateBug to see the<br>
> correct vs the incorrect behavior).<br>
><br>
> If someone can confirm this is a bug I will add it to the bug tracker.<br>
><br>
> Thanks,<br>
><br>
> David<br>
><br>
</div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br></div>