[vtkusers] Need point position on texture
de Boer Ingo
I.deBoer at polytec.de
Mon May 17 07:43:56 EDT 2004
Hi,
> Why not pass the points through TextureMapToPlane? Points->Plane
> definition->Tex coords output.
Okay... But where does the part with the points come in ?
I have the following now:
[snip]
// Read bitmap from file
int idim[3];
vtkBMPReader *bmpReader = vtkBMPReader::New();
bmpReader->SetFileName("example.bmp");
bmpReader->Update();
bmpReader->GetOutput()->GetDimensions(idim);
float fAspectRatio = (float)idim[0]/(float)idim[1];
// Create texture
vtkTexture *atext = vtkTexture::New();
atext->SetInput(bmpReader->GetOutput());
atext->InterpolateOn();
// Create a plane source. The vtkPlaneSource generates texture coordinates.
vtkPlaneSource *pvtkPlaneSource = vtkPlaneSource::New();
pvtkPlaneSource->SetOrigin( 0.0, 0.0, 0.0);
pvtkPlaneSource->SetPoint1( fAspectRatio*0.5, 0.0, 0.0);
pvtkPlaneSource->SetPoint2( 0.0, 0.5, 0.0);
pvtkPlaneSource->SetCenter( 0.0, 0.0, 0.0);
// make texture to plane
vtkTextureMapToPlane *texturePlane = vtkTextureMapToPlane::New();
texturePlane->SetInput(pvtkPlaneSource->GetOutput());
texturePlane->AutomaticPlaneGenerationOn();
// Create a plane mapper
vtkPolyDataMapper* pvtkPolyDataMapper = vtkPolyDataMapper::New();
pvtkPolyDataMapper->SetInput((vtkPolyData *)texturePlane->GetOutput());
// make actor
vtkActor *at = vtkActor::New();
at->SetMapper(pvtkPolyDataMapper);
at->SetTexture(atext);
[snap]
eg, I have a polygon line with 4 points and I have
these 4 points in Display/World-Coordinates.
In vtkTextureMapToPlane I can set/get axes, ranges, normals...
But where is the function for something like
float* GetTextureCoords(float WorldX, float WorldY, float WorldZ);
Where or how do I get my s/t texture coordinates ?
greets
Ingo
---
Dr.-Ing. Ingo H. de Boer
Polytec GmbH
Polytec-Platz 1-7, 76337 Waldbronn, Germany
phone: ++49 7243 604 106
fax : ++49 7243 604 255
More information about the vtkusers
mailing list