[vtkusers] Strange response on Linux

Asad A. Abu-Tarif tarifa at rpi.edu
Thu Oct 18 16:20:01 EDT 2001


Oops, I forgot to insert the program, sorry.

Here it is:


void main( int argc, char *argv[] )
{
  // create a rendering window and renderer
  vtkRenderer *ren_upper = vtkRenderer::New();
  vtkRenderer *ren_lower = vtkRenderer::New();
    ren_upper->SetViewport(0,0.5,1.0,1.0);
    ren_lower->SetViewport(0,0,1,0.5);
   
  vtkRenderWindow *renWindow = vtkRenderWindow::New();
    renWindow->AddRenderer(ren_upper);
    renWindow->AddRenderer(ren_lower);
  renWindow->SetSize( 300, 300 );
   vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWindow);

  // create an actor and give it cone geometry
  vtkVectorText *text = vtkVectorText::New();
    text->SetText("1");
  vtkPolyDataMapper *textMapper = vtkPolyDataMapper::New();
    textMapper->SetInput(text->GetOutput());
  vtkActor *textActor = vtkActor::New();
    textActor->SetMapper(textMapper);
    textActor->SetPosition(100.25,100.25,100.25);
    textActor->SetScale(0.5,0.5,0.5);
    textActor->GetProperty()->SetColor(0,0,1.0);

  vtkSphereSource *sphere = vtkSphereSource::New();
    sphere->SetCenter(100,100,100);
    sphere->SetRadius(0.5);
  vtkPolyDataMapper *sphereMapper = vtkPolyDataMapper::New();
    sphereMapper->SetInput(sphere->GetOutput());
  vtkActor *sphereActor = vtkActor::New();
    sphereActor->SetMapper(sphereMapper);
    sphereActor->GetProperty()->SetColor(1.0,0,0);

  vtkVectorText *text2 = vtkVectorText::New();
    text2->SetText("2");

  vtkPolyDataMapper *textMapper2 = vtkPolyDataMapper::New();
    textMapper2->SetInput(text2->GetOutput());
  vtkActor *textActor2 = vtkActor::New();
    textActor2->SetMapper(textMapper2);
    textActor2->SetPosition(100.25,100.25,100.25);
    textActor2->SetScale(0.5,0.5,0.5);
    textActor2->GetProperty()->SetColor(0,0,1.0);
  

  vtkSphereSource *sphere2 = vtkSphereSource::New();
    sphere2->SetCenter(100,100,100);
    sphere2->SetRadius(0.5);
  vtkPolyDataMapper *sphereMapper2 = vtkPolyDataMapper::New();
    sphereMapper2->SetInput(sphere2->GetOutput());
  vtkActor *sphereActor2 = vtkActor::New();
    sphereActor2->SetMapper(sphereMapper2);
    sphereActor2->GetProperty()->SetColor(1.0,0,0);

  // assign our actor to the renderer
  ren_upper->AddActor(textActor);
  ren_upper->AddActor(sphereActor);
  ren_lower->AddActor(textActor2);
  ren_lower->AddActor(sphereActor2);
  
  ren_upper->SetBackground(1,1,1);
  ren_lower->SetBackground(0.8,0.8,0.8);

  // draw the resulting scene
  renWindow->Render();

  iren->Start();

  // Clean up
  ren_lower->Delete();
  ren_upper->Delete();
  renWindow->Delete();
  text->Delete();
  textMapper->Delete();
  textActor->Delete();
  sphere->Delete();
  sphereMapper->Delete();
  sphereActor->Delete();
  text2->Delete();
  textMapper2->Delete();
  textActor2->Delete();
  sphere2->Delete();
  sphereMapper2->Delete();
  sphereActor2->Delete();
}

  ----- Original Message ----- 
  From: Asad A. Abu-Tarif 
  To: vtk User List 
  Sent: Thursday, October 18, 2001 4:12 PM
  Subject: [vtkusers] Strange response on Linux


  Hi,
  I started recently porting the code I've been developing for 2 years
  on NT to Linux. So, I'm really new to Linux!!
  I compiled and ran the following program on both WinNT and Linux.
  The program runs as expected on NT (a sphere in the upper renderer
  with the number 1 and a white background; and a sphere in the lower
  renderer with the number 2 and a grayish background).

  However, when I run it under linux the following happens:
  1) The upper renderer is black (not white) and contains no actors.
  2) The lower renderer is white (not grayish) but has the correct actors.

  Did anyone encounter such a problem on Linux before?
  I'm using Linux RedHat 6.2 and Mesa 3.1.2

  Thanks,
  Asad
         __________________________________________________
       /                        Asad A. Abu-Tarif                                        \
       |   Computer Engineering.                                                      |     
       |   PhD Candidate, Rensselaer Polytechnic Institute (RPI).       |
       |   PhD Thesis: Multi-Model 3D Registration                            |
       \___________________________________________________/ 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20011018/d1a6b8c1/attachment.htm>


More information about the vtkusers mailing list