<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    I made the changes using the vtkAppendPolyData approach, see code
    below.<br>
    <br>
    This did improve the interaction alot, but it was still a little
    slugish. Is this because I implemented badly?<br>
    <br>
    Thanks<br>
    Alex<br>
    <br>
    // Create a cube.<br>
    &nbsp;&nbsp;&nbsp; vtkCubeSource **cubeSource = new vtkCubeSource* [ca.numCubes];<br>
    &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkAppendPolyData&gt; appendFilter =
    vtkSmartPointer&lt;vtkAppendPolyData&gt;::New();<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
    &nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; ca.numCubes; i++)<br>
    &nbsp;&nbsp;&nbsp; {<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cubeSource[i] = vtkCubeSource::New(); &nbsp;&nbsp;&nbsp; <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cubeSource[i]-&gt;SetCenter(ca.cubeCentre[i].x
    ,ca.cubeCentre[i].y ,ca.cubeCentre[i].z );<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cubeSource[i]-&gt;SetXLength(ca.cubeLength[i] );<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cubeSource[i]-&gt;SetYLength(ca.cubeLength[i] );<br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cubeSource[i]-&gt;SetZLength(ca.cubeLength[i] ); <br>
    <br>
    &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
    appendFilter-&gt;AddInputConnection(cubeSource[i]-&gt;GetOutput()-&gt;GetProducerPort());&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp; <br>
    &nbsp;&nbsp;&nbsp; <br>
    &nbsp;&nbsp;&nbsp; }<br>
    &nbsp;&nbsp;&nbsp; appendFilter-&gt;Update();<br>
    <br>
    &nbsp;&nbsp;&nbsp; // Remove any duplicate points.<br>
    &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkCleanPolyData&gt; cleanFilter =&nbsp;&nbsp;&nbsp;
    vtkSmartPointer&lt;vtkCleanPolyData&gt;::New();<br>
    &nbsp;&nbsp;&nbsp;
    cleanFilter-&gt;SetInputConnection(appendFilter-&gt;GetOutputPort());<br>
    &nbsp;&nbsp;&nbsp; cleanFilter-&gt;Update();<br>
    <br>
    &nbsp;&nbsp;&nbsp; // create mapper<br>
    &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkPolyDataMapper&gt; mapper =
    vtkSmartPointer&lt;vtkPolyDataMapper&gt;::New();<br>
    &nbsp;&nbsp;&nbsp; mapper-&gt;SetInputConnection(cleanFilter-&gt;GetOutputPort());<br>
    <br>
    &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkActor&gt; actor =
    vtkSmartPointer&lt;vtkActor&gt;::New();<br>
    &nbsp;&nbsp;&nbsp; actor-&gt;SetMapper(mapper);<br>
    &nbsp;&nbsp;&nbsp; actor-&gt;GetProperty()-&gt;SetColor(255,0,0);<br>
    &nbsp;&nbsp;&nbsp; actor-&gt;GetProperty()-&gt;SetRepresentationToWireframe();<br>
    <br>
    &nbsp;&nbsp;&nbsp; renderer-&gt;AddActor(actor);<br>
    <br>
    etc....<br>
    <br>
    On 2/7/2012 6:39 PM, Bryn Lloyd wrote:
    <blockquote cite="mid:4F3153AA.6040706@itis.ethz.ch" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      Use the glyph mapper for even faster GPU rendering.<br>
      <br>
      <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="http://www.vtk.org/doc/nightly/html/classvtkGlyph3DMapper.html">http://www.vtk.org/doc/nightly/html/classvtkGlyph3DMapper.html</a><br>
      <br>
      <br>
      On 2/7/2012 5:17 PM, David E DeMarle wrote:
      <blockquote
cite="mid:CANjZAi-b5nONphWjsPkDmAzgGaFm=m9ZX78Hcr2y6fF3OPmFvQ@mail.gmail.com"
        type="cite">
        <p>Use the glyph filter to make one actor with thousands of
          cubes.</p>
        <div class="gmail_quote">On Feb 7, 2012 11:12 AM, "Alex
          Southern" &lt;<a moz-do-not-send="true"
            href="mailto:mrapsouthern@gmail.com">mrapsouthern@gmail.com</a>&gt;

          wrote:<br type="attribution">
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"> Hi,<br>
              <br>
              I'm wondering what the best way to do this is?<br>
              <br>
              Currently the cubes are defined in a dynamic array of
              vtkCubeSources, see code below. This results in very slow
              interaction.<br>
              <br>
              Is there a more lightweight approach to this problem?
              There is a typical image below.<br>
              <br>
              // Create a cube array.<br>
              &nbsp;&nbsp;&nbsp; int numCubes = 44582; // in practice this value could
              be anything<br>
              &nbsp;&nbsp;&nbsp; vtkCubeSource **cubeSource = new vtkCubeSource*
              [numCubes];&nbsp;&nbsp;&nbsp; &nbsp;<br>
              &nbsp;&nbsp;&nbsp; vtkPolyDataMapper **mapper = new vtkPolyDataMapper*
              [numCubes];<br>
              &nbsp;&nbsp;&nbsp; vtkActor **actor = new vtkActor* [numCubes];<br>
              <br>
              &nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; ca.numCubes; i++)<br>
              &nbsp;&nbsp;&nbsp; {<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cubeSource[i] = vtkCubeSource::New(); <br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mapper[i] = vtkPolyDataMapper::New(); &nbsp;&nbsp;&nbsp; <br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; actor[i] = vtkActor::New();<br>
              <br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cubeSource[i]-&gt;SetCenter(ca.cubeCentre[i].x ,
              ca.cubeCentre[i].y, ca.cubeCentre[i].z);<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cubeSource[i]-&gt;SetXLength(ca.cubeLength[i] );<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cubeSource[i]-&gt;SetYLength(ca.cubeLength[i] );<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cubeSource[i]-&gt;SetZLength(ca.cubeLength[i] );<br>
              <br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
              mapper[i]-&gt;SetInputConnection(cubeSource[i]-&gt;GetOutputPort());<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; actor[i]-&gt;SetMapper(mapper[i]);<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; actor[i]-&gt;GetProperty()-&gt;SetColor(255,0,0);<br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
              actor[i]-&gt;GetProperty()-&gt;SetRepresentationToWireframe();<br>
              <br>
              &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; renderer-&gt;AddActor(actor[i]);<br>
              &nbsp;&nbsp;&nbsp; <br>
              &nbsp;&nbsp;&nbsp; }<br>
              <br>
              <img src="cid:part3.05010606.07020708@gmail.com" alt=""
                height="769" width="974"><br>
            </div>
            <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>
            <br>
          </blockquote>
        </div>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
Powered by <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at <a moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
</pre>
      </blockquote>
      <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>