<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>Texture mapping on multiple planes?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">I need to map a texture to a 3D polygon.  Using vtkTextureMapToPlane I only see a way to properly map to one plane.  What is the best way to do this?  </FONT></P>
<P><FONT SIZE=2 FACE="Arial">My example below shows a cube but I need to do this with varying shapes.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Here is a summary of the pipeline  vtkPolyData->vtkTextureMapToPlane->vtkPolyDataMapper->vtkActor</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">--------------------------------------------------</FONT>
<BR><FONT SIZE=2 FACE="Arial">vtkPolyData *cube = vtkPolyData::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial">vtkPoints *points = vtkPoints::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial">vtkCellArray *polys = vtkCellArray::New();</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">for (i=0; i<8; i++) points->InsertPoint(i,x[i]);</FONT>
<BR><FONT SIZE=2 FACE="Arial">for (i=0; i<6; i++) polys->InsertNextCell(4,pts[i]);</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">cube->SetPoints(points);</FONT>
<BR><FONT SIZE=2 FACE="Arial">points->Delete();</FONT>
<BR><FONT SIZE=2 FACE="Arial">cube->SetPolys(polys);</FONT>
<BR><FONT SIZE=2 FACE="Arial">polys->Delete();</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">vtkTextureMapToPlane *planeMap = vtkTextureMapToPlane::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial">planeMap->AutomaticPlaneGenerationOff();</FONT>
<BR><FONT SIZE=2 FACE="Arial">planeMap->SetOrigin(0.0, 0.0, 0.0);       // Define plane to map on</FONT>
<BR><FONT SIZE=2 FACE="Arial">planeMap->SetPoint1( 0, 1.0, 0.0 );</FONT>
<BR><FONT SIZE=2 FACE="Arial">planeMap->SetPoint2( 0,0, 1.0 );</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">planeMap->SetInput(cube);</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">vtkPolyDataMapper *cubeMapper = vtkPolyDataMapper::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial">cubeMapper->SetInput(planeMap->GetPolyDataOutput());</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">vtkJPEGReader* pBmpReader = vtkJPEGReader::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial">pBmpReader->SetFileName("metal.jpg");</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">vtkTexture* pPolyTex = vtkTexture::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial">pPolyTex->SetInput( pBmpReader->GetOutput() );</FONT>
<BR><FONT SIZE=2 FACE="Arial">pPolyTex->InterpolateOn();</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">vtkActor *cubeActor = vtkActor::New();</FONT>
<BR><FONT SIZE=2 FACE="Arial">cubeActor->SetMapper(cubeMapper);</FONT>
<BR><FONT SIZE=2 FACE="Arial">cubeActor->SetTexture(pPolyTex);</FONT>
</P>
<BR>
<p><span style="font-family:'Arial';font-size:8pt;">This e-mail and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. If you are NOT the intended recipient or the person responsible for delivering the e-mail to the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited.. </span></p>
<p><span style="font-family:'Arial';font-size:8pt;"> </span></p></BODY>
</HTML>