<br>Yep, that did the trick.<br>
This deserves a bug report?<br>
<br>
Thanks a lot Randall, you've been most helpful.<br>
<br>
<br>
Juan<br><div><span class="gmail_quote">On 4/6/06, <b class="gmail_sendername">Randall Hand</b> &lt;<a href="mailto:randall.hand@gmail.com">randall.hand@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="direction: ltr;">OK, I'm seeing the same glitch here on my
end.. That is an odd one.. The only thing I know to attribute it to is
some type of interpolation within the colormap.&nbsp; If you switch
from vtkUnstructuredGridVolumeRayCastMapper to
vtkProjectedTetrahedraMapper then it works perfectly.&nbsp; Also, if
you switch from the colormap approach to the 4-component approach I
mentioned last night, then it works just fine.&nbsp; At this point, it
does seem to be some kind of issue in the RayCastMapper.
<br><br>I'm gonna dig a little deeper, I'll let you know what I find,
if anything.&nbsp; Also, just fyi, you don't need to declare the OpenGL
objects directly, the object factories know when to create the OpenGL
ones vs the Mesa ones just fine :)
<br><br>As promised, code for the 4-component scalar shown below:<br><br><div style="margin-left: 40px; font-family: courier new,monospace;"></div><div style="direction: ltr;"><span class="e" id="q_10a6f8f39c1f383d_1">#include &quot;
vtkVoxel.h&quot;<br>#include &quot;vtkCellData.h&quot;<br>#include &quot;
vtkRenderer.h&quot;<br>#include &quot;vtkPoints.h&quot;<br>#include &quot;vtkUnstructuredGrid.h&quot;<br>#include &quot;vtkRenderWindow.h&quot;<br>#include &quot;vtkRenderWindowInteractor.h&quot;<br>#include &quot;vtkColorTransferFunction.h

&quot;<br>#include &quot;vtkPiecewiseFunction.h&quot;<br>#include &quot;vtkVolume.h&quot;<br>#include &quot;vtkVolumeProperty.h&quot;<br>#include &quot;vtkUnstructuredGridWriter.h&quot;<br>#include &quot;vtkDoubleArray.h
&quot;
<br>#include &quot;vtkDataSetTriangleFilter.h&quot;<br>#include &quot;vtkUnstructuredGridVolumeRayCastMapper.h&quot;<br>#include &quot;vtkUnstructuredGridVolumeRayCastFunction.h&quot;<br>#include &quot;vtkImageData.h&quot;
<br>#include &quot;vtkDataSetToImageFilter.h&quot;<br>#include &quot;stdio.h&quot;<br>#include &quot;iostream.h&quot;<br>#include &quot;fstream.h&quot;<br>#include &quot;string.h&quot;<br>#include &quot;vtkOpenGLRenderer.h

&quot;<br>#include &quot;vtkXOpenGLRenderWindow.h&quot;<br>#include &quot;vtkXRenderWindowInteractor.h&quot;<br><br><br>int main(int argc, char *dim[])<br>{<br><br>&nbsp; int dim_x =&nbsp; atoi(dim[1]);<br>&nbsp; int dim_y =&nbsp; atoi(dim[1]);
<br>&nbsp; int dim_z =&nbsp; atoi(dim[1]);<br>&nbsp; int i, j, k;<br>&nbsp; int no_points = dim_x * dim_x * dim_x;<br>&nbsp; int no_voxels = (dim_x-1) * (dim_x-1) * (dim_x-1);<br><br>&nbsp; vtkPoints *points = vtkPoints::New();<br>&nbsp; points-&gt;SetNumberOfPoints(no_points);
<br>&nbsp; points-&gt;SetDataTypeToDouble();<br><br>&nbsp; for(k=0; k&lt; dim_z; k++)<br>&nbsp;&nbsp;&nbsp; for(j=0; j&lt; dim_y; j++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(i=0; i&lt; dim_x; i++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; points-&gt;InsertNextPoint(i, j, k);<br><br>&nbsp; vtkDoubleArray *pts = vtkDoubleArray::New();
<br></span></div><div style="direction: ltr;">&nbsp; pts-&gt;SetNumberOfComponents(4);<br>&nbsp; pts-&gt;SetName(&quot;pts&quot;);<br><br>&nbsp; for(i=0; i &lt; no_voxels; i++) {<br>&nbsp;&nbsp;&nbsp; if (i &amp; 0x01)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pts-&gt;InsertNextTuple4(1,0,0,
0.9);<br>&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pts-&gt;InsertNextTuple4(0,1,0,
0.9);<br>&nbsp; }<br><br>&nbsp; vtkUnstructuredGrid *grid = vtkUnstructuredGrid::New();</div><div style="direction: ltr;"><span class="e" id="q_10a6f8f39c1f383d_3"><br><br>&nbsp; //To create the grid we need to know if we are in any of the
<br>&nbsp; //cube limits (height, width, depth), to prevent from adding<br>&nbsp; //inexistant cells
<br>&nbsp; j=0;<br>&nbsp; k=0;<br>&nbsp; int w = 0;<br>&nbsp; int count = 0;<br>&nbsp; vtkVoxel *v = vtkVoxel::New();<br><br>&nbsp; for(i=0; i&lt; (no_points - ((dim_x * dim_x) + (dim_x + 1))); i++) {<br>&nbsp;&nbsp;&nbsp; if(j != dim_x - 1 &amp;&amp; k!= dim_x - 1) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(0, i);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(1, i+1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(2, i+dim_x);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(3, i+dim_x+1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(4, i + (dim_x * dim_y));
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(5, i + (dim_x * dim_y) + 1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(6, i + (dim_x * dim_y) + dim_x);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(7, i + (dim_x * dim_y) + dim_x + 1);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; grid-&gt;InsertNextCell(v-&gt;GetCellType(), v-&gt;GetPointIds());<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j++;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; count++;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(j == dim_x-1) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j=0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; k++;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(k == dim_x-1) {
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j=0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; k=0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = i+dim_x;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w++;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; }<br>&nbsp; grid-&gt;SetPoints(points);<br><br>&nbsp; vtkCellData *cd = grid-&gt;GetCellData();<br>&nbsp; cd-&gt;SetNumberOfTuples(no_voxels);
<br>&nbsp; cd-&gt;SetScalars(pts);<br><br></span></div><div style="direction: ltr;">&nbsp; vtkRenderer *renderer = vtkRenderer::New();<br>&nbsp; vtkRenderWindow *renwin =&nbsp; vtkRenderWindow::New();<br>&nbsp; vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
</div><div style="direction: ltr;"><span class="q"><br><br>&nbsp; renwin-&gt;AddRenderer(renderer);
<br>&nbsp; iren-&gt;SetRenderWindow(renwin);<br><br></span></div><div style="direction: ltr;"><span class="q">&nbsp; vtkVolumeProperty *vp = vtkVolumeProperty::New();<br>&nbsp; // vp-&gt;SetColor(funtrans);<br>&nbsp; // vp-&gt;SetScalarOpacity(funop);
<br></span></div><div style="direction: ltr;">&nbsp; vp-&gt;IndependentComponentsOff();</div><div style="direction: ltr;"><span class="q"><br><br>
&nbsp; vtkUnstructuredGridVolumeRayCastMapper *vrcm =<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkUnstructuredGridVolumeRayCastMapper::New();<br><br>&nbsp; vtkDataSetTriangleFilter *filter = vtkDataSetTriangleFilter::New();<br>&nbsp; filter-&gt;SetInput(grid);<br>

<br>&nbsp; vrcm-&gt;SetInput(filter-&gt;GetOutput());<br><br>&nbsp; vtkVolume *volume = vtkVolume::New();<br>&nbsp; volume-&gt;SetMapper(vrcm);<br>&nbsp; volume-&gt;SetProperty(vp);<br><br>&nbsp; renderer-&gt;AddActor(volume);<br><br>&nbsp; renwin-&gt;Render();
<br>&nbsp; iren-&gt;Start();<br>}<br></span></div><div style="direction: ltr;"></div><br><br><br><br></div><div style="direction: ltr;"><span class="e" id="q_10a6f8f39c1f383d_10"><div><span class="gmail_quote">On 4/5/06, <b class="gmail_sendername">
Randall Hand</b> &lt;<a href="mailto:randall.hand@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">randall.hand@gmail.com</a>&gt; wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style="direction: ltr;">If you look at the documentation for vtkVolumeProperty around the SetIndependantComponents stuff : 
<a href="http://www.vtk.org/doc/release/5.0/html/a02182.html#z4350_1" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/doc/release/5.0/html/a02182.html#z4350_1
</a><br><br>I'll play around with it tomorrow morning.. if I can get a
working version of your test driver, I'll send it to you for you to
check out :)</div><div style="direction: ltr;"><span>
<br><br><div><span class="gmail_quote">On 4/5/06, <b class="gmail_sendername">
Juan José Aja Fernández</b> &lt;<a href="mailto:juan.aja@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">juan.aja@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<div style="direction: ltr;">Hi, Randall:<br><br>Thanks again for the swift response.<br><br>I haven't tried using point data, first thing tomorrow I will rewrite the code.<br><br>Your
second suggestion was exactly what I was looking for, until now I
didn't know if there was a way to color whithout using a transfer
function (that explains my horrible hack of using the voxel index as a
&quot;scalar&quot;). I skimmed through the docs trying to find something related,
and I looked at vtkScalarsToColors as a possible candidate, but I have
my doubts: ¿How can I create a RGBA scalar field and how can this be
used as the color function in the mapper?
<br><br><br>Thanks a lot,<br></div><div style="direction: ltr;"><span><br>Juan.</span></div><div style="direction: ltr;"><span><br><br><br><div><span class="gmail_quote">On 4/5/06, 
<b class="gmail_sendername">Randall Hand</b> &lt;<a href="mailto:randall.hand@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">randall.hand@gmail.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style="direction: ltr;">I'll try this out on my end tomorrow, since I'm already neck-deep in the Volume Rendering code anyway :)
<br><br>Just a thought tho, I believe most of the Volume Renderers
expect Point Data, not Cell Data.. Have you tried using Per-point data?
<br><br>Also, if you really want to define colors per-point and not
via a colormap, then if you use a 4-component scalar field you can have
it directly contain R/G/B/A for volume rendering.<br><br><div></div><div style="direction: ltr;">


<span><span class="gmail_quote">
On 4/5/06, <b class="gmail_sendername">Juan José Aja Fernández</b> &lt;<a href="mailto:juan.aja@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">juan.aja@gmail.com</a>&gt; wrote:</span></span>



</div><div style="direction: ltr;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"></blockquote></div><div style="direction: ltr;"><span>

<div style="direction: ltr;"><span class="gmail_quote">(Sorry for the double post, The first url was broken)<br><br></span><div style="direction: ltr;">Hi, Everyone:<br>
<br>
This is the third time I'm posting about this issue, of the previous
two one remained unanswered and the last one I've got a kind response
by Randall Hand:
<a href="http://public.kitware.com/pipermail/vtkusers/2006-February/083786.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://public.kitware.com/pipermail/vtkusers/2006-February/083786.html
</a><br>
<br>
&nbsp;who pointed me in the direction of this fixed bug:
<br>
<br>
<a href="http://www.vtk.org/Bug/bug.php?op=show&amp;bugid=2546&amp;pos=3" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/Bug/bug.php?op=show&amp;bugid=2546&amp;pos=3</a> but the
problem persists.<br>
<br>
I think the vtkUnstructuredGridVolumeRayCastMapper has some serious bug
(look at the screenshots posted in the thread that Randall answered),
and to prove It I think I need to post my entire example code: <br>
<br>
(Really, I think I'm on to something, specially If you consider that
the mapper for unstructured grids is fairly new, but I didn't want to
litter the bug report with false positives).<br>
<br>
<br>
#include &quot;vtkVoxel.h&quot;<br>
#include &quot;vtkCellData.h&quot;<br>
#include &quot;vtkRenderer.h&quot;<br>
#include &quot;vtkPoints.h&quot;<br>
#include &quot;vtkUnstructuredGrid.h&quot;<br>
#include &quot;vtkRenderWindow.h&quot;<br>
#include &quot;vtkRenderWindowInteractor.h&quot;<br>
#include &quot;vtkColorTransferFunction.h&quot;<br>
#include &quot;vtkPiecewiseFunction.h&quot;<br>
#include &quot;vtkVolume.h&quot;<br>
#include &quot;vtkVolumeProperty.h&quot;<br>
#include &quot;vtkUnstructuredGridWriter.h&quot;<br>
#include &quot;vtkDoubleArray.h&quot;<br>
#include &quot;vtkDataSetTriangleFilter.h&quot;<br>
#include &quot;vtkUnstructuredGridVolumeRayCastMapper.h&quot;<br>
#include &quot;vtkUnstructuredGridVolumeRayCastFunction.h&quot;<br>
#include &quot;vtkImageData.h&quot;<br>
#include &quot;vtkDataSetToImageFilter.h&quot;<br>
#include &quot;stdio.h&quot;<br>
#include &quot;iostream.h&quot;<br>
#include &quot;fstream.h&quot;<br>
#include &quot;string.h&quot;<br>
#include &quot;vtkOpenGLRenderer.h&quot;<br>
#include &quot;vtkXOpenGLRenderWindow.h&quot;<br>
#include &quot;vtkXRenderWindowInteractor.h&quot;<br>
<br>
<br>
int main(int argc, char *dim[]) <br>
{&nbsp;&nbsp;&nbsp; <br>
<br>
&nbsp; int dim_x =&nbsp; atoi(dim[1]);<br>
&nbsp; int dim_y =&nbsp; atoi(dim[1]);<br>
&nbsp; int dim_z =&nbsp; atoi(dim[1]);<br>
&nbsp; int i, j, k;<br>
&nbsp; int no_points = dim_x * dim_x * dim_x;<br>
&nbsp; int no_voxels = (dim_x-1) * (dim_x-1) * (dim_x-1);<br>
<br>
&nbsp; vtkPoints *points = vtkPoints::New();<br>
&nbsp; points-&gt;SetNumberOfPoints(no_points);<br>
&nbsp; points-&gt;SetDataTypeToDouble();<br>
<br>
&nbsp; for(k=0; k&lt; dim_z; k++)<br>
&nbsp;&nbsp;&nbsp; for(j=0; j&lt; dim_y; j++)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(i=0; i&lt; dim_x; i++) <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; points-&gt;InsertNextPoint(i, j, k);<br>
<br>
&nbsp; vtkDoubleArray *pts = vtkDoubleArray::New();<br>
&nbsp; pts-&gt;SetName(&quot;pts&quot;);<br>
<br>
&nbsp; for(i=0; i &lt; no_voxels; i++)<br>
&nbsp;&nbsp;&nbsp; pts-&gt;InsertNextValue(i);<br>
<br>
&nbsp; vtkUnstructuredGrid *grid = vtkUnstructuredGrid::New();<br>
<br>
&nbsp; vtkColorTransferFunction *funtrans = vtkColorTransferFunction::New();<br>
<br>
&nbsp; //To create the grid we need to know if we are in any of the<br>
&nbsp; //cube limits (height, width, depth), to prevent from adding<br>
&nbsp; //inexistant cells<br>
&nbsp; j=0;<br>
&nbsp; k=0;<br>
&nbsp; int w = 0;<br>
&nbsp; int count = 0;<br>
&nbsp; vtkVoxel *v = vtkVoxel::New();<br>
<br>
&nbsp; for(i=0; i&lt; (no_points - ((dim_x * dim_x) + (dim_x + 1))); i++) {<br>
&nbsp;&nbsp;&nbsp; if(j != dim_x - 1 &amp;&amp; k!= dim_x - 1) { <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(0, i);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(1, i+1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(2, i+dim_x);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(3, i+dim_x+1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(4, i + (dim_x * dim_y));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(5, i + (dim_x * dim_y) + 1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(6, i + (dim_x * dim_y) + dim_x);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (v-&gt;GetPointIds())-&gt;SetId(7, i + (dim_x * dim_y) + dim_x + 1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; grid-&gt;InsertNextCell(v-&gt;GetCellType(), v-&gt;GetPointIds());<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; count++;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; else { <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(j == dim_x-1) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; k++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(k == dim_x-1) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; k=0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = i+dim_x;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; w++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp; }<br>
&nbsp; grid-&gt;SetPoints(points);<br>
<br>
&nbsp; vtkCellData *cd = grid-&gt;GetCellData();<br>
&nbsp; cd-&gt;SetNumberOfTuples(no_voxels);<br>
&nbsp; cd-&gt;SetScalars(pts);<br>
<br>
&nbsp; int idx = 0;<br>
&nbsp; while (idx &lt; no_voxels) {<br>
&nbsp;&nbsp;&nbsp; if (idx%2 == 0 )<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; funtrans-&gt;AddRGBPoint(pts-&gt;GetValue(idx), 1, 0, 0);<br>
&nbsp;&nbsp;&nbsp; else funtrans-&gt;AddRGBPoint(pts-&gt;GetValue(idx), 0, 1,0);<br>
<br>
&nbsp;&nbsp;&nbsp; idx++;<br>
&nbsp; }<br>
&nbsp; vtkOpenGLRenderer *renderer = vtkOpenGLRenderer::New();<br>
&nbsp; vtkXOpenGLRenderWindow *renwin =&nbsp; vtkXOpenGLRenderWindow::New();<br>
&nbsp; vtkXRenderWindowInteractor *iren = vtkXRenderWindowInteractor::New();<br>
<br>
&nbsp; renwin-&gt;AddRenderer(renderer);<br>
&nbsp; iren-&gt;SetRenderWindow(renwin);<br>
<br>
&nbsp; vtkPiecewiseFunction *funop = vtkPiecewiseFunction::New();<br>
&nbsp; funop-&gt;AddPoint(0, 1);<br>
&nbsp; funop-&gt;AddPoint(no_voxels, 1);<br>
<br>
&nbsp; vtkVolumeProperty *vp = vtkVolumeProperty::New();<br>
&nbsp; vp-&gt;SetColor(funtrans);<br>
&nbsp; vp-&gt;SetScalarOpacity(funop);<br>
<br>
&nbsp; vtkUnstructuredGridVolumeRayCastMapper *vrcm = vtkUnstructuredGridVolumeRayCastMapper::New();<br>
<br>
&nbsp; vtkDataSetTriangleFilter *filter = vtkDataSetTriangleFilter::New();<br>
&nbsp; filter-&gt;SetInput(grid);<br>
<br>
&nbsp; vrcm-&gt;SetInput(filter-&gt;GetOutput()); <br>
<br>
&nbsp; vtkVolume *volume = vtkVolume::New();<br>
&nbsp; volume-&gt;SetMapper(vrcm);<br>
&nbsp; volume-&gt;SetProperty(vp);<br>
<br>
&nbsp; renderer-&gt;AddActor(volume);<br>
<br>
&nbsp; renwin-&gt;Render();<br>
&nbsp; iren-&gt;Start();<br>
}<br>
<br>
<br>
This will attempt to create a cube with dimensions arg[1] coloring odd and even cells with green and red.<br>
Try it with argv[1] = 6, then argv[1] = 20, see the results.<br>
<br>
Is this a bug, or I'm doing things the wrong way?<br>
<br>
<br>
Thanks in advance,<br></div></div></span></div><div style="direction: ltr;"><div style="direction: ltr;"><span><div style="direction: ltr;"><span>
<br>
Juan.<br>
<br>

</span></div>

</span></div><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" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">




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" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtkusers
</a><br><br><br></div><br><br clear="all"><br>-- <br>Randall Hand<br>Visualization Scientist, <br>ERDC-MSRC Vicksburg, MS<br>Homepage: <a href="http://www.yeraze.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">



http://www.yeraze.com</a>

</div></blockquote></div><br>

</span></div></blockquote></div><br><br clear="all"><br>-- <br>Randall Hand<br>Visualization Scientist, <br>ERDC-MSRC Vicksburg, MS<br>Homepage: <a href="http://www.yeraze.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

http://www.yeraze.com</a>

</span></div></blockquote></div><br><br clear="all"><br>-- <br>Randall Hand<br>Visualization Scientist, <br>ERDC-MSRC Vicksburg, MS<br>Homepage: <a href="http://www.yeraze.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.yeraze.com</a>

</span></div></blockquote></div><br>