[vtkusers] addVariableOnShader

youpie meriadegp at yahoo.fr
Wed Apr 20 06:40:56 EDT 2011


Hello, I'm using shader with vtk, and it's very nice.
But I now want to use the addShaderVariable(char * name , int size, float
*data);
Of course, to use this on, I initialized my data like that 
float *data = new float[size];
for(int i = 0 ; i< size; i++)
{
data = (float)(...);
}

well, But when i run, that, it say that i have a problem with my data
memory, (glib detected)
with gdb, I see the problemen is detected when it passed by
SetApplicationParameter(vtkXMLDataElement* elem);

Why Application ?
because is my xml shader, is use the tag <ApplicationUniform>

some helpful informations :

vtkActor *actor = this->getActor();
vtkProperty *prop = actor->GetProperty();
prop->vtkProperty::LoadMaterial(".../shader.xml");
prop->vtkProperty::ShadingOn();
addShaderVariable("scalarSet" , size, data); //efectiveParameter

and in my shader :
<Material name="SimpleProceduralTexture" number_of_properties="0"
number_of_vertex_shaders="1" number_of_fragment_shaders="1">

  <Shader scope="Vertex" name="ProceduralTextureVert" location="Inline"
language="GLSL" entry="main">
	<ApplicationUniform name="setScalar" value="scalarSet"/>
   ...

more over, in my shader.xml I use :
uniform sampler1D setScalar;

If someone can help me !!

thanks in advance...

ps: I think the problem come from my float * beacause, before i tried the
analog thing with only a float and that worked.




--
View this message in context: http://vtk.1045678.n5.nabble.com/addVariableOnShader-tp4315452p4315452.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list