openGL preview and texture to matrix in Jitter 1.53 b2


    Sep 08 2006 | 2:17 pm
    Here is a patch that demonstrates some oddities when trying to do a shared context while doing a texture readback from that shared context. The upshot of the below patch is that jit.gl.texture is will convert to a jit.matrix only in fairly specific circumstances. More detail is in the patch.
    I haven't gone so far as to test on Jitter 1.6 on a PPC or MacIntel or XP, so I can't definitely say it's peculiar to 1.53. Boiling down the mysteries to a reproducable state on one machine was enough! If you need me to test on those platforms, I can.
    tested on OSX10.39, max 4.57,jitter 1.53b2, G4/350 with 800mhz card,ATI radeon 9800 graphics card
    Peter.

    • Sep 08 2006 | 3:28 pm
      Hi Peter,
      I haven't looked at your patch yet, but I noticed some wierdness with
      shared contexts the other day. Will look into it.
      thanks,
      wes
      On 9/8/06, pnyboer wrote:
      >
      > Here is a patch that demonstrates some oddities when trying to do a shared context while doing a texture readback from that shared context. The upshot of the below patch is that jit.gl.texture is will convert to a jit.matrix only in fairly specific circumstances. More detail is in the patch.
      >
      > I haven't gone so far as to test on Jitter 1.6 on a PPC or MacIntel or XP, so I can't definitely say it's peculiar to 1.53. Boiling down the mysteries to a reproducable state on one machine was enough! If you need me to test on those platforms, I can.
      >
      > tested on OSX10.39, max 4.57,jitter 1.53b2, G4/350 with 800mhz card,ATI radeon 9800 graphics card
      >
      > Peter.
      >
      >
      > #P window setfont Geneva 9.;
      > #P window linecount 1;
      > #P comment 445 431 163 196617 (also , it displays upside-down!);
      > #P window linecount 4;
      > #P comment 432 176 163 196617 tested on OSX10.39 , max 4.57 , jitter 1.53b2 , G4/350 with 800mhz card , ATI radeon 9800 graphics card;
      > #P window linecount 1;
      > #P comment 432 146 163 196617 pnyboer-at-slambassador-dot-com;
      > #P comment 432 129 163 196617 patch by peter nyboer;
      > #P window linecount 4;
      > #P comment 343 735 176 196617 Additionally , if I switch these dims to unmatching , then switch them back , I need to reset the colormode and mode attributes.;
      > #P window setfont "Sans Serif" 9.;
      > #P window linecount 1;
      > #P message 466 560 119 131137545 colormode rgb , mode static;
      > #P window setfont Geneva 9.;
      > #P window linecount 5;
      > #P comment 432 57 176 196617 The goal is to have a gl render context , share that context to a prevew window , then rasterize that preview window as needed to record or do other matrix-y things...;
      > #P window linecount 2;
      > #P comment 466 576 130 196617 (Raster window is blank until I set these attributes);
      > #P user jit.fpsgui 245 690 60 196617 2;
      > #P button 245 668 15 0;
      > #P window linecount 1;
      > #P comment 504 535 88 196617 > #P comment 430 255 77 196617 Raster Window;
      > #P comment 34 534 241 196617 These goodies create the "Preview Window" above.;
      > #P window linecount 3;
      > #P comment 446 391 163 196617 turn on to rasterize the preview...obstensibly for a jit.qt.record;
      > #P user jit.pwindow 428 266 162 122 0 1 0 0 1 0;
      > #P window linecount 1;
      > #P comment 197 418 163 196617 (named "preview");
      > #P window setfont "Sans Serif" 9.;
      > #P newex 120 90 65 131137545 loadmess 0.5;
      > #P window setfont Geneva 9.;
      > #P flonum 119 73 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      > #N vpatcher 10 59 527 327;
      > #P window setfont "Sans Serif" 9.;
      > #P window linecount 1;
      > #P newex 70 114 33 131137545 s last;
      > #P newex 312 79 34 131137545 s first;
      > #P newex 246 108 47 131137545 s 3plane;
      > #P newex 147 92 51 131137545 s 3dplane;
      > #P newex 206 84 45 131137545 s 2plane;
      > #P newex 174 114 45 131137545 s 1plane;
      > #P newex 270 80 40 131137545 s drive;
      > #P newex 108 113 45 131137545 s 0plane;
      > #P newex 76 50 288 131137545 t b b b b b b b b erase;
      > #P inlet 76 30 15 0;
      > #P outlet 76 71 15 0;
      > #P window setfont Geneva 9.;
      > #P window linecount 0;
      > #P comment 74 148 336 196617 automatic is off. order of layers in render is determined by these bangs;
      > #P connect 3 1 11 0;
      > #P connect 2 0 3 0;
      > #P connect 3 0 1 0;
      > #P connect 3 8 1 0;
      > #P connect 3 1 4 0;
      > #P connect 3 2 8 0;
      > #P connect 3 3 6 0;
      > #P connect 3 4 7 0;
      > #P connect 3 5 9 0;
      > #P connect 3 6 5 0;
      > #P connect 3 7 10 0;
      > #P pop;
      > #P newobj 34 222 43 196617 p bangs;
      > #P user jit.pwindow 197 296 162 122 0 1 0 0 1 0;
      > #X name preview;
      > #P toggle 431 389 15 0;
      > #P window setfont "Sans Serif" 9.;
      > #N vpatcher 10 59 331 332;
      > #P window setfont "Sans Serif" 9.;
      > #P newex 76 42 57 131137545 loadmess 0;
      > #P flonum 221 139 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P message 217 162 37 131137545 rate $1;
      > #P message 185 163 27 131137545 stop;
      > #P message 146 162 32 131137545 start;
      > #P newex 58 109 41 131137545 r drive;
      > #P newex 62 157 65 131137545 prepend read;
      > #B color 5;
      > #P user umenu 54 69 100 131137575 1 64 83 1;
      > #X add :patches:media:dozer.mov;
      > #X add :patches:media:dishes.mov;
      > #X add :patches:media:blading.mov;
      > #X add :patches:media:bball.mov;
      > #X add :patches:media:countdown15.mov;
      > #X add :patches:media:rca.mov;
      > #X add :patches:media:ozone.mov;
      > #X add :patches:media:sunset.jpg;
      > #X add :patches:media:DSCF0367.JPG;
      > #X add :patches:media:DSCF0372.JPG;
      > #X add :patches:media:chilis.jpg;
      > #X add :patches:media:grid.gif;
      > #P inlet 53 45 15 0;
      > #P outlet 33 215 15 0;
      > #P newex 31 188 165 131137545 jit.qt.movie 320 240 @autostart 1;
      > #B color 5;
      > #P connect 5 0 0 0;
      > #P connect 8 0 0 0;
      > #P connect 4 0 0 0;
      > #P connect 6 0 0 0;
      > #P connect 7 0 0 0;
      > #P connect 0 0 1 0;
      > #P connect 2 0 3 0;
      > #P connect 10 0 3 0;
      > #P connect 3 1 4 0;
      > #P connect 9 0 8 0;
      > #P pop;
      > #P newobj 180 72 35 131137545 p mov;
      > #P window setfont Geneva 9.;
      > #P message 256 185 70 196617 size 320 240;
      > #P message 256 206 70 196617 size 640 480;
      > #P message 258 226 76 196617 size 1024 768;
      > #P window setfont "Sans Serif" 9.;
      > #N vpatcher 10 59 331 332;
      > #P window setfont "Sans Serif" 9.;
      > #P newex 76 42 57 131137545 loadmess 1;
      > #P flonum 221 139 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P message 217 162 37 131137545 rate $1;
      > #P message 185 163 27 131137545 stop;
      > #P message 146 162 32 131137545 start;
      > #P newex 58 109 41 131137545 r drive;
      > #P newex 62 157 65 131137545 prepend read;
      > #B color 5;
      > #P user umenu 54 69 100 131137575 1 64 83 1;
      > #X add :patches:media:dozer.mov;
      > #X add :patches:media:dishes.mov;
      > #X add :patches:media:blading.mov;
      > #X add :patches:media:bball.mov;
      > #X add :patches:media:countdown15.mov;
      > #X add :patches:media:rca.mov;
      > #X add :patches:media:ozone.mov;
      > #X add :patches:media:sunset.jpg;
      > #X add :patches:media:DSCF0367.JPG;
      > #X add :patches:media:DSCF0372.JPG;
      > #X add :patches:media:chilis.jpg;
      > #X add :patches:media:grid.gif;
      > #P inlet 53 45 15 0;
      > #P outlet 33 215 15 0;
      > #P newex 31 188 165 131137545 jit.qt.movie 320 240 @autostart 1;
      > #B color 5;
      > #P connect 7 0 0 0;
      > #P connect 6 0 0 0;
      > #P connect 4 0 0 0;
      > #P connect 8 0 0 0;
      > #P connect 5 0 0 0;
      > #P connect 0 0 1 0;
      > #P connect 2 0 3 0;
      > #P connect 10 0 3 0;
      > #P connect 3 1 4 0;
      > #P connect 9 0 8 0;
      > #P pop;
      > #P newobj 223 72 35 131137545 p mov;
      > #P window setfont "Sans Serif" 14.;
      > #N vpatcher 551 255 1108 654;
      > #P origin -31 0;
      > #P window setfont "Sans Serif" 9.;
      > #P window linecount 1;
      > #P message 318 183 76 131137545 size 1024 768;
      > #P window linecount 0;
      > #P newex 93 177 16 131137545 t l;
      > #N comlet to window;
      > #P inlet 309 96 15 0;
      > #P button 70 33 15 0;
      > #N vpatcher 157 436 642 652;
      > #P origin -30 9;
      > #P window setfont "Sans Serif" 9.;
      > #P window linecount 1;
      > #P hidden newex 509 124 64 131137545 s resetwin;
      > #P hidden newex 309 350 40 131137545 t 0 l 1;
      > #P window linecount 0;
      > #P hidden newex 119 424 75 131137545 prepend floating;
      > #P hidden newex 468 271 72 131137545 prepend coords;
      > #P hidden newex 472 236 81 131137545 v fullscreen_mon;
      > #P hidden newex 474 206 65 131137545 r fullscreenon;
      > #P hidden newex 538 50 68 131137545 r fullscreenoff;
      > #P hidden newex 124 391 60 131137545 prepend rect;
      > #P hidden newex 242 47 56 131137545 loadmess 1;
      > #P hidden newex 509 89 19 131137545 t b;
      > #P comment 152 113 124 131137545 no hardware acceleration;
      > #P hidden message 83 226 53 131137545 noaccel $1;
      > #P toggle 135 113 15 0;
      > #P comment 152 132 245 131137545 sync;
      > #P hidden message 196 235 45 131137545 sync $1;
      > #P toggle 135 132 15 0;
      > #P hidden message 139 231 40 131137545 fsaa $1;
      > #P comment 152 93 100 131137545 anti-aliased;
      > #P toggle 135 93 15 0;
      > #P hidden newex 205 416 20 131137545 t b;
      > #P hidden newex 205 395 69 131137545 r altwindowtest;
      > #P button 1 85 15 0;
      > #P comment 19 84 100 131137545 make 320;
      > #P hidden message 5 173 91 131137545 rect 10 100 330 340;
      > #P hidden message 83 299 101 131137545 rect 30 30 670 510;
      > #P hidden message 91 279 101 131137545 rect 30 30 830 630;
      > #P button 2 63 15 0;
      > #P comment 19 63 100 131137545 make 640;
      > #P hidden message 480 82 16 131137545 0;
      > #P hidden newex 462 52 38 131137545 sel 27;
      > #P hidden newex 462 29 40 131137545 key;
      > #P hidden message 225 417 55 131137545 xy 100 610;
      > #N thispatcher;
      > #Q window flags grow close zoom nofloat;
      > #Q window size 157 436 642 652;
      > #Q window title;
      > #Q window exec;
      > #Q savewindow 1;
      > #Q end;
      > #P hidden newobj 276 439 61 131137545 thispatcher;
      > #P hidden inlet 362 388 15 0;
      > #P toggle 135 25 15 0;
      > #P button 318 77 15 0;
      > #P comment 335 77 100 131137545 get monitor 2 coords;
      > #P button 318 58 15 0;
      > #P comment 337 58 100 131137545 get monitor 1 coords;
      > #P hidden newex 277 312 51 131137545 zl slice 1;
      > #P hidden newex 277 293 67 131137545 route coords;
      > #P hidden message 302 250 45 131137545 coords 1;
      > #P hidden message 283 223 45 131137545 coords 0;
      > #P hidden newex 277 272 61 131137545 jit.displays;
      > #P hidden newex 124 365 93 131137545 prepend fullscreen;
      > #P comment 152 70 100 131137545 fullscreen;
      > #P toggle 135 70 15 0;
      > #P hidden outlet 77 397 15 0;
      > #P comment 152 48 100 131137545 doublebuffer;
      > #P toggle 135 48 15 0;
      > #P hidden newex 104 334 104 131137545 prepend doublebuffer;
      > #P comment 152 27 150 131137545 float the window (esc unfloats);
      > #P button 2 43 15 0;
      > #P comment 19 43 100 131137545 make 800;
      > #P button 2 22 15 0;
      > #P hidden message 105 258 95 131137545 rect 0 0 1024 768;
      > #P comment 19 22 100 131137545 make 1024;
      > #P hidden newex 292 414 86 131137545 windsize 550 200 2;
      > #P hidden connect 48 0 34 0;
      > #P hidden connect 36 0 34 0;
      > #P hidden connect 55 0 10 0;
      > #P hidden connect 2 0 10 0;
      > #P hidden connect 32 0 10 0;
      > #P hidden connect 33 0 10 0;
      > #P hidden connect 34 0 10 0;
      > #P hidden connect 46 0 10 0;
      > #P hidden connect 43 0 10 0;
      > #P hidden connect 41 0 10 0;
      > #P hidden connect 13 0 10 0;
      > #P hidden connect 7 0 10 0;
      > #P hidden connect 50 0 10 0;
      > #P hidden connect 45 0 46 0;
      > #P hidden connect 31 0 33 0;
      > #P hidden connect 5 0 32 0;
      > #P hidden connect 8 0 7 0;
      > #P hidden connect 3 0 2 0;
      > #P hidden connect 23 0 55 0;
      > #P hidden connect 29 0 55 0;
      > #P connect 56 2 55 0;
      > #P hidden connect 11 0 13 0;
      > #P connect 56 1 50 0;
      > #P hidden connect 49 0 8 0;
      > #P hidden connect 39 0 41 0;
      > #P hidden connect 42 0 43 0;
      > #P hidden connect 37 0 38 0;
      > #P hidden connect 38 0 26 0;
      > #P hidden connect 0 0 25 0;
      > #P hidden connect 54 0 14 0;
      > #P hidden connect 16 0 14 0;
      > #P hidden connect 15 0 14 0;
      > #P hidden connect 14 0 17 0;
      > #P hidden connect 17 0 18 0;
      > #P hidden connect 20 0 15 0;
      > #P hidden connect 26 0 0 0;
      > #P hidden connect 22 0 16 0;
      > #P connect 18 1 56 0;
      > #P hidden connect 24 0 0 1;
      > #P hidden connect 27 0 28 0;
      > #P hidden connect 53 0 54 0;
      > #P hidden connect 52 0 53 0;
      > #P hidden connect 28 0 29 0;
      > #P hidden connect 51 0 29 0;
      > #P hidden connect 28 0 48 0;
      > #P hidden connect 51 0 48 0;
      > #P connect 28 0 57 0;
      > #P pop;
      > #P newobj 69 57 90 131137545 p WindowProperties;
      > #P message 223 119 62 131137545 name Output;
      > #P inlet 223 96 15 0;
      > #P newex 106 113 45 131137545 loadbang;
      > #P newex 108 212 219 131137545 jit.window livid @visible 1 @floating 0 @grow 0 @rect 10 100 330 340 @fsaa 1 @sync 0;
      > #P message 106 137 70 131137545 size 320 240;
      > #P connect 6 0 5 0;
      > #P connect 7 0 8 0;
      > #P connect 5 0 8 0;
      > #P connect 0 0 8 0;
      > #P connect 2 0 0 0;
      > #P connect 4 0 1 0;
      > #P connect 9 0 1 0;
      > #P connect 8 0 1 0;
      > #P connect 3 0 4 0;
      > #P pop;
      > #P newobj 186 248 115 131137550 p OutputWindow;
      > #P window setfont "Sans Serif" 9.;
      > #P newex 185 226 28 131137545 sel 1;
      > #P newex 61 278 35 131137545 r toGL;
      > #N vpatcher 351 197 943 626;
      > #P origin -220 -12;
      > #N comlet ch B;
      > #P inlet 75 74 15 0;
      > #P objectname chB[1];
      > #P window setfont "Sans Serif" 9.;
      > #P window linecount 1;
      > #P message 374 254 47 131137545 enable 1;
      > #P flonum 72 52 35 9 0 0 0 2001 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P newex 39 96 80 131137545 scale 0. 1. 1. 0.;
      > #P newex 185 168 39 131137545 s 2pvu;
      > #P newex 227 168 39 131137545 s 1pvu;
      > #P newex 322 221 58 131137545 r 1metrics;
      > #P newex 15 245 45 131137545 r 2plane;
      > #P newex 23 123 45 131137545 gate 1 1;
      > #N comlet ch B;
      > #P inlet 188 98 15 0;
      > #P objectname chB;
      > #N comlet ch A;
      > #P inlet 230 98 15 0;
      > #P objectname chA;
      > #P newex 20 155 28 131137545 !- 1.;
      > #P message 14 212 82 131137545 color 1. 1. 1. $1;
      > #P newex 47 288 22 131137545 thr;
      > #P message 115 195 82 131137545 color 1. 1. 1. $1;
      > #P newex 280 258 45 131137545 r 1plane;
      > #P window linecount 2;
      > #P newex 258 283 260 131137545 jit.gl.videoplane Output @depth_enable 0 @blend_enable 1 @color 1. 1. 1. 1. @automatic 0 @blend_mode 6 1;
      > #P newex 41 318 260 131137545 jit.gl.videoplane Output @depth_enable 0 @blend_enable 1 @color 1. 1. 1. 0. @automatic 0 @blend_mode 6 1;
      > #P connect 6 0 5 0;
      > #P connect 9 0 6 0;
      > #P connect 15 0 14 0;
      > #P connect 17 0 14 0;
      > #P connect 4 0 0 0;
      > #P connect 8 0 4 0;
      > #P connect 5 0 4 0;
      > #P lcolor 8;
      > #P connect 10 0 4 0;
      > #P lcolor 8;
      > #P connect 14 0 9 1;
      > #P connect 9 0 3 0;
      > #P connect 8 0 13 0;
      > #P connect 7 0 12 0;
      > #P connect 2 0 1 0;
      > #P connect 11 0 1 0;
      > #P connect 3 0 1 0;
      > #P connect 16 0 1 0;
      > #P connect 7 0 1 0;
      > #P pop;
      > #P newobj 120 111 123 131137545 p planes;
      > #P newex 34 199 43 131137545 jit.qball;
      > #P toggle 28 67 15 0;
      > #P newex 34 174 45 131137545 metro 2;
      > #P window linecount 3;
      > #P newex 33 303 157 131137545 jit.gl.render Output @erase_color 0 0 0 1 @scale 1.33333 1. 1. @ortho 2 @camera 0 0 2;
      > #P window setfont Geneva 9.;
      > #P window linecount 1;
      > #P comment 197 285 163 196617 Preview Window (shared context);
      > #P window linecount 4;
      > #P comment 79 225 100 196617 automatic is off. order of layers in render is determined by these bangs;
      > #P window linecount 1;
      > #P comment 27 53 45 196617 •on/off;
      > #P comment 119 58 35 196617 xfade;
      > #P toggle 311 620 15 0;
      > #P window setfont "Sans Serif" 10.;
      > #P newex 277 619 31 131137546 gate;
      > #P window setfont "Sans Serif" 9.;
      > #P message 455 630 68 131137545 dim 640 480 1;
      > #P button 244 618 15 0;
      > #P message 343 716 60 131137545 dim 640 480;
      > #P newex 457 611 59 131137545 prepend set;
      > #P window setfont "Sans Serif" 12.;
      > #P message 415 559 48 131137548 getdim;
      > #P window setfont "Sans Serif" 9.;
      > #P message 343 694 60 131137545 dim 320 240;
      > #P window setfont "Sans Serif" 10.;
      > #P newex 277 648 121 131137546 jit.matrix 4 char 320 240;
      > #P newex 467 532 38 131137546 r drive;
      > #P newex 432 532 31 131137546 gate;
      > #P window setfont "Sans Serif" 9.;
      > #P newex 147 471 18 131137545 t l;
      > #P newex 147 408 41 131137545 sel 1 0;
      > #P newex 34 514 310 131137545 jit.gl.videoplane preview @scale 1.333 1 @texture previewrender;
      > #P message 147 451 148 131137545 shared_context , copy_texture;
      > #P toggle 34 427 15 0;
      > #P newex 34 446 51 131137545 qmetro 33;
      > #P newex 34 467 50 131137545 t b erase;
      > #P newex 34 492 105 131137545 jit.gl.render preview;
      > #P window linecount 2;
      > #P newex 276 580 178 131137545 jit.gl.texture preview @name previewrender @dim 160 120 @adapt 1;
      > #P window linecount 1;
      > #P message 147 432 258 131137545 shared_context preview , copy_texture previewrender;
      > #P window setfont "Sans Serif" 10.;
      > #P newex 35 383 63 131137546 loadmess 1;
      > #P window setfont Geneva 9.;
      > #P window linecount 3;
      > #P comment 407 693 176 196617 if this dimension doesn't match the dim from jit.gl.texture above , then the Preview Window turns blank;
      > #P connect 32 0 27 0;
      > #P connect 42 0 27 0;
      > #P connect 11 0 27 0;
      > #P connect 29 0 28 0;
      > #P connect 28 0 30 0;
      > #P connect 30 0 42 0;
      > #P connect 1 0 7 0;
      > #P connect 7 0 6 0;
      > #P connect 6 0 5 0;
      > #P fasten 5 0 4 0 39 488 39 488;
      > #P fasten 5 1 4 0 79 488 39 488;
      > #P connect 44 0 43 0;
      > #P connect 43 0 31 0;
      > #P connect 1 0 10 0;
      > #P connect 10 0 2 0;
      > #P connect 10 1 8 0;
      > #P connect 8 0 11 0;
      > #P connect 2 0 11 0;
      > #P connect 39 0 31 1;
      > #P connect 29 0 33 0;
      > #P connect 33 0 34 0;
      > #P connect 35 0 31 2;
      > #P connect 3 0 19 0;
      > #P connect 14 0 51 0;
      > #P connect 14 0 52 0;
      > #P connect 55 0 3 0;
      > #P connect 16 0 3 0;
      > #P connect 12 0 3 0;
      > #P fasten 40 0 21 0 436 517 261 579 261 604;
      > #P connect 22 0 21 0;
      > #P connect 21 0 14 0;
      > #P connect 15 0 14 0;
      > #P connect 18 0 14 0;
      > #P connect 36 0 34 1;
      > #P connect 38 0 34 1;
      > #P connect 37 0 34 1;
      > #P connect 3 0 21 1;
      > #P fasten 14 0 46 0 282 672 626 672 618 265 434 265;
      > #P connect 40 0 12 0;
      > #P connect 13 0 12 1;
      > #P connect 17 0 20 0;
      > #P connect 3 1 17 0;
      > #P window clipboard copycount 61;
      >
      > --
      > |||||||||||||||||||||||||||||||
      > Brown Cocktail
      > 3/4 oz light rum
      > 3/4 oz gin
      > 3/4 oz dry vermouth
      > Shake with ice and serve
      > in chilled cocktail glass
      > |||||||||||||||||||||||||||||||
      >