Frank Barknecht wrote:
Hallo,
marius schebella hat gesagt: // marius schebella wrote:

I am trying to parse shader programs to automatically generate user
interfaces (for uniform variables). I have to differentiate between
messages like

[uniform float value1(
[uniform vec2 value2(
[something totally different(
 |
[route uniform]
 |
[route float vec2]
 |
[symbol\

The problem appears as soon as float value1 tries to pass "route float", which gives me "error: Bad arguments for message 'float' to object 'messresponder'".

Is "value1" a number or something else, like a symbol? if it's a symbol, then
you are trying to use a float-message with a symbol argument like "float abc"
which is, uhm, not supported, at least not in [route] or [print] or so.
As a workaround, replace the "float" with something else using [select float]
i.e.:

 [uniform float value1(
 |
 [unpack s s s]
 |     |      |
 |     [select float]
 |     |   /  |
 |     [symbol f(
 |     | /    |
[pack s s s ] |
Ciao

Hi Frank,
thanks for the quick reply.
value1 is a string/symbol. not a number. like "variablename". the problem with your solution is that "something totally different" can be really anything. even a line like "float variablename;" I see this will be one big mess at the end. I am also trying to restrict the parsing to the variable declarations at the top of the shader file - anything before the first function (although that's going to be a hard one, too, because the first function isn't necessarily void main(). At least it is easy to rule out comments (//). And, Pd does semicolon magic, too, so no need for string parsing with the variablename.
otoh parsing froze Pd anyway :( [textfile] did not like the line with "{"
---snip--
void main()
{
---snip--
dunno, maybe Pd is not made for text parsing?? (Probably I should just ask IOhannes for a third outlet of glsl_program...)
marius.

_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to