Dear all,

I am trying to reuse some code from the point sprites plugin.
I would like to pass some size information onto some shader code for nine different points like this:

voidvtkPointSpriteProperty::Render(vtkActor*act,vtkRenderer*ren)

{



vtkPainterPolyDataMapper*mapper=

          vtkPainterPolyDataMapper::SafeDownCast(act->GetMapper());


vtkSmartPointer<vtkDoubleArray>darr=vtkSmartPointer<vtkDoubleArray>::New();

        darr->SetNumberOfTuples(9);

        darr->SetName("testArray");

        double  size_tuple[1]  =  {0.2};

        darr->SetNumberOfComponents(1);


        darr->SetTupleValue(0,  size_tuple);

        darr->SetTupleValue(1,  size_tuple);

        darr->SetTupleValue(2,  size_tuple);

        darr->SetTupleValue(3,  size_tuple);

        darr->SetTupleValue(4,  size_tuple);

        darr->SetTupleValue(5,  size_tuple);

        darr->SetTupleValue(6,  size_tuple);

        darr->SetTupleValue(7,  size_tuple);

        darr->SetTupleValue(8,  size_tuple);



mapper->RemoveVertexAttributeMapping("SizeParam1");
mapper->MapDataArrayToVertexAttribute("SizeParam1",darr->GetName(),

            vtkDataObject::FIELD_ASSOCIATION_POINTS,  0);



glPushAttrib(GL_ALL_ATTRIB_BITS);

glEnable(vtkgl::VERTEX_PROGRAM_POINT_SIZE_ARB);

  this->Superclass::Render(act,ren);
}

shader code :

attribute  float  SizeParam1;

attribute  float  SizeParam2;

attribute  float  SizeParam3;


vec3  GetSizeParams()

{

  vec3  sizeparams=vec3(0.0,0.5,0.8);

    sizeparams.x = SizeParam1;

//   sizeparams.y  =  SizeParam2;
//   sizeparams.z  =  SizeParam3;


  return  sizeparams;

}



Question: How is the 0.2 stored in the tuple modified while passed to the shader code ?

Because the value arriving in the
shader code seems to be different from the value 0.2 which is stored in the tuples.
I noticed, because if I hardwire 0.2 in the shader code like this


vec3  GetSizeParams()

{

 vec3  sizeparams=vec3(0.2,0.5,0.8);

return sizeparams;
}

I see a different rendering.

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 ?

Thanks.

Best regards,

Florian
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to