Bob, you must link the line´s mapper to its Actor:<br>
<br>
vtkActor *lineASourceActor = vtkActor::New();<br>
lineASourceActor->SetMapper(lineAMapper); // ADD THIS LINE<br>
lineASourceActor->GetProperty()->SetColor(0.0, 0.0, 1.0);<br>
<br>Greetings<br>
<br>
Luca<br>
<br><div><span class="gmail_quote">On 5/23/06, <b class="gmail_sendername">Bob Palank</b> <<a href="mailto:bob@stlcc.org">bob@stlcc.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Given the code below, I see the cylinder, but not the line.<br>Any idea why ? Shouldn't a line be a visible object like a cylinder?<br>If not, then does one display a line object using a cylinder with a small<br>diameter ?
<br>Hopefully there is a simple coding error!<br>TIA<br> Bob<br><br>Code follows:<br>#include "vtkCylinderSource.h"<br>#include "vtkPolyDataMapper.h"<br>#include "vtkActor.h"<br>#include "
vtkRenderer.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkProperty.h"<br>#include "vtkCamera.h"<br>#include "vtkLineSource.h
"<br><br>int main(int argc, char *argv[])<br>{<br> vtkCylinderSource *cylinder = vtkCylinderSource::New();<br> cylinder->SetResolution(18); // eight circumferential facets.<br><br><br> vtkPolyDataMapper *cylinderMapper = vtkPolyDataMapper::New();
<br> cylinderMapper->SetInput(cylinder->GetOutput());<br><br><br> vtkActor *cylinderActor = vtkActor::New();<br> cylinderActor->SetMapper(cylinderMapper);<br> cylinderActor->GetProperty()->SetColor(1.0000
, 0.3882, 0.2784);<br> cylinderActor->RotateX(30.0);<br> cylinderActor->RotateY(-45.0);<br><br> // =================================================================<br> vtkLineSource *lineASource = vtkLineSource::New();
<br> lineASource->SetPoint1(-12.0,2.0,2.0);<br> lineASource->SetPoint2(12.0,4.0,5.0);<br><br> vtkPolyDataMapper *lineAMapper = vtkPolyDataMapper::New();<br> lineAMapper->SetInput(lineASource->GetOutput());
<br><br> vtkActor *lineASourceActor = vtkActor::New();<br> lineASourceActor->GetProperty()->SetColor(0.0, 0.0, 1.0);<br><br><br><br><br> vtkRenderer *ren1 = vtkRenderer::New();<br> vtkRenderWindow *renWin = vtkRenderWindow::New();
<br> renWin->AddRenderer(ren1);<br> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br> iren->SetRenderWindow(renWin);<br><br><br> ren1->AddActor(cylinderActor);<br> ren1->AddActor(lineASourceActor);
<br> ren1->SetBackground(0.1, 0.2, 0.4);<br> renWin->SetSize(300, 300);<br><br> // We'll zoom in a little by accessing the camera and invoking a "Zoom"<br> // method on it.<br> // ren1->GetActiveCamera()->Zoom(
1.5);<br> renWin->Render();<br><br> // This starts the event loop and as a side effect causes an initial<br>render.<br> iren->Start();<br><br> // Exiting from here, we have to delete all the instances that<br> // have been created.
<br> cylinder->Delete();<br> cylinderMapper->Delete();<br> cylinderActor->Delete();<br> lineASourceActor->Delete();<br> lineAMapper->Delete();<br> ren1->Delete();<br> renWin->Delete();<br> iren->Delete();
<br><br> return 0;<br>}<br><br>_______________________________________________<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ
</a><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></blockquote></div><br>