[vtkusers] ObjReader: Help

Hamp Donald hampdonald at yahoo.com
Wed Aug 4 15:27:04 EDT 2004


Hi Friends 
         Can somebody tell me what's wrong am I doing
with the following program. It is giving a blank
window.

Help me please.

Best Regards
Donald   


int main( int argc, char *argv[] )
{
                                                      
                                                      
                                     
//vtkRenderer *ren1=vtkRenderer::New();
//vtkRenderWindow *renWin =vtkRenderWindow::New();
//renWin->AddRenderer(ren1);
                                                      
                                                      
                                     
                                                      
                                                      
                                     
vtkOBJReader *faceReader = vtkOBJReader::New();
faceReader->SetFileName("000.obj");
faceReader->Update();
                                                      
                                                      
                                     
if (faceReader == NULL)
 {
 cout << "Error in ....." << endl;
 exit(0);
 }
                                                      
                                                      
                                     
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInput(faceReader->GetOutput());
mapper->ScalarVisibilityOff();
                                                      
                                                      
                                     
vtkBMPReader *imgReader = vtkBMPReader::New();
 imgReader->SetFileName("0000.bmp");
                                                      
                                                      
                                     
 vtkTexture *atext = vtkTexture::New();
  atext->SetInput(imgReader->GetOutput());
  atext->InterpolateOn();
                                                      
                                                      
                                     
vtkActor *faceActor = vtkActor::New();
faceActor->SetMapper(mapper);
faceActor->SetTexture(atext);
                                                      
                                                      
                                     
//faceActor->GetProperty()->SetAmbient(1.0);
//faceActor->GetProperty()->SetColor(1.0, 1.0, 1.0);
                                                      
                                                      
                                     
 vtkRenderer *ren = vtkRenderer::New();
 vtkRenderWindow *renWin= vtkRenderWindow::New();
vtkRenderWindowInteractor
*iren=vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);

 renWin->AddRenderer(ren);
                                                      
                                                      
                                     
                                                      
                                                      
                                     
ren->AddActor(faceActor);
ren->SetBackground(0.1, 0.2, 0.4);
renWin->SetSize(500,500);
                                                      
                                                      
                                     
renWin->Render();
//getchar();
                                                      
                                                      
                                     
                                                      
                                                      
                                     
                                                      
                                                      
                                     
 iren->Initialize();
 iren->Start();
                                                      
                                                      
                                     
                                                      
                                                      
                                     
}




	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 



More information about the vtkusers mailing list