[vtkusers] VTK Python + GLSL shaders type casting and methods overloading
Charl P. Botha
cpbotha at cpbotha.net
Fri Aug 24 10:49:27 EDT 2007
Dear all,
We've run into exactly the same problem. The Python wrapper generator
is screwing up the overloaded AddShaderVariable(), please see the code
snippet from the generated vtkPropertyPython.cxx I've posted at [1].
There are multiple blocks in the wrapped AddShaderVariable(), but if
you look at the code, you'll see it's never going to see any but the
first block, which works only for integer uniform variables.
What's the best way to fix this? I can think of a few solutions with
explicit helper funcitons in vtkProperty (AddShaderVariableFloat,
AddShaderVariableInt OR AddShaderVariable("name", VTK type spec,
value)) that should help the wrapper generator to do the right thing.
Does anyone else have other suggestions (or the time to implement a workaround)?
[1] http://visualization.tudelft.nl/~cpbotha/thingies/vtkPropertyPython_wraperror.cxx
On 9/27/06, A. Sottoriva <asottori at science.uva.nl> wrote:
> I'm using VTK 5.1 with python 2.4 and GLSL shaders. I've 2 uniform float
> variables on the vertex shader and 2 uniform vec3 variables on the
> fragment one. These are passed by the application with the
> AddShaderVariable as describe de following code:
>
> prop = myactor.GetProperty()
> prop.LoadMaterial("myshader.xml")
> prop.AddShareVariable("cTemp", 0.0)
> prop.AddShareVariable("tRange", 10.0)
> prop.AddShareVariable("cColor", 0.0, 0.0, 1.0)
> prop.AddShareVariable("hColor", 1.0, 0.0, 0.0)
> ...
>
> if I execute the code it gives me the following error:
>
> DeprecationWarning: integer argument expected, got float
>
> I tryied the same identical code in C++ and it works perfectly, it seems
> to be a problem with the Python wrappers that cannot recognize correctly
> the AddShareVariable() method overloading.
> Any suggestion ?
>
> regards,
>
> --
> [[ Andrea Sottoriva
> [[ MSc student in Grid Computing
> [[ Computational Science Programme
> [[ Universiteit van Amsterdam (The Netherlands)
> [[ ...
> [[ http://hifi.metalabs.org
>
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list