Forums > Jitter

Using the capture method in a javascript

July 29, 2006 | 12:56 am

Hi -

Can someone explain how to use the jit.gl* .capture method in a javascript? I’ve looked at the jit.gl.texture.capture example, and I get it, but I can’t figure out how it would translate into js.

The object that you want to render into a texture would presumably get this line:

myGridShape1.capture = "cap";

and that seems to work, ie the object disappears as one would expect…

but then how do you refer to the texture afterwards to bind it to an object?

I’ve tried

myGridShape2.glbindtexture("cap");

but that doesn’t work.

And I’ve tried everything else I can think of such as .glbindtexture(), .jit_matrix(), .to_texture(), etc. But no luck.

???

pH


July 29, 2006 | 2:31 am

manually create a texture and name it cap. the @capture means ‘render
to the named texture. youre texture should be created before you
render to it.

jit.gl.texture.name=’cap’;

and then bind the texture to some geometry for output, like a video
plane.. PS. thats pseudo code, so dont rely on my syntax. :)

v a d e //

http://www.vade.info
abstrakt.vade.info

On Jul 28, 2006, at 8:56 PM, Perry Hoberman wrote:

>
> Can someone explain how to use the jit.gl* .capture method in a
> javascript? I’ve looked at the jit.gl.texture.capture example, and
> I get it, but I can’t figure out how it would translate into js.
>


July 29, 2006 | 3:56 am

Thanks Vade, that cleared everything up.

For future reference, here’s a little example javascript. Just hook up a metro to it.

//begin capture.js

var myHandle = new JitterObject("jit.gl.handle","glcontext");
myHandle.inherit_transform = 1;
var myRender = new JitterObject("jit.gl.render","glcontext");
var myWindow = new JitterObject("jit.window","glcontext");
myWindow.depthbuffer = 1;

var mySourceShape = new JitterObject("jit.gl.gridshape","glcontext");
var mySourceTexture = new JitterObject("jit.gl.texture","glcontext");

var myDestShape = new JitterObject("jit.gl.gridshape","glcontext");
myDestShape.lighting_enable = 1;
var myDestTexture = new JitterObject("jit.gl.texture","glcontext");
myDestTexture.name = "cap";

mySourceTexture.read("sunset.jpg");
mySourceShape.color = [1,1,1,1];
mySourceShape.texture = mySourceTexture.name;
mySourceShape.scale = [0.5,0.5,0.5];
mySourceShape.shape = "torus";
mySourceShape.capture = "cap";

myDestShape.color = [1,1,1,1];
myDestShape.texture = "cap";
myDestShape.scale = [0.5,0.5,0.5];
myDestShape.shape = "cube";

function bang() {
myRender.rotate = myHandle.rotate;
myRender.position = myHandle.position
myRender.erase();
myRender.drawswap();
}

//end capture.js


Viewing 3 posts - 1 through 3 (of 3 total)