<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi and thanks for your help.<br>
<br>
I read some pages about vtkGlyph3D and came up up with following
solution.<br>
<br>
m_vtkCenterPoints = vtkPoints::New();<br>
m_vtkCenterPolyData = vtkPolyData::New();<br>
m_vtkSphereSource = vtkSphereSource::New();<br>
m_vtkGlyph3D = vtkGlyph3D::New();<br>
<br>
m_vtkCenterPolyData->SetPoints(m_vtkCenterPoints);<br>
m_vtkGlyph3D->SetSourceConnection(m_vtkSphereSource->GetOutputPort());<br>
m_vtkGlyph3D->SetInputData(m_vtkCenterPolyData);<br>
m_vtkGlyph3D->GeneratePointIdsOn();<br>
<br>
m_vtkMapper->SetInputConnection(m_vtkGlyph3D->GetOutputPort());<br>
<br>
....<br>
addData(...)<br>
{<br>
m_vtkCenterPoints->InsertNextPoint(i_Position.x,i_Position.y,i_Position.z);<br>
m_Data.push_back("I am some information");<br>
}<br>
.....<br>
m_vtkGlyph3D->Update();<br>
<br>
So, this works. I have to point out that I have different
vtkGlyphs plotted simultainiously. Nevertheless, I now would like
to use a picker, which means that I would like give some text
output of the current sphere. <br>
<br>
Therefore, during mouseover, I already managed to determine the
current vtkActor and, hence, are already in the "correct" glyph.
Now my idea is, that during the "addData" call, a stl::vector is
filled with information. The number of elements should be
identical to the number of points, as both is extended by one with
each call. My aim is something like<br>
<br>
...<br>
int ID = i_dont_know() // id of current sphere<br>
printf("Your information is %d\n",m_Data[ID]);<br>
...<br>
I tried around with vtkCellPicker and vtkPointPicker, which seem
to work in general, but are not very accurate, which means that
some sometimes come up with wrong data as output.<br>
if ( m_PointPicker->Pick( i_X, i_Y, 0, i_Renderer ) )<br>
{<br>
// something is picked<br>
int ID2 =m_PointPicker->GetPointId();<br>
<br>
vtkDataArray *p_Array =
m_vtkGlyph3D->GetOutput()->GetPointData()->GetArray("InputPointIds");<br>
int ID = int(p_Array->GetTuple1(p_ID2 ));<br>
}<br>
or<br>
if ( m_CellPicker->Pick( i_X, i_Y, 0, i_Renderer ) )<br>
{<br>
// something is picked<br>
int ID2 =m_CellPicker->GetCellId();<br>
<br>
vtkDataArray *p_Array =
m_vtkGlyph3D->GetOutput()->GetPointData()->GetArray("InputPointIds");<br>
int ID = int(p_Array->GetTuple1(p_ID2 ));<br>
}<br>
<br>
Is there a more correct approach?<br>
<br>
regards,<br>
curator<br>
Am 22.08.2013 16:55, schrieb David E DeMarle:<br>
</div>
<blockquote
cite="mid:CANjZAi9GVxsHHn+OJwM1PBa7JT+YS+FU8P4sxqpO4EOma=Dp6g@mail.gmail.com"
type="cite">
<div dir="ltr">Use a vtkPolyData with points on the locations, and
a VTK_VERTEX cell refering to each one.
<div style=""><br>
</div>
<div style="">Then send that into vtkGlyph to have the CPU makes
the spheres which then get send to the card.</div>
<div style=""><br>
</div>
<div style="">Better yet, draw it with vtkGlyph3dMapper to make
the spheres via vertex programs on the GPU instead of the CPU.<br>
</div>
<div style=""><br>
</div>
<div style="">Better still, bring ParaView's point sprite plugin
over, which will draw the spheres via fragment programs on the
GPU.</div>
<div style=""><br>
</div>
</div>
<div class="gmail_extra"><br clear="all">
<div>David E DeMarle<br>
Kitware, Inc.<br>
R&D Engineer<br>
21 Corporate Drive<br>
Clifton Park, NY 12065-8662<br>
Phone: 518-881-4909</div>
<br>
<br>
<div class="gmail_quote">On Thu, Aug 22, 2013 at 10:45 AM, Gib
Bogle <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:g.bogle@auckland.ac.nz" target="_blank">g.bogle@auckland.ac.nz</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
You need only multiple actors, all using the same mapper.
<div class="HOEnZb">
<div class="h5"><br>
<br>
On 23/08/2013 2:39 a.m., curator wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
I am able to draw a vtkSphere with its own vtkSphere,
vtkActor and vtkMapper equipped together. Now if I
need several spheres, I add multiple instances of this
stuff for each sphere and add them all up to the same
renderer - so far, so good.<br>
<br>
Now I need to draw a really huge amount of spheres,
which are all identical except the position. Is there
any more efficient way to to that than just creating N
vtkActors, N vtkMappers and N vtkSpheres?<br>
<br>
regards,<br>
curator<br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a
moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html"
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ
at: <a moz-do-not-send="true"
href="http://www.vtk.org/Wiki/VTK_FAQ"
target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://www.vtk.org/mailman/listinfo/vtkusers"
target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote>
<br>
<br>
</div>
</div>
<span class="HOEnZb"><font color="#888888">
-- <br>
Dr. Gib Bogle<br>
Senior Research Fellow<br>
Auckland Bioengineering Institute<br>
University of Auckland<br>
New Zealand<br>
<br>
<a moz-do-not-send="true"
href="http://www.bioeng.auckland.ac.nz"
target="_blank">http://www.bioeng.auckland.ac.nz</a><br>
<br>
<a moz-do-not-send="true"
href="mailto:g.bogle@auckland.ac.nz" target="_blank">g.bogle@auckland.ac.nz</a><br>
(64-9) 373-7599 Ext. 87030</font></span>
<div class="HOEnZb">
<div class="h5"><br>
<br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a
moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html"
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at:
<a moz-do-not-send="true"
href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://www.vtk.org/mailman/listinfo/vtkusers"
target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
</blockquote>
<br>
</body>
</html>