Forums > Jitter

jit.gl.plato object

April 6, 2006 | 10:27 am

Hello All,

I am trying to create a cube where each of its plane is playing a
different movie/image. I have read that I need to wrap the images
after combine them in a matrix and then apply this to my cube. The
problem I am having is, I don’t know how I am going to re-set the
dimension of this matrix fred, so that I can fit this open cube shape
exactly in the matrix and wrap it properly to my cube.

also I welcome any comments on optimization and everything literally!

thanks
ilteris

#P window setfont "Sans Serif" 18.;
#P window linecount 4;
#P newex 777 412 354 196626 jit.gl.plato socrates @shape hexahedron
@texture platotex @lighting_enable 0 @smooth_shading 1 @position 0.
0. 0. @scale 0.5 0.5 0.5;
#P window linecount 1;
#P newex 375 435 231 196626 prepend texture platotex;
#P newex 375 480 382 196626 jit.gl.handle socrates @inherit_transform 1;
#P window linecount 2;
#P newex 378 548 222 196626 jit.gl.render socrates @erase_color 0. 0.
0. 1.;
#P window linecount 1;
#P newex 17 85 106 196626 t b erase b;
#P window setfont "Fixedwidth Serif" 10.;
#P window linecount 4;
#P newex 882 216 126 1441802 jit.matrix fred @usedstdim 1
@dstdimstart 72 143 @dstdimend 144 215;
#P newex 734 217 108 1441802 jit.matrix fred @usedstdim 1
@dstdimstart 72 0 @dstdimend 143 71;
#P newex 568 219 128 1441802 jit.matrix fred @usedstdim 1
@dstdimstart 216 71 @dstdimend 287 143;
#P newex 398 214 122 1441802 jit.matrix fred @usedstdim 1
@dstdimstart 144 71 @dstdimend 215 143;
#P window linecount 5;
#P newex 259 212 100 1441802 jit.matrix fred @usedstdim 1
@dstdimstart 72 71 @dstdimend 143 143;
#P window linecount 4;
#P newex 73 210 131 1441802 jit.matrix fred @usedstdim 1 @dstdimstart
0 71 @dstdimend 71 143;
#P window linecount 1;
#P newex 889 82 82 1441802 jit.qt.movie;
#P user jit.pwindow 888 108 74 74 0 1 0 0 1 0;
#P message 889 48 70 1441802 read 6.jpg;
#P newex 739 84 82 1441802 jit.qt.movie;
#P user jit.pwindow 738 110 74 74 0 1 0 0 1 0;
#P message 739 50 70 1441802 read 5.jpg;
#P newex 589 86 82 1441802 jit.qt.movie;
#P user jit.pwindow 588 112 74 74 0 1 0 0 1 0;
#P message 588 53 70 1441802 read 4.jpg;
#P newex 439 88 82 1441802 jit.qt.movie;
#P user jit.pwindow 438 114 74 74 0 1 0 0 1 0;
#P message 439 54 70 1441802 read 3.jpg;
#P newex 289 90 82 1441802 jit.qt.movie;
#P user jit.pwindow 297 120 74 74 0 1 0 0 1 0;
#P message 289 56 70 1441802 read 2.jpg;
#P newex 139 92 82 1441802 jit.qt.movie;
#P user jit.pwindow 138 118 74 74 0 1 0 0 1 0;
#P user jit.pwindow 15 414 302 202 0 1 0 0 1 0;
#P message 139 58 70 1441802 read 1.jpg;
#P toggle 8 20 15 0;
#P newex 36 54 58 1441802 metro 50;
#P comment 369 392 160 1441802 left top right bottom;
#P connect 22 0 4 0;
#P connect 27 0 4 0;
#P connect 25 0 4 0;
#P connect 26 0 4 0;
#P connect 24 0 4 0;
#P connect 23 0 4 0;
#P fasten 1 0 28 0 41 77 22 77;
#P fasten 2 0 1 0 13 38 41 38;
#P connect 5 0 22 0;
#P connect 28 2 6 0;
#P connect 3 0 6 0;
#P connect 6 0 5 0;
#P connect 8 0 23 0;
#P connect 28 2 9 0;
#P connect 7 0 9 0;
#P connect 9 0 8 0;
#P connect 4 0 31 0;
#P connect 30 0 29 0;
#P fasten 31 0 29 0 358 477 358 553;
#P connect 28 0 29 0;
#P connect 28 1 29 0;
#P connect 11 0 24 0;
#P connect 28 2 12 0;
#P connect 10 0 12 0;
#P connect 12 0 11 0;
#P connect 14 0 25 0;
#P connect 28 2 15 0;
#P connect 13 0 15 0;
#P connect 15 0 14 0;
#P connect 17 0 26 0;
#P connect 28 2 18 0;
#P connect 16 0 18 0;
#P connect 18 0 17 0;
#P connect 20 0 27 0;
#P connect 19 0 21 0;
#P connect 28 2 21 0;
#P connect 21 0 20 0;
#P window clipboard copycount 33;


April 6, 2006 | 2:15 pm

Hello,
there are a few issues in your patch, let’s sequence…

- matrix fred is automatically being resized to qt.movie dimensions, because
matrix by default adapts to input matrix dimensions. So, every fred should
have @adapt 0 attribute.
- but, with adapt 0, freds dims default to 1×1, so you have to properly
initialize freds dimensions,type and planecount. According to dstdimends in
your current freds, size of your fred should be 288×216, but because your
method of texturing(and plato) requires square textures, fred should be at
least 288 pixels wide, 288 px tall. Just add somewhere jit.matrix fred 4
char 288 288.
- this change in size will require you to adjust dstdim*, to move whole
thing down a bit(middle row should be centered). Checkout picture in
jit.gl.plato help patch, ‘p texture_maps’ subpatch, notice that images are
square, and that 6 images for cube are centered in that square image.
- as of optimization: remove all pwindows, never place them in ‘processing
chain’.

ok, I have to admit that all this was just from looking at your patch, I
didn’t actually do the stuff I suggested. Instead, I created patch taking
another approach, without the need to combine matrixes. This approach
creates 6 videoplanes, and forms a cube. Same method can be used to generate
cube by jit.gl.sketch, and numerous other cube recipes…

best,
nesa

#P window setfont Geneva 9.;
#P window linecount 1;
#N vpatcher 15 55 531 440;
#P window setfont Geneva 9.;
#P window linecount 0;
#P newex 215 223 52 9830409 onebang 1;
#P window linecount 1;
#P message 215 257 183 9830409 position 0. 0. -2.5 , rotate 55 0.7 -0.7 0;
#P inlet 215 197 15 0;
#P outlet 215 298 15 0;
#P connect 1 0 3 0;
#P connect 3 0 2 0;
#P connect 3 1 0 0;
#P connect 2 0 0 0;
#P pop;
#P newobj 25 126 22 9830409 p;
#P comment 542 317 312 9830409 up(rotated 90deg with rotatexyz , flipped
with -90 instead of 90);
#P comment 542 290 293 9830409 down(rotated 90deg with rotatexyz);
#P comment 542 262 293 9830409 right(rotated 90deg with rotatexyz);
#P comment 543 233 312 9830409 left(rotated 90deg with rotatexyz , flipped
with -90 instead of 90);
#P comment 542 203 166 9830409 back(filpped with rotatexyz);
#P newex 190 316 351 9830409 jit.gl.videoplane "fred’s playground" @position
0. 1. 0. @rotatexyz -90 0 0;
#P newex 190 287 351 9830409 jit.gl.videoplane "fred’s playground" @position
0. -1. 0. @rotatexyz 90 0 0;
#P message 118 99 28 9830409 read;
#P newex 71 135 58 9830409 jit.qt.movie;
#P newex 190 259 351 9830409 jit.gl.videoplane "fred’s playground" @position
1. 0. 0. @rotatexyz 0 90 0;
#P newex 190 231 351 9830409 jit.gl.videoplane "fred’s playground"
@position -1. 0. 0. @rotatexyz 0 -90 0;
#P newex 190 202 351 9830409 jit.gl.videoplane "fred’s playground" @position
0. 0. -1. @rotatexyz 0 180 0;
#P newex 190 172 351 9830409 jit.gl.videoplane "fred’s playground" @position
0. 0. 1.;
#P message 52 342 35 9830409 reset;
#P newex 25 97 56 9830409 t b erase b;
#P newex 52 366 248 9830409 jit.gl.handle "fred’s playground"
@inherit_transform 1;
#P newex 25 392 151 9830409 jit.gl.render "fred’s playground";
#P newex 24 439 196 9830409 jit.window "fred’s playground" @floating 1;
#P toggle 25 46 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 25 67 50 9109513 qmetro 5;
#P window setfont Geneva 9.;
#P comment 542 173 100 9830409 front;
#P comment 513 148 100 9830409 cube sides:;
#P connect 8 0 6 0;
#P connect 14 0 13 0;
#P connect 2 0 7 0;
#P connect 7 2 13 0;
#P connect 13 0 16 0;
#P connect 13 0 15 0;
#P connect 13 0 12 0;
#P connect 13 0 11 0;
#P connect 13 0 10 0;
#P connect 13 0 9 0;
#P fasten 7 1 5 0 53 155 30 155;
#P connect 6 0 5 0;
#P connect 22 0 5 0;
#P connect 3 0 2 0;
#P connect 7 0 22 0;
#P window clipboard copycount 23;


April 6, 2006 | 7:03 pm

wow, thanks nesa!
I learned lots of new things both from your comments and your code.

thanks again!
ilteris


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