sliding texture

Nov 15, 2006 at 12:35pm

sliding texture

hi list, a small problem pooped up when working on an opengl keystone
method.
i render to texture and dump onto a gl.nurb surface, manipulating the
ctlmatrix to fix the keystone (where those this word come from?)
problem is when moving the camera the texture slides off the nurb surface.
please look at this patch and enlighten me.
other then that this is quite a handy thing, use and abuse.

max v2;
#N vpatcher 432 43 961 936;
#P origin -2 -190;
#P window setfont “Sans Serif” 12.;
#P window linecount 1;
#P comment 158 36 92 9109516 nurbs keystone;
#P window setfont “Sans Serif” 9.;
#P comment 178 76 275 9109513 shift+s and shift+r >save ctlmatrix;
#P comment 178 59 275 9109513 shift+q >enabledisable control points (move
them with mouse);
#P window setfont “Proportional Serif” 12.;
#P comment 253 686 165 9175052 change value here to see problem;
#P window setfont “Sans Serif” 9.;
#P newex 3 372 29 9109513 s tog;
#P newex 2 349 30 9109513 t b b;
#P window setfont “Fixedwidth Serif” 9.;
#P flonum 211 688 39 9 0 0 0 141 0 0 0 255 227 23 222 222 222 0 0 0;
#P window setfont “Proportional Serif” 10.;
#P comment 306 740 73 9175050 lookat position;
#P comment 332 753 39 9175050 y;
#P comment 289 753 39 9175050 x;
#P window setfont “Fixedwidth Serif” 9.;
#P flonum 330 769 39 9 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 289 769 39 9 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 248 791 133 9240586 pak lookat 0. 0. 0.;
#P window setfont “Proportional Serif” 10.;
#P comment 172 740 73 9175050 camera position;
#P comment 239 753 39 9175050 z;
#P comment 197 753 39 9175050 y;
#P comment 154 753 39 9175050 x;
#P window setfont “Fixedwidth Serif” 9.;
#P flonum 236 769 39 9 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 195 769 39 9 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 154 769 39 9 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 113 791 133 9240586 pak camera 0. 0. 2.;
#P newex 113 829 72 9240586 s render1;
#P window setfont “Sans Serif” 9.;
#P newex 52 478 45 9109513 r render1;
#P message 242 269 85 9109513 dispose;
#P message 151 269 85 9109513 read cf.sobel.jxs;
#P newex 127 294 77 9109513 jit.gl.slab doo;
#P window linecount 2;
#P newex 169 155 344 9109513 jit.gl.gridshape doo @shape sphere @automatic 0
@lighting_enable 1 @depth_enable 1 @smooth_shading 1 @blend_enable 1
@position 0.8 0.8 0;
#P window linecount 1;
#P newex 155 198 346 9109513 jit.gl.gridshape doo @shape cube @automatic 0
@color 1. 1. 1. @scale 0.3 0.3 0;
#P message 141 220 156 9109513 usetexture target , to_texture , erase;
#P newex 113 131 66 9109513 t b b b b b;
#P newex 127 242 328 9109513 jit.gl.texture doo @name target @adapt 1;
#P message 46 373 23 9109513 doo;
#N vpatcher 41 454 664 854;
#P window setfont “Sans Serif” 9.;
#P flonum 568 52 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 0;
#P newex 447 72 130 9109513 jit.op @op + pass @val 0;
#P newex 33 119 40 9109513 r tog;
#P newex 670 178 40 9109513 s tog;
#P toggle 40 145 15 0;
#P newex 42 163 40 9109513 gate;
#P newex 590 167 59 9109513 togedge;
#B color 5;
#P window setfont “Sans Serif” 12.;
#P message 530 120 82 9109516 shift+s , shift+r;
#B color 5;
#P objectname wr[1];
#P window setfont “Sans Serif” 9.;
#P newex 523 147 40 9109513 key;
#B color 5;
#P newex 523 170 59 9109513 sel 83 82 81;
#B color 5;
#P newex 156 242 100 9109513 jit.op @op * @val 1.33;
#P flonum 418 174 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 256 158 118 9109513 jit.op @op pass * @val 0.5;
#P flonum 382 174 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 256 182 118 9109513 jit.op @op * pass @val 0.5;
#P newex 40 46 71 9109513 t b b s;
#N comlet bang;
#P inlet 8 30 15 0;
#N comlet drawto;
#P inlet 40 29 15 0;
#P newex 101 93 71 9109513 prepend drawto;
#P comment 176 412 126 9109513 set window to @idlemouse 1;
#P comment 176 429 67 9109513 from window;
#N comlet from window;
#P inlet 245 429 15 0;
#P objectname from_window;
#P window linecount 2;
#P comment 58 250 96 9109513 currntly set to gl.nurb @dim 4 3 @order 0;
#N comlet to gl.nurb;
#P outlet 156 289 15 0;
#P objectname to_gl.nurbs;
#P window linecount 1;
#P comment 239 635 67 9109513 from gl.render;
#N comlet to gl.render;
#P outlet 62 620 15 0;
#P objectname to_gl.render;
#N comlet from gl.render;
#P inlet 308 635 15 0;
#P objectname from_gl.render;
#P number 359 242 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 272 94 42 9109513 < < reset;
#P message 572 195 85 9109513 read key.jxf , bang;
#B color 5;
#P objectname rd;
#P message 507 195 63 9109513 write key.jxf;
#B color 5;
#P objectname wr;
#P newex 183 117 60 9109513 t b l;
#P newex 245 472 27 9109513 t b l;
#P newex 446 646 146 9109513 pack setcell 1 1 val 0. 0.;
#B color 5;
#P newex 549 601 48 9109513 gate;
#P newex 549 575 34 9109513 < 0.1;
#P newex 645 397 45 9109513 zl slice 2;
#P message 607 350 31 9109513 dump;
#P newex 645 254 146 9109513 t l reset clear;
#B color 5;
#P newex 645 324 131 9109513 zl rot 2;
#B color 5;
#P newex 645 347 131 9109513 Ltocoll;
#B color 5;
#N coll ;
#P newobj 645 375 131 9109513 coll;
#B color 5;
#P newex 645 300 100 9109513 pack 0. 0. 0 0;
#B color 5;
#P newex 257 216 170 9109513 jit.matrix 2 float32 @dim 4 2 @adapt 0;
#P newex 645 277 131 9109513 jit.iter;
#B color 5;
#P newex 62 570 44 9109513 zl slice 2;
#P newex 279 526 44 9109513 togedge;
#P newex 691 451 60 9109513 unpack 0. 0.;
#P newex 650 423 55 9109513 t b l;
#P newex 656 476 27 9109513 f;
#P newex 623 451 60 9109513 unpack 0. 0.;
#P newex 606 476 27 9109513 f;
#P newex 628 538 120 9109513 expr sqrt($f1*$f1+$f2*$f2);
#P newex 693 511 58 9109513 expr $f1-$f2;
#P newex 628 512 58 9109513 expr $f1-$f2;
#P newex 307 654 89 9109513 route screentoworld;
#P newex 245 449 105 9109513 route mouse mouseidle;
#P newex 245 502 44 9109513 zl slice 2;
#P newex 307 676 44 9109513 zl slice 2;
#P message 62 594 91 9109513 screentoworld $1 $2;
#P newex 257 242 100 9109513 jit.op @op * @val 20;
#P newex 156 265 80 9109513 prepend ctlmatrix;
#P button 255 94 15 5;
#P window linecount 2;
#P newex 256 116 246 9109513 jit.gl.gridshape table @shape plane @dim 4 2
@automatic 0 @matrixoutput 1 @poly_mode 1 1;
#P button 57 309 15 0;
#P newex 41 335 347 9109513 jit.gl.gridshape table @shape circle @scale 0.05
0.05 @automatic 0 @depth_enable 1 @dim 10 10 @name mee @color 0. 0. 1. 0.7;
#P newex 257 266 168 9109513 jit.gl.multiple table 2 @targetname mee
@glparams position @automatic 0;
#B color 5;
#P comment 428 575 115 9109513 on click , find nearest point and changes
its location;
#P window linecount 1;
#P comment 81 621 100 9109513 to gl.render;
#P comment 108 289 47 9109513 to gl.nurb;
#P window setfont “Sans Serif” 10.;
#P comment 452 47 113 9109514 this offset the ctlmatrix;
#P connect 53 0 55 0;
#P connect 68 0 66 0;
#P connect 52 0 5 0;
#P connect 6 0 5 0;
#P connect 55 1 5 0;
#P connect 66 0 65 0;
#P fasten 14 1 25 0 297 559 67 559;
#P connect 25 0 11 0;
#P fasten 13 0 11 0 250 591 67 591;
#P connect 11 0 45 0;
#P connect 54 0 65 1;
#P connect 55 2 52 0;
#P connect 27 0 9 0;
#P connect 60 0 9 0;
#P connect 9 0 47 0;
#P connect 37 0 39 0;
#P connect 49 0 14 0;
#P connect 14 0 38 0;
#P connect 38 1 13 0;
#P fasten 70 0 8 0 260 67;
#P hidden connect 57 0 8 0;
#P hidden connect 43 0 8 0;
#P fasten 55 0 8 0 45 79 260 79;
#P connect 59 0 8 0;
#P connect 52 0 7 0;
#P connect 8 0 7 0;
#P connect 7 0 58 0;
#P connect 58 0 56 0;
#P connect 69 0 27 0;
#P hidden fasten 40 0 27 0 512 215 262 215;
#P hidden fasten 41 0 27 0 577 215 262 215;
#P connect 39 1 27 0;
#P connect 39 0 27 0;
#P connect 65 0 27 0;
#P connect 27 0 10 0;
#P connect 52 0 4 0;
#P connect 10 0 4 0;
#P connect 13 1 24 0;
#P connect 44 0 15 0;
#P connect 15 0 12 0;
#P hidden connect 43 0 10 1;
#P hidden connect 59 0 58 1;
#P connect 57 0 56 1;
#P fasten 38 0 37 0 250 497 451 497;
#P connect 56 0 69 0;
#P fasten 36 0 37 1 554 633 478 633;
#P connect 61 0 40 0;
#P connect 62 0 61 0;
#P fasten 18 0 35 0 633 561 554 561;
#P connect 35 0 36 0;
#P connect 12 0 37 4;
#P connect 70 0 69 1;
#P connect 61 1 41 0;
#P fasten 34 0 36 1 650 419 592 419;
#P connect 61 2 64 0;
#P connect 22 0 19 0;
#P connect 24 0 33 0;
#P connect 12 0 20 0;
#P connect 20 0 19 1;
#P connect 19 0 16 0;
#P connect 16 0 18 0;
#P fasten 27 0 32 0 263 238 650 238;
#P connect 32 0 26 0;
#P connect 26 0 28 0;
#P connect 28 0 31 0;
#P connect 31 0 30 0;
#P connect 32 1 30 0;
#P connect 30 0 29 0;
#P fasten 32 2 29 0 786 370 650 370;
#P fasten 33 0 29 0 612 371 650 371;
#P connect 29 0 34 0;
#P fasten 34 1 22 0 685 419 655 419;
#P connect 22 0 21 0;
#P connect 64 0 67 0;
#P connect 64 1 67 0;
#P connect 20 1 21 1;
#P fasten 23 0 16 1 696 500 681 500;
#P connect 22 1 23 0;
#P connect 21 0 17 0;
#P connect 26 1 28 2;
#P fasten 17 0 18 1 698 535 743 535;
#P connect 23 1 17 1;
#P pop;
#P newobj 113 402 69 9109513 p keystone;
#P toggle 342 277 15 0;
#N vpatcher 35 351 303 499;
#P inlet 163 50 15 0;
#P toggle 162 73 15 0;
#P window setfont “Sans Serif” 9.;
#P message 162 91 55 9109513 floating $1;
#P toggle 89 73 15 0;
#P newex 50 72 35 9109513 sel 27;
#P message 89 91 68 9109513 fullscreen $1;
#P newex 50 50 40 9109513 key;
#P outlet 89 113 15 0;
#P connect 1 0 3 0;
#P fasten 3 0 4 0 55 90 86 90 86 70 94 70;
#P connect 4 0 2 0;
#P connect 2 0 0 0;
#P connect 5 0 0 0;
#P connect 7 0 6 0;
#P connect 6 0 5 0;
#P pop;
#P newobj 342 296 28 9109513 p fs;
#P newex 29 60 54 9109513 loadbang;
#P window linecount 2;
#P newex 184 432 146 9109513 jit.gl.nurbs doo @dim 4 3 @color 1. 1. 1.
@ctlshow 1 @order 0;
#P newex 341 324 137 9109513 jit.window doo @depthbuffer 1 @sync 0
@idlemouse 1;
#P number 70 95 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 29 95 15 0;
#P window linecount 1;
#P newex 29 117 51 9109513 qmetro 22;
#P newex 29 139 58 9109513 t b b erase;
#P newex 29 502 271 9109513 jit.gl.render doo @erase_color 0. 0. 0. 1.
@ortho 2;
#P comment 75 374 40 9109513
#P comment 298 221 45 9109513 tnx vade;
#P window setfont “Sans Serif” 18.;
#P window linecount 2;
#P comment 102 631 275 9109522 problem is when changing the camera position
the texture slides;
#P fasten 10 0 40 0 7 79;
#P connect 40 0 41 0;
#P fasten 10 0 6 0 34 87 34 87;
#P connect 6 0 5 0;
#P connect 5 0 4 0;
#P connect 23 0 3 0;
#P fasten 13 0 3 0 118 426 34 426;
#P fasten 4 2 3 0 82 163 34 163;
#P connect 4 0 3 0;
#P connect 17 0 3 0;
#P fasten 40 1 14 0 27 370 51 370;
#P connect 7 0 5 1;
#P connect 4 1 16 0;
#P connect 16 0 13 0;
#P fasten 25 0 24 0 118 815 125 815 125 823 118 823;
#P connect 33 0 24 0;
#P connect 16 1 15 0;
#P connect 15 0 20 0;
#P connect 22 0 20 0;
#P connect 21 0 20 0;
#P fasten 14 0 13 1 51 396 137 396;
#P connect 16 2 17 0;
#P fasten 8 1 13 2 473 366 156 366;
#P connect 39 0 26 0;
#P connect 26 0 25 1;
#P connect 16 3 18 0;
#P connect 16 4 19 0;
#P fasten 3 1 13 3 295 530 309 530 309 399 175 399;
#P fasten 20 0 9 0 132 324 189 324;
#P connect 13 1 9 0;
#P connect 27 0 25 2;
#P connect 28 0 25 3;
#P connect 39 0 34 0;
#P connect 34 0 33 1;
#P connect 35 0 33 2;
#P connect 11 0 8 0;
#P connect 12 0 11 0;
#P pop;

#28710
Nov 15, 2006 at 1:06pm

The keystone is the wedge-shaped stone that fits into the top middle
of an arch. It’s a “key stone” because it’s responsible for keeping
the arch from falling apart.

http://en.wikipedia.org/wiki/Keystone_%28architecture%29

In video, it’s called a keystone because when the projected image is
tilted it looks like… a keystone.

:)

-evan

On Nov 15, 2006, at 12:35 PM, yair reshef wrote:

> hi list, a small problem pooped up when working on an opengl
> keystone method.
> i render to texture and dump onto a gl.nurb surface, manipulating
> the ctlmatrix to fix the keystone (where those this word come from?

#88476
Nov 16, 2006 at 11:14am

thnx for the trivia (i know alot of girlz how would die to know this…)
aside from that, and from connecting each gl object position to camera
position value, is there a solution floating about?
I’m getting sick of solving my own problems ;)

On 11/15/06, evan.raskob [lists]

wrote:
>
> The keystone is the wedge-shaped stone that fits into the top middle
> of an arch. It’s a “key stone” because it’s responsible for keeping
> the arch from falling apart.
>
> http://en.wikipedia.org/wiki/Keystone_%28architecture%29
>
> In video, it’s called a keystone because when the projected image is
> tilted it looks like… a keystone.
>
> :)
>
> -evan
>
>
>
> On Nov 15, 2006, at 12:35 PM, yair reshef wrote:
>
> > hi list, a small problem pooped up when working on an opengl
> > keystone method.
> > i render to texture and dump onto a gl.nurb surface, manipulating
> > the ctlmatrix to fix the keystone (where those this word come from?
>

#88477

You must be logged in to reply to this topic.