[vtk-developers] vtkImageActor doesn't allow you to increase image components from 1 to 3
David Gobbi
david.gobbi at gmail.com
Mon Nov 29 16:29:13 EST 2010
I can offer some thoughts, but I don't have time to run any tests right now.
The vtkImageActor keeps reusing the same texture memory until the texture
size changes. But I don't think that it checks to see if the number of
components changes. So in the case where you see a failure, OpenGL
is converting an RGB image to greyscale so that it can fit in the greyscale
texture that was originally allocated.
The problem is in vtkOpenGLImageActor::MakeDataSuitable() at around
line 193.
David
On Mon, Nov 29, 2010 at 2:08 PM, David Doria <daviddoria at gmail.com> wrote:
> Any thoughts on this?
>
> David
>
>
> On Tue, Nov 23, 2010 at 12:41 PM, David Doria <daviddoria at gmail.com>
> wrote:
> > I setup a demo and tried a few cases. (1) - (3) work properly, and (4)
> > is the issue.
> >
> > 1) If I create an image with image->SetNumberOfScalarComponents(1), then
> call:
> >
> > vtkImageActor* actor = vtkImageActor::New()
> > actor->SetInput(image);
> >
> > it works as expected, a grayscale image is displayed.
> >
> > 2) If I create an image with image->SetNumberOfScalarComponents(3), then
> call:
> >
> > vtkImageActor* actor = vtkImageActor::New()
> > actor->SetInput(image);
> >
> > it works as expected, a color image is displayed.
> >
> > 3) If I create an image with image->SetNumberOfScalarComponents(3), then
> call:
> >
> > vtkImageActor* actor = vtkImageActor::New()
> > actor->SetInput(image);
> >
> > then change the image:
> > image->SetNumberOfScalarComponents(1)
> > ... update image ...
> >
> > it works as expected, a grayscale image is displayed.
> >
> > 4) HOWEVER, if I create an image with
> > image->SetNumberOfScalarComponents(1), then call:
> >
> > vtkImageActor* actor = vtkImageActor::New()
> > actor->SetInput(image);
> >
> > then change the image:
> > image->SetNumberOfScalarComponents(3)
> > ... update image ...
> >
> > A GRAYSCALE image is still displayed. I have attached a demonstration
> > of the problem (comment or uncomment #define DemonstrateBug to see the
> > correct vs the incorrect behavior).
> >
> > If someone can confirm this is a bug I will add it to the bug tracker.
> >
> > Thanks,
> >
> > David
> >
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20101129/085a01a5/attachment.html>
More information about the vtk-developers
mailing list