[vtkusers] DESPERATE help needed for texturing with 3DS import

yeriny at ihug.co.nz yeriny at ihug.co.nz
Mon Feb 28 23:17:50 EST 2005


Hello!

I am a vtk newbie, and trying to import .3DS file containing
texture coordinates, but how can I get the texture
coordinate information by using vtk3DSImporter?

I have this code, which basically shows me the model with
black texture (of course, because there's no mapping
information anywhere!!) but i have NO idea where or how to
put that into the code.

Here's a snippet of my code (in Visual C++), ANY help is
appreciated!!

<<<< Snippet of the code >>>
// Import the scene from the 3ds file
this->importer->ComputeNormalsOn();
this->importer->SetRenderWindow(renWin);
this->importer->SetFileName("spaceship.3ds");
this->importer->Read();

// set up our renderer and add it to the window
this->ren = this->importer->GetRenderer();
this->renWin->AddRenderer(this->ren);
//vtkOutputWindow::GetInstance()->

// setup the parent window
this->renWin->SetParentId(this->m_hWnd);
this->iren->SetRenderWindow(this->renWin);

// Set the default interactor style to "Trackball"
this->style = vtkInteractorStyleSwitch::New();
this->iren->SetInteractorStyle(style);
this->style->SetCurrentStyleToTrackballCamera();

// Set up texture by linking the image to the texture
this->jpegReader->SetFileName("spaceship.jpg");
this->texture->SetInput(this->jpegReader->GetOutput());
this->texture->InterpolateOn();

// get the actors that's imported form 3DS file,
// which can be taken from the renderer
this->actors = ren->GetActors();
this->actors->InitTraversal();

// Just get the first actor to test
// (we know that there's only one actor in the scene!!)
this->theActor = this->actors->GetNextActor();

// give texture to the actor
this->theActor->SetTexture(this->texture);

<<<< Snippet END >>>>>

Thank you VERY much!!

Yerin



More information about the vtkusers mailing list