<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Dear all,<br>
    <br>
    I am trying to reuse some code from the point sprites plugin.<br>
    I would like to pass some size information onto some shader code for
    nine different points like this:<br>
    <br>
    <span style=" color:#808000;">void</span><span style="
      color:#c0c0c0;"> </span><span style=" color:#800080;">vtkPointSpriteProperty</span><span
      style=" color:#000000;">::</span><span style=" font-style:italic;
      color:#000000;">Render</span><span style=" color:#000000;">(</span><span
      style=" color:#800080;">vtkActor</span><span style="
      color:#c0c0c0;"> </span><span style=" color:#000000;">*</span><span
      style=" color:#000000;">act</span><span style=" color:#000000;">,</span><span
      style=" color:#c0c0c0;"> </span><span style=" color:#800080;">vtkRenderer</span><span
      style=" color:#c0c0c0;"> </span><span style=" color:#000000;">*</span><span
      style=" color:#000000;">ren</span><span style=" color:#000000;">)</span>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#000000;">{</span></pre>
    <br>
    <br>
    <span style=" color:#c0c0c0;">   </span><span style="
      color:#800080;">vtkPainterPolyDataMapper</span><span style="
      color:#000000;">*</span><span style=" color:#c0c0c0;"> </span><span
      style=" color:#000000;">mapper</span><span style=" color:#c0c0c0;">
    </span><span style=" color:#000000;">=</span>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">          </span><span style=" color:#800080;">vtkPainterPolyDataMapper</span><span style=" color:#000000;">::</span><span style=" color:#000000;">SafeDownCast</span><span style=" color:#000000;">(</span><span style=" color:#000000;">act</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">GetMapper</span><span style=" color:#000000;">());</span></pre>
    <br>
    <span style=" color:#c0c0c0;">   </span><span style="
      color:#800080;">vtkSmartPointer</span><span style="
      color:#000000;"><</span><span style=" color:#800080;">vtkDoubleArray</span><span
      style=" color:#000000;">></span><span style=" color:#c0c0c0;">
    </span><span style=" color:#000000;">darr</span><span style="
      color:#c0c0c0;"> </span><span style=" color:#000000;">=</span><span
      style=" color:#c0c0c0;"> </span><span style=" color:#800080;">vtkSmartPointer</span><span
      style=" color:#000000;"><</span><span style=" color:#800080;">vtkDoubleArray</span><span
      style=" color:#000000;">>::</span><span style=" color:#000000;">New</span><span
      style=" color:#000000;">();</span>
    <pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetNumberOfTuples</span><span style=" color:#000000;">(</span><span style=" color:#000080;">9</span><span style=" color:#000000;">);</span></pre>
    <pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetName</span><span style=" color:#000000;">(</span><span style=" color:#008000;">"testArray"</span><span style=" color:#000000;">);</span></pre>
    <pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#808000;">double</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">size_tuple</span><span style=" color:#000000;">[</span><span style=" color:#000080;">1</span><span style=" color:#000000;">]</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">{</span><span style=" color:#000080;">0.2</span><span style=" color:#000000;">};</span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetNumberOfComponents</span><span style=" color:#000000;">(</span><span style=" color:#000080;">1</span><span style=" color:#000000;">);</span></pre>
    <br>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetTupleValue</span><span style=" color:#000000;">(</span><span style=" color:#000080;">0</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">size_tuple</span><span style=" color:#000000;">);</span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetTupleValue</span><span style=" color:#000000;">(</span><span style=" color:#000080;">1</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">size_tuple</span><span style=" color:#000000;">);</span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetTupleValue</span><span style=" color:#000000;">(</span><span style=" color:#000080;">2</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">size_tuple</span><span style=" color:#000000;">);</span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetTupleValue</span><span style=" color:#000000;">(</span><span style=" color:#000080;">3</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">size_tuple</span><span style=" color:#000000;">);</span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetTupleValue</span><span style=" color:#000000;">(</span><span style=" color:#000080;">4</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">size_tuple</span><span style=" color:#000000;">);</span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetTupleValue</span><span style=" color:#000000;">(</span><span style=" color:#000080;">5</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">size_tuple</span><span style=" color:#000000;">);</span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetTupleValue</span><span style=" color:#000000;">(</span><span style=" color:#000080;">6</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">size_tuple</span><span style=" color:#000000;">);</span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetTupleValue</span><span style=" color:#000000;">(</span><span style=" color:#000080;">7</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">size_tuple</span><span style=" color:#000000;">);</span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span style=" font-style:italic; color:#000000;">SetTupleValue</span><span style=" color:#000000;">(</span><span style=" color:#000080;">8</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">size_tuple</span><span style=" color:#000000;">);</span></pre>
    <br>
    <br>
    <span style=" color:#000000;"><span style=" color:#c0c0c0;">   </span><span
        style=" color:#000000;">mapper</span><span style="
        color:#000000;">-></span><span style=" font-style:italic;
        color:#000000;">RemoveVertexAttributeMapping</span><span style="
        color:#000000;">(</span><span style=" color:#008000;">"SizeParam1"</span><span
        style=" color:#000000;">);</span><span style=" color:#c0c0c0;"><br>
          
      </span><span style=" color:#000000;">mapper</span><span style="
        color:#000000;">-></span><span style=" font-style:italic;
        color:#000000;">MapDataArrayToVertexAttribute</span><span
        style=" color:#000000;">(</span><span style=" color:#008000;">"SizeParam1"</span><span
        style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span
        style=" color:#000000;">darr</span><span style=" color:#000000;">-></span><span
        style=" font-style:italic; color:#000000;">GetName</span><span
        style=" color:#000000;">(),</span><span style=" color:#000000;"></span>
    </span>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">            </span><span style=" color:#800080;">vtkDataObject</span><span style=" color:#000000;">::</span><span style=" color:#800080;">FIELD_ASSOCIATION_POINTS</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span><span style=" color:#000000;">);</span></pre>
    <span style=" color:#000000;"><br>
    </span><br>
    <span style=" color:#000000;"><span style=" color:#000000;"> 
        glPushAttrib</span><span style=" color:#000000;">(</span><span
        style=" color:#000080;">GL_ALL_ATTRIB_BITS</span><span style="
        color:#000000;">);<br>
        <br>
          </span></span><span style=" color:#000000;"><span style="
        color:#000000;"><span style=" color:#000000;">glEnable</span><span
          style=" color:#000000;">(</span><span style=" color:#800080;">vtkgl</span><span
          style=" color:#000000;">::</span>VERTEX_PROGRAM_POINT_SIZE_ARB<span
          style=" color:#000000;">);<br>
        </span></span></span><br>
    <span style=" color:#000000;"><span style=" color:#000000;"><span
          style=" color:#000000;"><span style=" color:#808000;">  this</span><span
            style=" color:#000000;">-></span><span style="
            color:#800080;">Superclass</span><span style="
            color:#000000;">::</span><span style=" font-style:italic;
            color:#000000;">Render</span><span style=" color:#000000;">(</span><span
            style=" color:#000000;">act</span><span style="
            color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span
            style=" color:#000000;">ren</span><span style="
            color:#000000;">);</span></span><br>
        }<br>
        <br>
        shader code :<br>
      </span></span><span style=" color:#000000;"><span style="
        color:#000000;"><br>
        <span style=" color:#008000;"></span>
      </span></span>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#808000;">attribute</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">float</span><span style=" color:#c0c0c0;"> </span>SizeParam1;</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#808000;">attribute</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">float</span><span style=" color:#c0c0c0;"> </span>SizeParam2;</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#808000;">attribute</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">float</span><span style=" color:#c0c0c0;"> </span>SizeParam3;</pre>
    <br>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#808000;">vec3</span><span style=" color:#c0c0c0;"> </span>GetSizeParams()</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">{</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">  </span><span style=" color:#808000;">vec3</span><span style=" color:#c0c0c0;"> </span>sizeparams=<span style=" color:#808000;">vec3</span>(<span style=" color:#000080;">0.0</span>,<span style=" color:#000080;">0.5</span>,<span style=" color:#000080;">0.8</span>);</pre>
    <pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
        sizeparams.x = SizeParam1;<br>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"><span style=" color:#008000;">//</span>  </span><span style=" color:#008000;">sizeparams.y</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">SizeParam2;</span>
<span style=" color:#008000;">//</span><span style=" color:#c0c0c0;">  </span><span style=" color:#008000;">sizeparams.z</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">SizeParam3;</span></pre>
    <br>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">  </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span>sizeparams;</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">}</pre>
    <span style=" color:#000000;"><span style=" color:#000000;"> <br>
        <br>
        Question: How is the 0.2 stored in the tuple modified while
        passed to the shader code ?<br>
        <br>
        Because the value arriving in the <br>
        shader code seems to be different from the value 0.2 which is
        stored in the tuples.<br>
        I noticed, because if I hardwire 0.2 in the shader code like
        this<br>
        <br>
      </span></span><br>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#808000;">vec3</span><span style=" color:#c0c0c0;"> </span>GetSizeParams()</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">{</pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"></span></pre>
    <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"></span><span style=" color:#808000;"> vec3</span><span style=" color:#c0c0c0;"> </span>sizeparams=<span style=" color:#808000;">vec3</span>(<span style=" color:#000080;">0.2</span>,<span style=" color:#000080;">0.5</span>,<span style=" color:#000080;">0.8</span>);</pre>
     
    return sizeparams;<br>
    }<br>
    <br>
    I see a different rendering.<br>
    <span style=" color:#c0c0c0;"> </span><br>
    Could anyone please cast a light into this issue and tell me what I
    am doing wrong or rather which settings influencing the mapping I
    should draw my attention to ?<br>
    <br>
    Thanks.<br>
    <br>
    Best regards,<br>
    <br>
    Florian<br>
  </body>
</html>