share textures in different jit.gl.renders

Jan 8, 2009 at 11:19pm

share textures in different jit.gl.renders

hi

for a project i work with multiple video outputs (dvi)
so i figured out i have so create differnt jit.gl.render’s one for each screen. Is there a way to share jit.gl.textures between those jit.gl.renders ?
now it looks like i have to give the name of the render environment to a texture.
i dont wat to create each texture again for every output ( on my system i can have up to 8 outputs…)

#41600
Jan 8, 2009 at 11:31pm

#148195
Jan 9, 2009 at 10:18am

Hello,

I can’t get it working.
Are you sure about @shared_context ?

thank you.

max v2;
#N vpatcher 299 197 911 806;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 42 400 48 196617 loadbang;
#P newex 39 544 199 196617 jit.gl.videoplane contexte1 @texture tex1;
#P user jit.pwindow 65 475 38 30 0 1 0 0 1 0;
#P button 22 447 15 0;
#P newex 42 448 129 196617 jit.matrix 4 char 160 120;
#P message 42 425 140 196617 importmovie bball.mov , bang;
#P newex 42 510 175 196617 jit.gl.texture contexte1 @name tex1;
#P newex 319 435 199 196617 jit.gl.videoplane contexte2 @texture tex1;
#P message 316 226 148 196617 name contexte2 , size 160 120;
#P user jit.pwindow 315 247 162 122 0 1 0 0 1 0;
#X name contexte2;
#P newex 317 107 58 196617 t b b erase;
#P newex 317 143 242 196617 jit.gl.render contexte2 @shared_context contexte1;
#P toggle 179 34 15 0;
#P message 36 217 148 196617 name contexte1 , size 160 120;
#P user jit.pwindow 35 238 162 122 0 1 0 0 1 0;
#X name contexte1;
#P newex 179 59 63 196617 qmetro 100;
#P newex 37 98 58 196617 t b b erase;
#P newex 37 134 113 196617 jit.gl.render contexte1;
#P window linecount 2;
#P comment 322 164 178 196617 @shared_context permet de partager les ressources entre les 2 contextes;
#P comment 324 461 204 196617 cet objet appartient au contexte2 , mais utilise une texture issue du contexte1;
#P connect 6 0 5 0;
#P connect 4 0 3 0;
#P connect 3 0 2 0;
#P connect 3 2 2 0;
#P connect 19 0 14 0;
#P connect 16 0 15 0;
#P connect 14 0 15 0;
#P connect 15 0 13 0;
#P connect 15 0 17 0;
#P connect 7 0 4 0;
#P connect 11 0 10 0;
#P connect 4 0 9 0;
#P connect 9 0 8 0;
#P connect 9 2 8 0;
#P pop;

#148196
Jan 9, 2009 at 2:09pm

#148197
Jan 9, 2009 at 2:28pm

#148198
Jan 9, 2009 at 7:40pm

That last 4 context one *does not* work for me.

ou have two jit.gl.textures chained there, and if I remove the redundant texture, I get white video planes on everything but context 1.

If I have that the redundant texture, I have some gobbly gook bullshit that isnt the proper image.

Im going to say there is something wrong were with the order of GL operations or some state leak, that does not happen with the removal of that redundant texture. But im also guessing.

Either way, all you have demonstrated is something that works on your hardware, not on all.

The proper, supported method is to use shared context as explained.

#148199
Jan 9, 2009 at 7:43pm

Also, im not so sure the order of the shared contexts matter (ie which contexts shares with which in what order), all that matters is that it indicates it allows shared resources across the two (or more) contexts, but I have honestly not fully explored the ramifications of them.

In other languages/GL environments one can do:

context1

context2 @shared_context context1

context3 @shared_context context1

context4 @shared_context context1

and it basically allows all 4 to share textures, vbos etc (as I understand it).

#148200
Jan 9, 2009 at 8:00pm

#148201
Jan 9, 2009 at 8:01pm

#148202
Jan 9, 2009 at 8:05pm

Well, either way, I really would not rely on it. If you need shared context, use @shared_context ;)

I think this is something with jit.gl.texture, as I discovered it worked if I dicked with removing/re-instantiating jit.gl.texture (the redundant one I mentioned).

If you dont have that extra jit.gl.texture, no joy. So, Id say nice find, but, again, it seems more like errata than bonus functionality ;)

#148203
Jan 11, 2009 at 1:25am

so i tried it with two contexts and it worked

but cant get to work with 3 contexts

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 311 48 128 196617 shared_context hop3 hop2;
#P message 195 68 104 196617 shared_context hop3;
#P message 158 44 104 196617 shared_context hop2;
#P newex 812 229 175 196617 jit.gl.videoplane hop3 @texture tex1;
#P newex 811 202 82 196617 jit.window hop3;
#P newex 810 162 89 196617 jit.gl.render hop3;
#P newex 810 112 58 196617 t erase b b;
#P user jit.fpsgui 36 108 60 196617 0;
#P newex 535 228 175 196617 jit.gl.videoplane hop2 @texture tex1;
#P newex 534 201 82 196617 jit.window hop2;
#P newex 533 161 89 196617 jit.gl.render hop2;
#P newex 533 111 58 196617 t erase b b;
#P message 244 318 33 196617 start;
#P message 209 319 29 196617 stop;
#P newex 101 224 175 196617 jit.gl.videoplane hop1 @texture tex1;
#P newex 113 387 151 196617 jit.gl.texture hop1 @name tex1;
#P message 127 320 76 196617 read bball.mov;
#P newex 113 352 63 196617 jit.qt.movie;
#P newex 100 197 82 196617 jit.window hop1;
#P newex 100 160 302 196617 jit.gl.render hop1 @shared_context hop2 @shared_context hop3;
#P newex 99 107 58 196617 t erase b b;
#P toggle 99 54 15 0;
#P newex 99 81 57 196617 qmetro 40;
#P fasten 0 0 15 0 41 105;
#P connect 0 0 2 0;
#P fasten 0 0 11 0 292 98;
#P fasten 0 0 16 0 503 98;
#P connect 16 0 17 0;
#P fasten 16 1 17 0 839 149 815 149;
#P connect 11 0 12 0;
#P fasten 11 1 12 0 562 148 538 148;
#P connect 5 0 7 0;
#P fasten 10 0 5 0 249 343 118 343;
#P fasten 9 0 5 0 214 343 118 343;
#P fasten 6 0 5 0 132 343 118 343;
#P fasten 2 2 5 0 152 144 88 144 88 271 118 271;
#P fasten 20 0 3 0 163 149 105 149;
#P fasten 2 1 3 0 128 144 105 144;
#P connect 2 0 3 0;
#P fasten 21 0 3 0 200 153 105 153;
#P fasten 22 0 3 0 316 150 105 150;
#P connect 1 0 0 0;
#P window clipboard copycount 23;

#148204
Jan 11, 2009 at 1:34am

…and when i actualy move the jit.windows to external screens on different videocards ( i have 4) i get a total system freeze and have to manualy reboot…..

:(

#148205
Jan 11, 2009 at 2:06am

#148206
Jan 11, 2009 at 5:40pm

haven’t tested it but it looks like shared_context only works with outputs on the same videocard….

#148207
Jan 12, 2009 at 1:37am

#148208
Mar 1, 2009 at 2:58pm
jsrousseau wrote on Sun, 11 January 2009 03:06
yep it happens,
I normally use the triplehead2go from matrox, so 1 videocard out for
3 screens.

have had good results with this too. i had to setup an installation with 3 jitter openGL projections on hardware which wasnt my own, a multi-videocard PC. didnt work out. the matrox triplehead on my macbook pro’s single output saved the day in the end.

Quote:
which makes sense, unless you cards can share ressources

now that you mention it… that might very well have been the reason

#148209
Mar 1, 2009 at 3:50pm

btw, jitter recipe 39 can help you out: http://www.cycling74.com/story/2006/2/17/153427/406

#148210

You must be logged in to reply to this topic.