[vtkusers] Texture mapping in a structured grid

Ganesh Sankaranarayanan ganeshs at uta.edu
Thu Apr 26 09:22:12 EDT 2001


Hi all,
I am trying to texture map a BMP image on a structure grid.My structure grid
was created using vtkPolydata class with explicitly stating the points and
connectivity.I understand the texture map range is from 0-1 in parametric
coordinates.When i tried to texture map the image by creating
texture coordinates,I got the image to be mapped in every cell of my
structured grid.(100 images in 100 unit cells of my structured grid).How do
i increase the range of my texture coordinates so that i get one single
image mapped.I am attaching the fragment of the code i used .

Thanks in advance,

Ganesh

// Code fragment for texture mapping

	vtkTexture *mytext=vtkTexture::New();
	vtkTCoords *texcoor=vtkTCoords::New();
	vtkPolyData *mesh = vtkPolyData::New();
	//structured grid generation
	for (i=0; i<121; i++) points->InsertPoint(i,x[i]);
  	for (i=0; i<100; i++) polys->InsertNextCell(4,pts[i]);
  	//for texture coordinates
  	for(i=0;i<121;i++) texcoor->InsertTCoord(i,x[i]);
	mesh->SetPoints(points);
	points->Delete();
  	mesh->SetPolys(polys);
  	polys->Delete();
	//Assigning the texture coordinates
  	mesh->GetPointData()->SetTCoords(texcoor);
  	mytext->SetInput(myreader->GetOutput());
//end of fragment

********************************************
Arise Awake and Stop not till the goal is
reached
********************************************
Office
Ganesh Sankaranarayanan
Graduate Research Assistant
Virtual Environment lab
142,Nedderman Building
Yates Street Arlington TX 76010
Ph 817-272 5719
********************************************
Homepage http://www.geocities.com/sankaganesh
********************************************







More information about the vtkusers mailing list