[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] Re: [sc-users] Binary Release [test] of ScGraph



On Friday 12 December 2008, Andrea Valle wrote:

> Hi,

> Actually my terminal end saying:

>

> [snip]

> [PluginPool]: Adding ScGraph plugin: ./lib/scgraph/plugins/

> stretch.bundle

> [PluginPool]: Adding ScGraph plugin: ./lib/scgraph/plugins/

> transformation.bundle

> [PluginPool]: Adding ScGraph plugin: ./lib/scgraph/plugins/

> translate.bundle

> [PluginPool]: Adding ScGraph plugin: ./lib/scgraph/plugins/

> triangle.bundle

> [SynthDefPool]: Loading SynthDefs in directory: "/Users/

> andreavalle/.scgraph/synthdefs"

> [ G0 [ G1 ] ]

> [Main]: Up and running...

> [GraphicLoop]: Running!

> [ControlLoop]: Running!

> [OscHandler]: Running!

> .

>

> But

> nothing else happens.

> So I guess I need an Idiot Guide to SCGraph...

Well, this means everything seems to be fine. ScGraph is running and waits for commands.. Try this:

n = NetAddr("localhost", 37291)

Server.default = s = Server.new("scgraph", n)

s.boot; // might be needed on OS X SuperCollider

// Create a Renderer that uses GLShaderUniform to modify parameters of a

// shader program (see below)

{GGLRenderer.gr(in: GBlending.gr(1) + GShaderProgram.gr(29,1) +

GShaderUniform.gr(0,[SinOsc.kr(0.8)]) + GShaderUniform.gr(1,[SinOsc.kr(3),

0.3, 0.2, 0.2]) + In.gr(0), perspective: 0, transparency: 1)}.play

// A SynthDef that draws some white stuff

(

SynthDef(\foo, {

arg x,y;

var env;

env = XLine.kr(1,0.01,1.8, doneAction: 2);

Out.gr(0, GRotate.gr(GTranslate.gr(GRectangle.gr(env*360+0.2, env *

0.5+0.01), [x,y,0]), [0,0,1], env * 13 + 0));

}

).store;

)

// Out timing interval

~dt = 0.06;

// A task spawning a synth every ~dt seconds

(

~t = Task({

true.while({

Synth.new(\foo, args: [\x, 2.6.rand - 1.3, \y, 2.0.rand-1]);

(~dt).wait;

});

});

)

~t.start

~t.stop

// A Shaderprogram (see above)

(n.sendMsg (

"/loadShaderProgram",

29,

"x y",

"

uniform float x;

uniform vec4 y;

void main()

{

gl_FragColor = (gl_Color * 0.1) + vec4(0.5 + 0.5 * sin(x *

float(gl_FragCoord.x)/1.0),0.5 + 0.5 * sin(float(gl_FragCoord.y)/100.0),0.5 +

0.5 * sin(float(gl_FragCoord.y+gl_FragCoord.x)/1.0),1);

gl_FragColor.a = gl_Color.a * 0.1;

}

",

0

);)

--

Palimm Palimm!

http://tapas.affenbande.org