Forums > Jitter

time-delayed textures? 3d texture buffers?

June 6, 2007 | 10:03 pm

is there a way to set up a video delay entirely as a buffer of
textures? like using this technique (below), but entirely on the GPU?

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 340 302 40 196617 % 300;
#P newex 340 280 27 196617 -;
#P newex 340 258 37 196617 + 300;
#P outlet 303 410 15 0;
#P inlet 422 134 15 0;
#P inlet 302 133 15 0;
#P newex 303 372 258 196617 jit.matrix 4 char 320 240 @usesrcdim 1
@adapt 0;
#P message 315 336 225 196617 srcdimstart 0 0 $1 , srcdimend 319
239 $1;
#N counter 0 0 299;
#X flags 0 0;
#P newobj 321 189 83 196617 counter 0 0 299;
#P message 331 212 225 196617 dstdimstart 0 0 $1 , dstdimend 319
239 $1;
#P newex 302 233 262 196617 jit.matrix 4 char 320 240 300 @usedstdim
1 @interp 0;
#P newex 302 161 29 196617 t l b;
#P comment 353 161 30 196617 Delay;
#B color 10;
#P comment 321 410 69 196617 Delayed Video;
#P window linecount 2;
#P comment 319 133 52 196617 Input Video;
#P comment 440 133 64 196617 Delay Amount;
#P connect 11 0 14 1;
#P connect 14 0 15 0;
#P connect 13 0 14 0;
#P connect 7 0 6 0;
#P connect 7 0 13 0;
#P connect 4 1 7 0;
#P connect 15 0 8 0;
#P connect 9 0 12 0;
#P connect 5 0 9 0;
#P lcolor 13;
#P connect 8 0 9 0;
#P connect 6 0 5 0;
#P connect 4 0 5 0;
#P lcolor 13;
#P connect 10 0 4 0;
#P window clipboard copycount 16;


June 6, 2007 | 10:15 pm

yup. wesley smith posted a jit.gl.lua code to do 3D texture buffering
earlier in the year.

you can do it in JS or java as well. :)

On Jun 6, 2007, at 6:03 PM, joshua goldberg wrote:

> is there a way to set up a video delay entirely as a buffer of
> textures? like using this technique (below), but entirely on the GPU?
>
> #P window setfont "Sans Serif" 9.;
> #P window linecount 1;
> #P newex 340 302 40 196617 % 300;
> #P newex 340 280 27 196617 -;
> #P newex 340 258 37 196617 + 300;
> #P outlet 303 410 15 0;
> #P inlet 422 134 15 0;
> #P inlet 302 133 15 0;
> #P newex 303 372 258 196617 jit.matrix 4 char 320 240 @usesrcdim 1
> @adapt 0;
> #P message 315 336 225 196617 srcdimstart 0 0 $1 , srcdimend 319
> 239 $1;
> #N counter 0 0 299;
> #X flags 0 0;
> #P newobj 321 189 83 196617 counter 0 0 299;
> #P message 331 212 225 196617 dstdimstart 0 0 $1 , dstdimend 319
> 239 $1;
> #P newex 302 233 262 196617 jit.matrix 4 char 320 240 300
> @usedstdim 1 @interp 0;
> #P newex 302 161 29 196617 t l b;
> #P comment 353 161 30 196617 Delay;
> #B color 10;
> #P comment 321 410 69 196617 Delayed Video;
> #P window linecount 2;
> #P comment 319 133 52 196617 Input Video;
> #P comment 440 133 64 196617 Delay Amount;
> #P connect 11 0 14 1;
> #P connect 14 0 15 0;
> #P connect 13 0 14 0;
> #P connect 7 0 6 0;
> #P connect 7 0 13 0;
> #P connect 4 1 7 0;
> #P connect 15 0 8 0;
> #P connect 9 0 12 0;
> #P connect 5 0 9 0;
> #P lcolor 13;
> #P connect 8 0 9 0;
> #P connect 6 0 5 0;
> #P connect 4 0 5 0;
> #P lcolor 13;
> #P connect 10 0 4 0;
> #P window clipboard copycount 16;
>
>

v a d e //

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


June 6, 2007 | 10:28 pm

Yes,
This is possible, but best done using JavaScript (or Lua if you are so
inclined) and will be severely limited if you don’t have enough texture
memory.

Here is an example of doing a JS texture array

AB


June 6, 2007 | 11:49 pm

awesome, thank you, this does it, enclosed is a patch which does not
encapsulate the render/window/vidplane in the js, for flexibility and
feedback. many thanks.

On Jun 6, 2007, at 6:28 PM, andrew benson wrote:

> Yes,
> This is possible, but best done using JavaScript (or Lua if you are so
> inclined) and will be severely limited if you don’t have enough
> texture
> memory.
>
> Here is an example of doing a JS texture array
>
> AB
>


June 7, 2007 | 12:22 am

Andrew & Joshua -

Excellent examples.

but to make Andrew’s work, you have to add the line

var outer = 0;

and to make joshua’s work, you have change the trigger object under the counter to

t b i

(assuming you’re each not throwing in a single typo to keep us on our toes)


June 7, 2007 | 12:37 am

no sir. it’s ‘t i i’ because the out frame needs an offset. let it
run, you’ll see.

On Jun 6, 2007, at 8:22 PM, Perry Hoberman wrote:

>
> Andrew & Joshua -
>
> Excellent examples.
>
> but to make Andrew’s work, you have to add the line
>
> var outer = 0;
>
> and to make joshua’s work, you have change the trigger object under
> the counter to
>
> t b i
>
> (assuming you’re each not throwing in a single typo to keep us on
> our toes)
>


June 7, 2007 | 2:33 am

however the version you posted had ‘t b b’

at least when I opened it

it did some nice things with ‘t b i’

it’s even better with ‘t i i’


June 7, 2007 | 5:04 am

wow. oops, thought i sent the newer version. whoops.

On Jun 6, 2007, at 10:33 PM, Perry Hoberman wrote:

>
> however the version you posted had ‘t b b’
>
> at the least when I opened it
>
> it did some nice things with ‘t b i’
>
> it’s even better with ‘t i i’
>


June 8, 2007 | 9:34 am

In a related topic (gl texture delay), I sent a question last week that appeared blank in the forums, so here it goes again:

I’ve tried to adapt the jsglvideotrail-example present in examplesjitter-examplesjavascriptrender to accept a jit.gl.texture object instead of a matrix.
I added a jit.gl.texture object before the matrix enters the js code and, in the js code, I changed the 2 references to "jit_matrix" with "jit_gl_texture".

The patch kind of works. It outputs an image, at least. Here’s the catch: while in the original matrix mode, each videoplane generated has a different texture (like a "time machine"), in the modified gl.texture version, the texture is the same for all planes.

The question is: is this a GL limitation of some sort? Or maybe the change to the js code needs to be a little more extreme? Is this possible at all?
Thank you in advance to any Javascript / OpenGL gurus out there…


June 8, 2007 | 11:31 am

Joshua and Andrew – This sounds really good, can you paste the js and patch in the thread for thos viewing it through the forum?
Many thanks,
-Nadav


June 8, 2007 | 4:18 pm

Pedro,
The reason that this doesn’t work as you expect is due to the difference
between the way that jit_gl_texture and jit_matrix function. Videoplane
copies an incoming matrix to its own internal instance of
jit_gl_texture, so essentially each copy of jit.gl.videoplane represents
a different texture. On the other hand, connecting a jit_gl_texture to
jit.gl.videoplane simply binds the given texture to the videoplane
(over-riding the internal texture). Since there is only one texture
getting bound to all of your videoplanes, they are all going to look
exactly the same (they are all the same texture). You will need to
provide some mechanism in your JS for copying the incoming texture to an
array of textures or something along those lines.

AB


June 8, 2007 | 8:12 pm

>Here is an example of doing a JS texture array

>AB

Please light me about the forum : where’s or how to get the example ? no example in the message …


June 8, 2007 | 11:21 pm

Here is the JS code:

//script for texture array management, much like jit.matrixset
// create our openGL context stuff
var window = new JitterObject("jit.window","odo");
window.size = [640,480];
var render = new JitterObject("jit.gl.render","odo");

//create our variables
var bank;//this will hold the array of textures
var ind = 0;//this is the index to write into
var vp; //videoplane array
var vpt = new Array();//texture assignments for videoplanes

//for the JS object
inlets = 1;
outlets=1;

//initialize
count(20);
planes();

function blend(x,y)
{
for(i=0;i<20;i++)
{
vp[i].blend_mode = [x,y];
}
}

function fade(x)
{
for(i=0;i<20;i++)
{
vp[i].color = [1.,1.,1.,x];
}
}

function count(c)
{
bank = null; //remove any leftovers

bank = new Array();//create an empty array

if (c<1)
c = 1;
vcount = c;

//fill the array with jit.gl.texture objects
for (var i=0;i
bank[i] = new JitterObject("jit.gl.texture","odo");
bank[i].adapt = 1;
}
}

//this handles incoming jit.matrix
function jit_matrix(g)
{
bank[ind].jit_matrix(g);
}

function index(x)
{
if (x<0) x = 0;
if(x>19) x= 19;
ind = x;
}

function out(x)
{
if(x<0) x = 0;
if(x>19) x= 19;
outer = x;
}

function planes()
{
vp= null;

vp = new Array();
for(x=0;x<20;x++)
{
vp[x]=new JitterObject("jit.gl.videoplane","odo");
vp[x].blend_enable= 1;
vp[x].dim = [2,2];
vp[x].displaylist = 1;
vp[x].transform_reset = 2;
//vp[x].scale= [0.2,1.,1.];
//vp[x].tex_scale_x = 5.;
//vp[x].tex_offset_x = -x*0.2;
//vp[x].tex_offset_y = 0.;
//vp[x].tex_scale_y = 1.;
//vp[x].position = [x*0.4-0.8,,0.];
vpt[x] = x;
}
}

//this handles the drawing of our OpenGL context
function bang()
{
render.erase();//clear the last frame
//vp.jit_gl_texture(bank[outer].name);//bind the appropriate texture to
videoplane
for(i=0;i<20;i++){
vpt[i]++;
if (vpt[i]>19) vpt[i]=0;
vp[i].jit_gl_texture(bank[(vpt[i])].name);
vp[i].draw();
}
//vp.draw();//draw videoplane
outlet(0,"bang");//send a bang for the fpsgui for benchmarking
render.drawclients();//draw the openGL contents into the framebuffer
render.swap();//move the contents of framebuffer onto screen
}


June 8, 2007 | 11:25 pm

And the patch I sent with it.

#P window setfont "Sans Serif" 9.;
#P number 274 40 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 230 82 38 196617 sel 10;
#N counter 10;
#X flags 0 0;
#P newobj 230 62 66 196617 counter 10;
#P flonum 100 27 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 130 185 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 130 206 44 196617 fade $1;
#P message 13 73 30 196617 open;
#P newex 13 124 98 196617 jit.qt.grab 640 480;
#P toggle 122 46 15 0;
#P newex 122 107 58 196617 random 50;
#P newex 122 80 29 196617 gate;
#P toggle 191 52 15 0;
#N counter 19;
#X flags 0 0;
#P newobj 220 108 66 196617 counter 19;
#P newex 191 81 29 196617 gate;
#P number 220 133 35 9 0 49 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 220 153 72 196617 prepend index;
#P number 122 132 35 9 0 49 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 122 152 62 196617 prepend out;
#P user jit.fpsgui 58 207 60 196617 0;
#P toggle 58 31 15 0;
#P newex 58 50 51 196617 qmetro 5;
#P newex 58 185 70 196617 js texBank.js;
#P connect 21 0 20 1;
#P connect 21 0 19 4;
#P connect 19 0 20 0;
#P fasten 8 0 14 0 196 101 18 101;
#P lcolor 7;
#P connect 8 0 19 0;
#P connect 7 0 6 0;
#P connect 9 0 7 0;
#P connect 20 0 9 0;
#P connect 1 0 0 0;
#P fasten 1 0 11 1 63 77 146 77;
#P fasten 1 0 8 1 63 77 215 77;
#P connect 10 0 8 0;
#P fasten 17 0 16 0 135 203;
#P connect 5 0 4 0;
#P connect 12 0 5 0;
#P connect 11 0 12 0;
#P connect 13 0 11 0;
#P connect 18 0 1 1;
#P connect 0 0 3 0;
#P connect 16 0 0 0;
#P fasten 14 0 0 0 18 179 63 179;
#P fasten 4 0 0 0 127 178 63 178;
#P fasten 6 0 0 0 225 178 63 178;
#P connect 2 0 1 0;
#P connect 15 0 14 0;
#P window clipboard copycount 22;


June 8, 2007 | 11:44 pm

Here’s a link to a texture delay line I made about a month ago:

http://www.mat.ucsb.edu/~whsmith/TextureDelay.zip

It written as a JS class so you can have multiple delay lines going in
one script. It can also take data form a texture or a matrix. If you
modify the patch, make sure to change this line

var texBuff = new TexBuffer("bump", [1024, 768], 10);

where bump is the context name

to match the name of the renderContext to match what jit.gl.render is
called (I guess I could make this an argument to the js object).

enjoy,
wes


June 11, 2007 | 2:02 pm

hi all. here are my examples.

first, the patch:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 425 447 30 196617 t b b;
#P message 478 509 49 196617 index $1;
#N counter 0 0 49;
#X flags 0 0;
#P newobj 423 423 77 196617 counter 0 0 49;
#P message 395 533 39 196617 out $1;
#P newex 395 509 34 196617 % 50;
#P newex 395 485 27 196617 +;
#P newex 361 593 106 196617 js phoenix.texbank.js;
#P button 241 608 15 0;
#P flonum 119 535 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 116 583 88 196617 param amount $1;
#P newex 198 648 255 196617 jit.gl.slab bork @file co.average.jxs
@colormode uyvy;
#P newex 336 395 94 196617 t b l b;
#P message 385 306 46 196617 settings;
#P message 340 306 30 196617 open;
#P newex 134 721 284 196617 jit.gl.videoplane bork @colormode uyvy
@transform_reset 2;
#P newex 292 334 181 196617 jit.qt.grab 640 480 @colormode uyvy;
#P message 134 50 34 196617 reset;
#P newex 134 74 188 196617 jit.gl.handle bork @inherit_transform 1;
#P message 375 135 70 196617 fullscreen $1;
#P toggle 375 115 15 0;
#P newex 375 92 38 196617 sel 27;
#P newex 375 70 40 196617 key;
#P number 91 41 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user jit.fpsgui 31 178 60 196617 0;
#P newex 34 269 416 196617 t b b b b b b b b b b b b b b b b b b b;
#P newex 34 245 40 196617 r stuff;
#P toggle 31 47 15 0;
#P newex 128 127 40 196617 s stuff;
#P newex 31 153 201 196617 jit.gl.render bork @erase_color 0. 0. 0. 1.;
#P newex 31 98 58 196617 t b b erase;
#P newex 31 73 57 196617 qmetro 33;
#P newex 375 156 207 196617 jit.window bork @floating 1 @depthbuffer 1;
#P connect 31 1 30 0;
#P connect 25 0 21 1;
#P connect 29 0 31 0;
#P connect 20 2 29 0;
#P connect 27 0 28 0;
#P connect 26 0 27 0;
#P connect 31 0 26 0;
#P connect 13 0 0 0;
#P connect 12 0 13 0;
#P connect 11 0 12 0;
#P connect 10 0 11 0;
#P connect 28 0 25 0;
#P connect 30 0 25 0;
#P connect 20 1 25 0;
#P connect 20 0 25 0;
#P connect 21 0 17 0;
#P fasten 21 0 20 0 563 689 563 371;
#P connect 7 13 16 0;
#P connect 18 0 16 0;
#P connect 19 0 16 0;
#P connect 22 0 21 0;
#P connect 24 0 21 0;
#P connect 16 0 21 0;
#P connect 15 0 14 0;
#P connect 2 1 4 0;
#P connect 23 0 22 0;
#P connect 9 0 1 1;
#P connect 6 0 7 0;
#P connect 3 0 8 0;
#P connect 14 0 3 0;
#P connect 2 0 3 0;
#P connect 2 2 3 0;
#P connect 1 0 2 0;
#P connect 5 0 1 0;
#P window clipboard copycount 32;

then save this as phoenix.texbank.js :

//script for texture array management, much like jit.matrixset

//create our variables
var bank;//this will hold the array of textures
var ind = 0;//this is the index to write into

//for the JS object
inlets = 1;
outlets=1;

//initialize
count(50);

function count(c)
{
bank = null; //remove any leftovers
bank = new Array();//create an empty array

if (c<1)
c = 1;
vcount = c;

//fill the array with jit.gl.texture objects
for (var i=0;i
bank[i] = new JitterObject("jit.gl.texture","bork");
bank[i].adapt = 1;
bank[i].colormode = "uyvy";
}
}

//this handles incoming jit.matrix
function jit_gl_texture(g)
{
bank[ind].jit_gl_texture(g);
}

function index(x)
{
if (x<0) x = 0;
if(x>49) x= 49;
ind = x;
}

function out(x)
{
if(x<0) x = 0;
if(x>49) x= 49;
outer = x;
}

//this sends the correct texture out
function bang()
{
outlet(0,"jit_gl_texture",bank[outer].name);

}

On Jun 8, 2007, at 7:31 AM, Nadav Assor wrote:

>
> Joshua and Andrew – This sounds really good, can you paste the js
> and patch in the thread for thos viewing it through the forum?
> Many thanks,
> -Nadav
>


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