Forums > Jitter

Re: Rendering to texture: how to jit.gl.videoplane at full screen??

January 23, 2008 | 5:22 pm

Hi Robert,
This patch was designed to work with Jitter before we introduced the
@transform_reset settings to the OpenGL objects. To automatically adapt
the the videoplane to screen aspect ratio, use "@transform_reset 2" in
the jit.gl.videoplane.

You will also want to adapt the texture dimensions to fit the window to
avoid resampling artifacts.

Best,
Andrew B.


January 23, 2008 | 5:33 pm

> You will also want to adapt the texture dimensions to fit the window to
> avoid resampling artifacts.
>

Which you can get from jit.gl objects’ dest_dim attribute.
wes



bk
January 23, 2008 | 7:58 pm

hi folks – i seem to have an issue when setting loopoints on an ntsc
dv .mov file loaded into a jit.qt.movie. it appears to crash max.

i found some older posts on this, but i’m wondering if anyone has had
that problem recently, and if so, is there a workaround?

also – what is qtoptimize? i found a fleeting mention of it on the
web but no real documentation…

any insight into this would be helpful.

thanks

brian


January 24, 2008 | 1:17 pm

Thanks for your help, everyone.

So let me get this straight. In order to toggle back and forth between
in/out of fullscreen:

1- Set the destination dimensions for the full screen texture by
adding @dest_dim x y (x and y being the pixel dimensions of my
monitor screen) to jit.gl.texture

2- Add @transform_reset 2 to jit.gl.videoplane.

3- To return to the normal sized jit.window, I use the attribute @size
a b (these dimensions can be anything?) to jit.window.

Am I on the right path? If so, how come a get a blank screen every now
and then?

Cheers, Robbie

max v2;
#N vpatcher 53 115 1493 967;
#P window setfont "Sans Serif" 9.;
#P window linecount 3;
#P comment 874 97 57 196617 monitor size 1440 X 900;
#P window linecount 1;
#P message 416 480 43 196617 1.6568;
#P message 310 478 55 196617 2.209066;
#P comment 1076 859 169 196617 andrewb@cycling74.com;
#P user jit.fpsgui 159 862 60 196617 0;
#N vpatcher 241 275 491 513;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 30 101 68 196617 fullscreen $1;
#P toggle 30 83 15 0;
#P window linecount 0;
#P newex 30 63 35 196617 sel 27;
#P newex 30 43 40 196617 key;
#P outlet 30 118 15 0;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 0 0;
#P pop;
#P newobj 310 44 67 196617 p Ful_screen;
#P comment 926 369 80 196617 scale_bias filter;
#P comment 746 269 132 196617 dodge composite (feedback);
#P comment 839 323 64 196617 gaussian blur;
#P comment 738 169 201 196617 this is our render destination for the
nurbs;
#P user jit.fpsgui 203 441 60 196617 0;
#P flonum 761 203 42 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 761 223 88 196617 param amount $1;
#P newex 289 206 56 196617 qlim 1000;
#P newex 289 227 124 196617 jit.matrix 3 float32 10 5;
#P message 1254 245 43 196617 $1 400;
#P newex 1254 264 40 196617 line 0.;
#P newex 1254 226 41 196617 * 0.03;
#P newex 1254 206 64 196617 random 100;
#P message 1189 245 43 196617 $1 400;
#P newex 1189 264 40 196617 line 0.;
#P newex 1189 226 41 196617 * 0.03;
#P newex 1189 206 64 196617 random 100;
#P message 1124 245 43 196617 $1 400;
#P newex 1124 264 40 196617 line 0.;
#P newex 1124 226 41 196617 * 0.03;
#P newex 1124 206 64 196617 random 100;
#P message 1015 244 43 196617 $1 400;
#P newex 1015 262 40 196617 line 0.;
#P newex 1034 159 50 196617 qlim 500;
#P hidden newex 628 105 48 196617 loadbang;
#P hidden message 628 125 14 196617 0;
#P toggle 678 104 47 0;
#P newex 678 197 27 196617 + 1;
#P newex 678 225 38 196617 gate 2;
#P flonum 1206 300 38 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 1167 300 38 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 1124 300 42 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 1123 321 135 196617 pak param scale 1. 1. 1.;
#P newex 706 350 300 196617 jit.gl.slab cracks @file cc.scalebias.jxs
@dim 320 240 @adapt 0;
#P newex 706 250 171 196617 jit.gl.slab cracks @file co.dodge.jxs;
#P newex 1015 184 29 196617 gate;
#P number 232 327 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 232 347 56 196617 dim $1 $1;
#P newex 289 288 177 196617 jit.matrix 3 float32 20 20 @interp 1;
#P newex 289 307 184 196617 jit.slide @slide_up 50 @slide_down 50;
#P newex 1015 225 103 196617 expr $i1*0.02-0.01;
#P newex 1015 205 64 196617 random 200;
#P message 1014 285 81 196617 param width $1;
#P newex 706 384 299 196617 jit.gl.videoplane cracks @scale 1.333 1.
1. @transform_reset 2;
#P newex 706 304 197 196617 jit.gl.slab cracks @file cf.gaussian.2p.jxs;
#P newex 706 182 261 196617 jit.gl.texture cracks @name super@dest_dim
1440 900;
#P newex 405 346 271 196617 jit.gl.handle cracks @inherit_transform 1
@auto_rotate 1;
#P message 405 327 34 196617 reset;
#P newex 289 327 115 196617 jit.dimmap @invert 1 1;
#P newex 289 347 91 196617 prepend ctlmatrix;
#P window linecount 2;
#P newex 289 374 311 196617 jit.gl.nurbs cracks @color 0.8 0.7 0.3 0.6
@capture super @rotate 20. 60. 0. 0. @blend_enable 1 @poly_mode 1 0
@lighting_enable 1;
#P window linecount 1;
#P newex 203 135 74 196617 t erase b b b b;
#P newex 203 420 229 196617 jit.gl.render cracks @erase_color 0.2 0.1
0.1 1.;
#P window linecount 2;
#P newex 289 249 226 196617 jit.expr @expr
"jit.noise()*0.5-0.5+snorm[0]" "jit.noise()*4.-2." "snorm[1]" @cache 0;
#P window linecount 1;
#P newex 310 68 248 196617 jit.window cracks @fsaa 1 @interp 1 @size
320 240;
#P toggle 173 115 29 0;
#P newex 203 115 51 196617 qmetro 5;
#P window linecount 3;
#P comment 726 109 57 196617 turn on/off slab processing;
#P hidden connect 2 0 1 0;
#P connect 1 0 6 0;
#P connect 6 0 5 0;
#P fasten 6 1 5 0 224 286 208 286;
#P connect 5 0 53 0;
#P connect 21 0 20 0;
#P fasten 6 2 50 0 240 201 294 201;
#P connect 50 0 49 0;
#P connect 49 0 4 0;
#P connect 4 0 19 0;
#P fasten 6 2 19 0 240 281 294 281;
#P connect 19 0 18 0;
#P connect 18 0 9 0;
#P connect 9 0 8 0;
#P fasten 20 0 7 0 237 367 294 367;
#P connect 8 0 7 0;
#P fasten 11 0 7 0 410 367 294 367;
#P connect 58 0 3 0;
#P connect 10 0 11 0;
#P hidden connect 33 0 32 0;
#P connect 31 0 30 0;
#P hidden fasten 32 0 30 0 633 194 683 194;
#P connect 30 0 29 0;
#P fasten 6 3 12 0 256 171 711 171;
#P connect 12 0 29 1;
#P connect 29 1 23 0;
#P fasten 51 0 23 0 766 245 711 245;
#P fasten 15 0 13 0 1019 300 711 300;
#P connect 23 0 13 0;
#P connect 13 0 24 0;
#P fasten 25 0 24 0 1128 345 711 345;
#P connect 24 0 14 0;
#P fasten 29 0 14 0 683 371 711 371;
#P connect 52 0 51 0;
#P fasten 24 0 23 1 711 371 698 371 698 245 872 245;
#P connect 35 0 15 0;
#P fasten 31 0 22 0 683 155 1020 155;
#P connect 22 0 16 0;
#P connect 16 0 17 0;
#P connect 17 0 36 0;
#P connect 36 0 35 0;
#P hidden fasten 6 4 34 0 272 155 1039 155;
#P connect 34 0 22 1;
#P fasten 22 0 37 0 1020 202 1129 202;
#P connect 37 0 38 0;
#P connect 38 0 40 0;
#P connect 40 0 39 0;
#P connect 39 0 26 0;
#P connect 43 0 27 0;
#P fasten 26 0 25 2 1129 317 1190 317;
#P fasten 22 0 41 0 1023 202 1194 202;
#P connect 41 0 42 0;
#P connect 42 0 44 0;
#P connect 44 0 43 0;
#P connect 47 0 28 0;
#P fasten 27 0 25 3 1172 317 1221 317;
#P fasten 28 0 25 4 1211 317 1252 317;
#P fasten 22 0 45 0 1021 202 1259 202;
#P connect 45 0 46 0;
#P connect 46 0 48 0;
#P connect 48 0 47 0;
#P pop;


January 24, 2008 | 2:38 pm

On Jan 24, 2008 1:17 PM, Robert Griffin Byron wrote:

>
> 1- Set the destination dimensions for the full screen texture by
> adding @dest_dim x y (x and y being the pixel dimensions of my monitor
> screen) to jit.gl.texture
>

No. dest_dim is something you can query from any opengl object. It will give
you the size of the context you’re rendering to. Normally this would be the
size of your jit.window. Its not something you set manually.

>
> 2- Add @transform_reset 2 to jit.gl.videoplane.
>

Yes you can leave that fixed. It will make sure your plane is drawn in 2d as
an overlay of you screen, no matter how you rotate the rest of your
scene/camera.

> 3- To return to the normal sized jit.window, I use the attribute @size a b
> (these dimensions can be anything?) to jit.window.
>

You use @dim not @size. They reason for changing your texture to fit your
screen size is that you won’t wast resources if you’re rendering while not
in fullscreen. Its a waste to render to a 1440×900 texture if you’re using
it to overlay a 320×240 window. All of your slabs would be doing a lot extra
calculations.

>
> Am I on the right path? If so, how come a get a blank screen every now and
> then?
>

The blank screen seems to simply have to do with how the patch works. Its
using feedback. It the texture gets to light, it will be while. It still the
same thing you’re looking at. Just white.

I changed your patch around to illustrate what I wrote, but beware: I broke
it (at least on my computer). There is something about dynamically changing
the texture size that messes things up. You need to reinstantiate
jit.gl.render to get the context back to normal. So instead you might have
to use 2 seperate textures, and switch the @capture attribute of the
jit.gl.nurbs. Maybe someone (andrew?, wes?) knows a fix that allows you to
capture to dynamic dim textures…

Thijs

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 220 142 43 9109513 deferlow;
#B color 14;
#P newex 835 293 59 9109513 prepend dim;
#B color 14;
#P newex 835 267 70 9109513 route dest_dim;
#B color 14;
#P message 714 195 59 9109513 getdest_dim;
#B color 14;
#P newex 714 172 91 9109513 r update_texturedim;
#B color 14;
#P newex 220 166 93 9109513 s update_texturedim;
#B color 14;
#P newex 220 91 27 9109513 t b l;
#B color 14;
#P window linecount 3;
#P comment 810 169 50 9109513 lookup the window size;
#P window linecount 1;
#P comment 1003 919 169 9109513 andrewb@cycling74.com;
#P user jit.fpsgui 86 922 60 9109513 0;
#N vpatcher 241 275 491 513;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 30 101 68 9109513 fullscreen $1;
#P toggle 30 83 15 0;
#P window linecount 0;
#P newex 30 63 35 9109513 sel 27;
#P newex 30 43 40 9109513 key;
#P outlet 30 118 15 0;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 0 0;
#P pop;
#P newobj 220 58 67 9109513 p Ful_screen;
#P comment 673 329 132 9109513 dodge composite (feedback);
#P comment 766 383 64 9109513 gaussian blur;
#P comment 665 229 201 9109513 this is our render destination for the nurbs;
#P user jit.fpsgui 130 501 60 9109513 0;
#P flonum 688 262 42 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 688 283 88 9109513 param amount $1;
#P newex 216 266 56 9109513 qlim 1000;
#P newex 216 287 124 9109513 jit.matrix 3 float32 10 5;
#P message 1181 305 43 9109513 $1 400;
#P newex 1181 324 40 9109513 line 0.;
#P newex 1181 286 41 9109513 * 0.03;
#P newex 1181 266 64 9109513 random 100;
#P message 1116 305 43 9109513 $1 400;
#P newex 1116 324 40 9109513 line 0.;
#P newex 1116 286 41 9109513 * 0.03;
#P newex 1116 266 64 9109513 random 100;
#P message 1051 305 43 9109513 $1 400;
#P newex 1051 324 40 9109513 line 0.;
#P newex 1051 286 41 9109513 * 0.03;
#P newex 1051 266 64 9109513 random 100;
#P message 942 304 43 9109513 $1 400;
#P newex 942 322 40 9109513 line 0.;
#P newex 961 219 50 9109513 qlim 500;
#P hidden newex 555 165 48 9109513 loadbang;
#P hidden message 555 185 14 9109513 0;
#P toggle 605 164 47 0;
#P newex 605 257 27 9109513 + 1;
#P newex 605 285 38 9109513 gate 2;
#P flonum 1133 360 38 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 1094 360 38 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 1051 360 42 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 1050 381 135 9109513 pak param scale 1. 1. 1.;
#P newex 633 410 277 9109513 jit.gl.slab cracks @file cc.scalebias.jxs @dim
320 240 @adapt 0;
#P newex 633 310 171 9109513 jit.gl.slab cracks @file co.dodge.jxs;
#P newex 942 244 29 9109513 gate;
#P number 159 387 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 159 407 56 9109513 dim $1 $1;
#P newex 216 348 177 9109513 jit.matrix 3 float32 20 20 @interp 1;
#P newex 216 367 184 9109513 jit.slide @slide_up 50 @slide_down 50;
#P newex 942 285 103 9109513 expr $i1*0.02-0.01;
#P newex 942 265 64 9109513 random 200;
#P message 941 345 81 9109513 param width $1;
#P newex 633 444 299 9109513 jit.gl.videoplane cracks @scale 1.333 1. 1.
@transform_reset 2;
#P newex 633 364 197 9109513 jit.gl.slab cracks @file cf.gaussian.2p.jxs;
#P newex 633 242 212 9109513 jit.gl.texture cracks @name super @dim 320 240;
#P newex 332 406 271 9109513 jit.gl.handle cracks @inherit_transform 1
@auto_rotate 1;
#P message 332 387 34 9109513 reset;
#P newex 216 387 115 9109513 jit.dimmap @invert 1 1;
#P newex 216 407 91 9109513 prepend ctlmatrix;
#P window linecount 2;
#P newex 216 434 288 9109513 jit.gl.nurbs cracks @color 0.8 0.7 0.3
0.6@capture super @rotate 20. 60. 0. 0. @blend_enable 1 @poly_mode 1 0
@lighting_enable 1;
#P window linecount 1;
#P newex 130 195 74 9109513 t erase b b b b;
#P newex 130 480 204 9109513 jit.gl.render cracks @erase_color 0.2 0.1 0.11.;
#P window linecount 2;
#P newex 216 309 226 9109513 jit.expr @expr "jit.noise()*0.5-0.5+snorm[0]" "
jit.noise()*4.-2." "snorm[1]" @cache 0;
#P window linecount 1;
#P newex 237 115 248 9109513 jit.window cracks @fsaa 1 @interp 1 @size 320
240;
#P toggle 100 175 29 0;
#P newex 130 175 51 9109513 qmetro 5;
#P window linecount 3;
#P comment 653 169 57 9109513 turn on/off slab processing;
#P window linecount 2;
#P comment 267 139 100 9109513 defer allows the window to change first;
#P hidden connect 3 0 2 0;
#P connect 2 0 7 0;
#P fasten 7 1 6 0 151 346 135 346;
#P connect 7 0 6 0;
#P connect 6 0 54 0;
#P connect 22 0 21 0;
#P fasten 7 2 51 0 167 261 221 261;
#P connect 51 0 50 0;
#P connect 50 0 5 0;
#P connect 5 0 20 0;
#P fasten 7 2 20 0 167 341 221 341;
#P connect 20 0 19 0;
#P connect 19 0 10 0;
#P connect 10 0 9 0;
#P fasten 12 0 8 0 337 427 221 427;
#P connect 9 0 8 0;
#P fasten 21 0 8 0 164 427 221 427;
#P connect 58 0 62 0;
#P connect 62 0 68 0;
#P connect 68 0 63 0;
#P connect 62 1 4 0;
#P connect 11 0 12 0;
#P hidden connect 34 0 33 0;
#P connect 32 0 31 0;
#P hidden fasten 33 0 31 0 560 254 610 254;
#P connect 31 0 30 0;
#P connect 67 0 13 0;
#P connect 65 0 13 0;
#P fasten 7 3 13 0 183 231 638 231;
#P connect 13 0 30 1;
#P connect 30 1 24 0;
#P fasten 52 0 24 0 693 305 638 305;
#P fasten 16 0 14 0 946 360 638 360;
#P connect 24 0 14 0;
#P connect 67 0 25 0;
#P connect 14 0 25 0;
#P fasten 26 0 25 0 1055 405 638 405;
#P connect 25 0 15 0;
#P fasten 30 0 15 0 610 431 638 431;
#P connect 53 0 52 0;
#P connect 64 0 65 0;
#P fasten 25 0 24 1 638 431 625 431 625 305 799 305;
#P connect 13 1 66 0;
#P connect 66 0 67 0;
#P connect 36 0 16 0;
#P fasten 32 0 23 0 610 215 947 215;
#P connect 23 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 37 0;
#P connect 37 0 36 0;
#P hidden fasten 7 4 35 0 199 215 966 215;
#P connect 35 0 23 1;
#P fasten 23 0 38 0 947 262 1056 262;
#P connect 38 0 39 0;
#P connect 39 0 41 0;
#P connect 41 0 40 0;
#P connect 40 0 27 0;
#P connect 44 0 28 0;
#P fasten 27 0 26 2 1056 377 1117 377;
#P fasten 23 0 42 0 950 262 1121 262;
#P connect 42 0 43 0;
#P connect 43 0 45 0;
#P connect 45 0 44 0;
#P connect 48 0 29 0;
#P fasten 28 0 26 3 1099 377 1148 377;
#P fasten 29 0 26 4 1138 377 1179 377;
#P fasten 23 0 46 0 948 262 1186 262;
#P connect 46 0 47 0;
#P connect 47 0 49 0;
#P connect 49 0 48 0;
#P window clipboard copycount 69;


January 24, 2008 | 2:44 pm

On Jan 24, 2008 2:38 PM, Thijs Koerselman

wrote:

>
> It the texture gets to light, it will be while. It still the same thing
> you’re looking at. Just white.
>

If the texture gets too light, it will be white. It’s still the same things
you’re looking at. Just with a useless spelling check ;-)


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