passing param to shader in a cmdlist

Jul 2, 2008 at 6:47am

passing param to shader in a cmdlist

following http://www.cycling74.com/forums/index.php?t=msg&goto=63168
how do i pass parameters to shaders when using the glbindprogram call?
for example

reset,
glbindprogram blur,
glparam width 0.3 0.3, (??)
circle 0.5,
glbindprogram

#38703
Jul 2, 2008 at 6:52am

I’m not sure that you can actually. You may want to use some form of
scripting instead.
wes

On Tue, Jul 1, 2008 at 11:47 PM, yair reshef wrote:
> following http://www.cycling74.com/forums/index.php?t=msg&goto=63168
> how do i pass parameters to shaders when using the glbindprogram call?
> for example
>
> reset,
> glbindprogram blur,
> glparam width 0.3 0.3, (??)
> circle 0.5,
> glbindprogram
>
>
>
>

#135166
Jul 2, 2008 at 7:32am

i found no example of param/gl_commands manipulation via scripting.
i need the sketch command list as i am texturing a sliced open cylinder,
which i can only generate using direct cmd commands.

thanks wes

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 182 125 26 9109513 stop;
#N vpatcher 25 70 440 249;
#P button 139 95 15 0;
#P toggle 50 76 15 0;
#P window setfont “Sans Serif” 9.;
#P message 50 93 80 9109513 poly_mode $1 $1;
#P message 155 94 29 9109513 reset;
#P number 255 51 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 215 51 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 294 51 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 173 50 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 130 71 191 9109513 pak cylinder 0. 0. 0. 0. 0.;
#P newex 130 115 100 9109513 jit.gl.sketch Optimized;
#P comment 189 95 178 9109513 radius , radius , hieght , deg_start ,
deg_end;
#P connect 9 0 8 0;
#P connect 2 0 1 0;
#P connect 7 0 1 0;
#P fasten 8 0 1 0 55 112 135 112;
#P connect 2 0 10 0;
#P connect 10 0 7 0;
#P connect 3 0 2 1;
#P connect 3 0 2 2;
#P connect 5 0 2 3;
#P connect 6 0 2 4;
#P connect 4 0 2 5;
#P pop;
#P newobj 158 393 54 9109513 p testCylin;
#N vpatcher 25 70 625 470;
#P window setfont “Sans Serif” 9.;
#P window linecount 0;
#P newex 139 151 157 9109513 jit.gl.handle foo @blend_enable 1;
#P window linecount 4;
#P message 147 43 320 9109513 reset , shapeslice 80 80 , glenable
cull_face , glcullface 1 , glenable depth_test , glcolor 0.4 0.6 0.7 ,
sphere 0.5 , glblendfunc 6 1 , moveto -0.5 0. 0. , gldisable cull_face ,
gldisable depth_test , glcolor 0.5 0.2 0.1 , glbindprogram shady , sphere
0.5 , glunbindprogram shady;
#P window linecount 1;
#P newex 213 223 234 9109513 jit.gl.shader foo @name shady @file
mat.xray.jxs;
#B color 5;
#P newex 55 307 43 9109513 s shady;
#P toggle 55 257 15 0;
#P message 55 280 94 9109513 smooth_shading $1;
#P toggle 154 257 15 0;
#P message 154 280 90 9109513 lighting_enable $1;
#P hidden newex 95 214 50 9109513 loadbang;
#P newex 63 192 158 9109513 jit.gl.sketch foo @blend_enable 1;
#P hidden message 95 236 14 9109513 1;
#P newex 63 122 43 9109513 r shady;
#P hidden fasten 1 0 7 0 100 254 60 254;
#P connect 7 0 6 0;
#P fasten 4 0 8 0 159 302 60 302;
#P fasten 6 0 8 0 60 302 60 302;
#P connect 11 0 2 0;
#P fasten 0 0 2 0 68 160 68 160;
#P connect 10 0 2 0;
#P hidden connect 3 0 1 0;
#P hidden connect 3 0 10 0;
#P hidden fasten 1 0 5 0 100 254 159 254;
#P connect 5 0 4 0;
#P pop;
#P newobj 51 24 92 9109513 p jush_bundprogram;
#P newex 254 252 282 9109513 jit.gl.shader Optimized @file tr.edgeblend.jxs
@name edgeblender;
#P window linecount 2;
#P message 55 359 243 9109513 reset , glbindtexture tex0 , glbindprogram
edgeblender , cylinder 1. 1. 0.75 0 120 , glbindprogram ,
glunbindtexture;
#P window linecount 1;
#P message 64 60 29 9109513 reset;
#P window linecount 2;
#P newex 63 79 97 9109513 jit.gl.handle Optimized @inherit_transform 1;
#P window linecount 1;
#P newex 55 393 100 9109513 jit.gl.sketch Optimized;
#P newex 109 221 218 9109513 jit.gl.texture Optimized @automatic 0 @name
tex0;
#P window linecount 2;
#P newex 124 184 241 9109513 jit.gl.slab Optimized @file
cc.uyvy2rgba.lite.jxs @automatic 0 @dimscale 2. 1.;
#P user jit.fpsgui 1 156 60 9109513 0;
#P window linecount 1;
#P newex 109 125 40 9109513 t b b b;
#P newex 1 132 98 9109513 jit.gl.render Optimized;
#P newex 1 91 58 9109513 t b b erase;
#P toggle 1 45 15 0;
#P newex 1 63 50 9109513 qmetro 33;
#P window linecount 2;
#P newex 0 189 91 9109513 jit.window Optimized @size 640 480;
#P window linecount 1;
#P message 155 125 26 9109513 read;
#P newex 139 155 226 9109513 jit.qt.movie @adapt 1 @unique 1 @colormode
uyvy;
#P comment 265 274 114 9109513 @param fade 0.5 0. 0. 0.;
#P connect 19 0 1 0;
#P fasten 2 0 1 0 160 148 144 148;
#P fasten 6 1 8 0 30 117 114 117;
#P connect 5 0 4 0;
#P connect 4 0 6 0;
#P connect 13 0 7 0;
#P connect 6 0 7 0;
#P fasten 6 2 7 0 54 121 6 121;
#P connect 7 0 9 0;
#P connect 14 0 13 0;
#P connect 10 0 11 0;
#P connect 8 0 11 0;
#P connect 15 0 12 0;
#P connect 8 1 10 0;
#P connect 1 0 10 0;
#P connect 8 2 1 0;
#P window clipboard copycount 20;

On Wed, Jul 2, 2008 at 8:52 AM, Wesley Smith wrote:

> I’m not sure that you can actually. You may want to use some form of
> scripting instead.
> wes
>
> On Tue, Jul 1, 2008 at 11:47 PM, yair reshef wrote:
> > following http://www.cycling74.com/forums/index.php?t=msg&goto=63168
> > how do i pass parameters to shaders when using the glbindprogram call?
> > for example
> >
> > reset,
> > glbindprogram blur,
> > glparam width 0.3 0.3, (??)
> > circle 0.5,
> > glbindprogram
> >
> >
> >
> >
>

#135167
Jul 2, 2008 at 7:43am

You could easily recreate this in jit.gl.lua. As for the param thing,
in JS it would be

shader = new JitterObject(“jit.gl.shader”, ctx);
shader.param(“paramname”, vals);

I hope this is somewhere near the mark as it’s the first JS I’ve
written in about 2 years :) Anyway, that’s the idea. param is a
method of a shader object in whatever scripting environment , java
etc. you use.

wes

#135168

You must be logged in to reply to this topic.