[vtkusers] How to use the function: SetZbufferData?
    刘卓 
    polinzhuo at 163.com
       
    Tue Nov 28 08:43:54 EST 2006
    
    
  
Hello everyone!
         I want render an object using ZBuffer test. When I use the
function-SetZbufferData, the routine is aborted at it. How to resolve it? My
routine is listed below:
 
         vtkSphereSource *pSphere = vtkSphereSource::New();
         pSphere->SetCenter( 0.0 , 0.0 , 0.0 );
         pSphere->SetRadius( 10.0 );
         pSphere->SetStartTheta( 0.0 );
         pSphere->SetEndTheta( 360.0 );
         pSphere->SetThetaResolution( 30.0 );
         pSphere->SetStartPhi( 0.0 );
         pSphere->SetEndPhi( 90.0 );
         pSphere->SetPhiResolution( 30.0 );
 
         vtkPolyDataMapper* mapMest = vtkPolyDataMapper::New();
         mapMest->SetInput(pSphere->GetOutput());
         vtkActor* meshActor = vtkActor::New();
         meshActor->SetMapper(mapMest);
         meshActor->GetProperty()->SetColor(1,0,0);
         
         vtkOpenGLRenderer *ren1= vtkOpenGLRenderer::New();
         ren1->AddActor( meshActor );
         ren1->SetBackground( 1, 2, 4 );
         vtkWin32OpenGLRenderWindow *renWin =
vtkWin32OpenGLRenderWindow::New();
        vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
   
         renWin->AddRenderer( ren1 ); 
         int wx=150;
         int wy=150;
         renWin->SetSize( wx, wy );
         iren->SetRenderWindow(renWin);
         int* getsize = renWin->GetSize();
 
         int i,j;
         renWin->OpenGLInit();
         float tmpdata[400] ;
         for (i=0;i<400;i++) {
                   tmpdata[i] = 0.8;
         }
         renWin->SetZbufferData(60,60,79,79,tmpdata);
 
        renWin->Render();
iren->Start();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061128/c943dce3/attachment.htm>
    
    
More information about the vtkusers
mailing list