[vtkusers] vtkTexture::SetInput(ImageData*) method not found
James Kyle
krunk7 at gmail.com
Tue Oct 23 15:03:30 EDT 2007
Excellent, worked like a charm.
On Oct 23, 2007, at 11:57 AM, David Gobbi wrote:
> Hi Kyle,
>
> You'll have to include the vtkImageData.h header file.
>
> Without this header file, the compiler doesn't know that
> vtkImageData is a subclass of vtkDataObject.
>
> That code comment in vtkTexture is out-of-date, I'll
> remove it.
>
> - David
>
>
> On 10/23/07, James Kyle <krunk7 at gmail.com> wrote:
>> I am attempting to use a png image as a sphere texture. However, I'm
>> getting the following compile time error (source block at end of
>> post):
>>
>>> VTKViewController.mm:108: error: no matching function for call to
>>> 'vtkTexture::SetInput(vtkImageData*)'
>>> /usr/local/VTK/include/vtk-5.0/vtkImageAlgorithm.h:59: note:
>>> candidates are: void vtkImageAlgorithm::SetInput(vtkDataObject*)
>>> /usr/local/VTK/include/vtk-5.0/vtkImageAlgorithm.h:60:
>>> note: void vtkImageAlgorithm::SetInput(int,
>>> vtkDataObject*)
>>
>> I referred to the online documentation and the method is listed as
>> valid (from the online header):
>>
>>> 00154: void SetInput( vtkImageData *input );
>>> 00155: vtkImageData *GetInput();
>>
>> I then looked at my local vtkTexture.h file in /usr/local/VTK/
>> include/
>> vtk-5.0/vtkTexture.h and the same code block area and see:
>>
>>> //BTX
>>> // Description:
>>> // This process object accepts image data as input.
>>> vtkImageData *GetInput();
>>> //ETX
>>
>> A quick search of the header confirms that no vtkTexture::SetInput
>> (ImageData*) exists in my local header. From the path above, you can
>> see I have the latest release of vtk. . . am I missing something
>> obvious?
>>
>> ===code snippet below===
>>
>>> vtkActor *tSphereActor = vtkActor::New();
>>> tSphereActor->SetMapper(pSphereMapper);
>>>
>>> vtkTexture *sphereTexture = vtkTexture::New();
>>> vtkPNGReader *pngReader = vtkPNGReader::New();
>>> pngReader->SetFileName("./Sphere.png");
>>> sphereTexture->SetInput(pngReader->GetOutput());
>>> sphereTexture->InterpolateOn();
>>> tSphereActor->SetTexture(sphereTexture);
>>> sphereActor->Delete();
>>>
>>
>> Many thanks,
>>
>> James Kyle
>>
>>
>>
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at: http://
>> www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
More information about the vtkusers
mailing list