[vtkusers] colormap texture
Cristian Luciano
clucia1 at uic.edu
Wed Apr 21 17:55:07 EDT 2004
Hi Amy,
Thanks for your reply, but what I need is to create a colormap texture using a lookup table.
This is my source code. It's a method of a class, so the variables not declared are members of that class.
inputData is a bidimensional matrix with certain float values between 35.0 and 37.0.
The problem is that the texture is not applied to the vtkPlaneSource. If I specify a regular bitmap texture (loaded with vtkImageReader2), it works fine.
Thanks.
Cristian
void createColormapTexture(vtkStructuredPoints *inputData)
{
// compute max and min
float range[2];
inputData->GetScalarRange(range);
// lookup table
vtkLookupTable *lut = vtkLookupTable::New();
lut->SetHueRange (0.66667, 0);
lut->SetNumberOfTableValues(256);
lut->SetSaturationRange( 1, 1);
lut->SetValueRange( 1, 1);
lut->SetTableRange( range[0], range[1]);
lut->SetVectorComponent( 0);
lut->Build();
vtkImageMapToColors *colormap = vtkImageMapToColors::New();
colormap->SetInput(inputData);
colormap->SetLookupTable(lut);
vtkTexture *atext = vtkTexture::New();
atext->SetInput(colormap->GetOutput());
atext->InterpolateOff();
vtkPlaneSource *plane = vtkPlaneSource::New();
plane->SetPoint1(Xres,0,0);
plane->SetPoint2(0,Yres,0);
vtkPolyDataMapper *planeMapper = vtkPolyDataMapper::New();
planeMapper->SetInput(plane->GetOutput());
vtkActor *planeActor = vtkActor::New();
planeActor->SetMapper(planeMapper);
planeActor->SetTexture(atext);
ren->AddActor(planeActor);
// Delete
atext->Delete();
plane->Delete();
planeMapper->Delete();
planeActor->Delete();
lut->Delete();
colormap->Delete();
}
----- Original Message -----
From: Amy Henderson
To: Cristian Luciano ; vtkusers at vtk.org
Sent: Wednesday, April 21, 2004 1:24 PM
Subject: Re: [vtkusers] colormap texture
Hi Cristian,
Create an instance of vtkTexture, and set its input to be your vtkStructuredPoints data set. The data set you're applying a texture map to must have texture coordinates defined. If that is the case, then calling SetTexture on the actor of the data set you want to apply the texture to should do what you want.
The online documentation for vtkTexture can be found at the following URL.
http://www.vtk.org/doc/nightly/html/classvtkTexture.html
- Amy
At 02:17 PM 4/21/2004, Cristian Luciano wrote:
Hi,
How can I create a colormap texture from precomputed scalar values contained in a vtkStructuredPoints?
The vtkStructuredPoints is an mxn matrix.
Thanks.
Cristian
__________________________________________________________
Cristian J. Luciano
Research Computer Scientist
Electronic Visualization Laboratory
Industrial Virtual Reality Institute
University of Illinois at Chicago
842 W. Taylor Street, 2039 ERF
Chicago, IL, 60607
ph: (312) 996-0579
fax: (312) 413-0447
<http://www.evl.uic.edu>
__________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040421/f88f3386/attachment.htm>
More information about the vtkusers
mailing list