<P>
hello everyone,<BR>
Iam working on glyphs.<BR>
I have two scalar arrays , I want one scalar to scale the glyph ie a sphere and the other scalar to colour the glyphs.<BR>
I have written something but it does not work. something is wrong.<BR>
Someone please correct me.<BR>
Thanking you,<BR>
David Michell<BR>
<BR>
<BR>
<BR>
void main()<BR>
{<BR>
int npts=10;<BR>
int i;<BR>
FILE *fp;<BR>
float coord[3];<BR>
<BR>
vtkLookupTable *ltab;<BR>
<BR>
fp=fopen(&quot;data.set&quot;,&quot;r&quot;);<BR>
<BR>
vtkPoints *ps=vtkPoints::New();<BR>
vtkCellArray *ca =vtkCellArray::New();<BR>
vtkUnstructuredGrid *ug=vtkUnstructuredGrid::New();<BR>
vtkFloatArray *da=vtkFloatArray::New();<BR>
<BR>
ps-&gt;Allocate(npts);<BR>
<BR>
ca-&gt;Allocate(ca-&gt;EstimateSize(100,100));<BR>
ca-&gt;InsertNextCell(npts);<BR>
<BR>
ltab=vtkLookupTable::New();<BR>
ltab-&gt;SetNumberOfColors(npts);<BR>
ltab-&gt;SetHueRange(0.893,0.021);<BR>
ltab-&gt;Build();<BR>
<BR>
<BR>
for (i=0;i&lt;npts,i++)<BR>
{<BR>
fscanf(fp,&quot;%f%f%f&quot;,&amp;coord[0],&amp;coord[1],&amp;coord[2]);<BR>
ps-&gt;InsertNextPoint(coord);<BR>
ca-&gt;InsertCellPoint(i);<BR>
da-&gt;InsertValue(i,i); //i want this to be the color scalar<BR>
}<BR>
<BR>
fclose(fp);<BR>
<BR>
ug-&gt;Allocate(100,100);<BR>
ug-&gt;SetPoints(ps);<BR>
i=1;<BR>
ug-&gt;SetCells(&amp;i,ca);<BR>
<BR>
<BR>
<BR>
vtkRenderer *rn=vtkRenderer::New();<BR>
<BR>
vtkRenderWindow *win=vtkRenderWindow::New();<BR>
win-&gt;AddRenderer(rn);<BR>
<BR>
vtkRenderWindowInteractor *intr=vtkRenderWindowInteractor::New();<BR>
inter-&gt;SetRenderWindow(rn);<BR>
<BR>
<BR>
vtkSphereSource *cst=vtkSphereSource::New();<BR>
cst-&gt;SetRadius(0.1);<BR>
cst-&gt;SetPhiResolution(6);<BR>
cst-&gt;SetThetaResolution(6);<BR>
<BR>
vtkFloatArray *sz =vtkFloatArray::New();//i want this to be the glyph scaling scalar<BR>
<BR>
sz-&gt;InsertValue(0,1.0);<BR>
sz-&gt;InsertValue(1,2.0);<BR>
sz-&gt;InsertValue(2,3.0);<BR>
sz-&gt;InsertValue(3,4.0);<BR>
sz-&gt;InsertValue(4,5.0);<BR>
sz-&gt;InsertValue(5,6.0);<BR>
sz-&gt;InsertValue(6,7.0);<BR>
sz-&gt;InsertValue(7,8.0);<BR>
sz-&gt;InsertValue(8,9.0);<BR>
sz-&gt;InsertValue(9,10.0);<BR>
<BR>
<BR>
vtkGlyph3D *g3t=vtkGlyph3D::New();<BR>
g3t-&gt;SetInput(ug);<BR>
g3t-&gt;SetSource(cst-&gt;GetOutput());<BR>
//here iam saying the unstructured grid to use sz as the scalar <BR>
//so that glyph3d can use it for scaling<BR>
ug-&gt;GetPointData()-&gt;SetScalars(sz);<BR>
g3t-&gt;SetScaleModeToScaleByScalar();<BR>
<BR>
vtkPolyDataMapper *g3map=vtkPolyDataMapper::New();<BR>
<BR>
g3map-&gt;SetInput(g3t-&gt;GetOutput());<BR>
g3map-&gt;SetLookupTable(ltab);<BR>
//here iam saying the unstructured grid to use da as the scalar <BR>
//to get the color<BR>
ug-&gt;GetPointData()-&gt;SetScalars(da);<BR>
<BR>
vtkActor *g3act=vtkActor::New();<BR>
g3act-&gt;SetMapper(g3map);<BR>
<BR>
rn-&gt;AddActor(g3act);<BR>
<BR>
intr-&gt;Initialize();<BR>
rn-&gt;Render();<BR>
intr-&gt;Start();<BR>

</P>
<br><br>
<A target="_blank" HREF="http://clients.rediff.com/signature/track_sig.asp"><IMG SRC="http://ads.rediff.com/RealMedia/ads/adstream_nx.cgi/www.rediffmail.com/inbox.htm@Bottom" BORDER=0 VSPACE=0 HSPACE=0 HEIGHT=74 WIDTH=496></a>