<div dir="ltr">You want to use vtkAxesActor.<div><br></div><div style>You can control the properties of most of the components of the axes.</div><div style><br></div><div style>For example, this (derived from <a href="http://vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Axes">http://vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Axes</a> )</div>
<div style>set the x axis color to white:</div><div style><div>#include <vtkPolyDataMapper.h></div><div>#include <vtkActor.h></div><div>#include <vtkRenderWindow.h></div><div>#include <vtkRenderer.h></div>
<div>#include <vtkRenderWindowInteractor.h></div><div>#include <vtkPolyData.h></div><div>#include <vtkSphereSource.h></div><div>#include <vtkAxesActor.h></div><div>#include <vtkCaptionActor2D.h></div>
<div>#include <vtkTextProperty.h></div><div>#include <vtkProperty.h></div><div>#include <vtkTransform.h></div><div>#include <vtkSmartPointer.h></div><div> </div><div>int main (int, char*[])</div><div>
{</div><div> vtkSmartPointer<vtkSphereSource> sphereSource =</div><div> vtkSmartPointer<vtkSphereSource>::New();</div><div> sphereSource->SetCenter(0.0, 0.0, 0.0);</div><div> sphereSource->SetRadius(0.5);</div>
<div><br></div><div> //create a mapper</div><div> vtkSmartPointer<vtkPolyDataMapper> sphereMapper =</div><div> vtkSmartPointer<vtkPolyDataMapper>::New();</div><div> sphereMapper->SetInputConnection(sphereSource->GetOutputPort());</div>
<div> </div><div> // create an actor</div><div> vtkSmartPointer<vtkActor> sphereActor =</div><div> vtkSmartPointer<vtkActor>::New();</div><div> sphereActor->SetMapper(sphereMapper);</div><div> </div><div>
// a renderer and render window</div><div> vtkSmartPointer<vtkRenderer> renderer =</div><div> vtkSmartPointer<vtkRenderer>::New();</div><div> vtkSmartPointer<vtkRenderWindow> renderWindow =</div><div>
vtkSmartPointer<vtkRenderWindow>::New();</div><div> renderWindow->AddRenderer(renderer);</div><div> </div><div> // an interactor</div><div> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =</div>
<div> vtkSmartPointer<vtkRenderWindowInteractor>::New();</div><div> renderWindowInteractor->SetRenderWindow(renderWindow);</div><div> </div><div> // add the actors to the scene</div><div> renderer->AddActor(sphereActor);</div>
<div> renderer->SetBackground(.1,.2,.3); // Background dark blue</div><div> </div><div> vtkSmartPointer<vtkTransform> transform =</div><div> vtkSmartPointer<vtkTransform>::New();</div><div> transform->Translate(1.0, 0.0, 0.0);</div>
<div><br></div><div> vtkSmartPointer<vtkAxesActor> axes =</div><div> vtkSmartPointer<vtkAxesActor>::New();</div><div><br></div><div> // The axes are positioned with a user transform</div><div> axes->SetUserTransform(transform);</div>
<div> </div><div> // properties of the axes labels can be set as follows</div><div> // this sets the x axis label to red</div><div> axes->GetXAxisShaftProperty()->SetColor(1,1,1);</div><div><br></div><div> // the actual text of the axis label can be changed:</div>
<div> // axes->SetXAxisLabelText("test");</div><div><br></div><div> renderer->AddActor(axes);</div><div> </div><div> renderer->ResetCamera();</div><div> renderWindow->Render();</div><div> </div><div>
// begin mouse interaction</div><div> renderWindowInteractor->Start();</div><div> </div><div> return EXIT_SUCCESS;</div><div>}</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Apr 8, 2013 at 10:09 AM, Sensei <span dir="ltr"><<a href="mailto:senseiwa@gmail.com" target="_blank">senseiwa@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 4/8/13 4:04pm, Arnaud BARRE wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear Sensei,<br>
<br>
Did you try the vtkAxesActor<br>
(<a href="http://www.vtk.org/doc/nightly/html/classvtkAxesActor.html" target="_blank">http://www.vtk.org/doc/<u></u>nightly/html/<u></u>classvtkAxesActor.html</a>). It creates<br>
X/Y/Z axes with R/G/B colors.<br>
<br>
Arnaud<br>
<br>
</blockquote>
<br></div>
Thanks, Arnaud, I actually use the class but it shows me just white axes, that's why I am asking this.<br>
<br>
The code I'm using is simple and probably wrong:<br>
<br>
// Create axes<br>
vtkSmartPointer<vtkAxisActor> axisActor = vtkSmartPointer<vtkAxisActor>:<u></u>:New();<br>
<br>
// Setup renderer (always render axes)<br>
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::<u></u>New();<br>
renderWindow->AddRenderer(<u></u>renderer);<br>
renderer->AddActor(axisActor);<br>
renderer->ResetCamera();<br>
renderer-><u></u>GradientBackgroundOn();<br>
renderer->SetBackground(1.0, 1.0, 1.0);<br>
renderer->SetBackground(0.2, 0.5, 1.0);<br>
<br>
<br>
What am I doing wrong here?<br>
<br>
<br>
Thanks!<div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_<u></u>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/<u></u>listinfo/vtkusers</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>