Forums > Jitter

texture and blending

March 28, 2006 | 12:53 am

dear list,

i’m trying to build a patch which basically emualtes a karaoke-like
coloring of a text in given time segments. my approach is to display
the text in several jit.gl.text3d objects (generated out of a xml
file in a javascript object) and doing the coloring via a moving
texture on a plane (jit.gl.gridshape, blend_mode 2 4), lying on top
of the scene. my problem is that this seems only to work when the
jit.gl.gridshape object is instantiated _after_ the text objects,
which is a problem as i generate text objects anew all the time.

any thoughts on this? find the isolated problem in the patch below.

also, i’m not shure if my general approach is a very clever one, i
still have problems with positioning the various text objects in
relation to each other (as they can’t output their size). until now i
use a workaround where every new text object gets rendered in an
offscreen matrix once and measured with jit.findbounds… dirty and
works only approximately. more thoughts?

any help/comments/ideas appreciated!
thanks, chris

max v2;
#N vpatcher 168 96 740 670;
#P window setfont "Sans Serif" 9.;
#P comment 76 346 213 196617 6) should work now , try moving the
texture:;
#P comment 75 205 92 196617 3) start rendering;
#P comment 76 225 76 196617 4) make a text;
#P comment 75 73 100 196617 2) send a bang;
#P newex 58 458 50 196617 t b erase;
#P toggle 58 204 15 0;
#P newex 58 439 57 196617 qmetro 40;
#P newex 58 505 271 196617 jit.window output @depthbuffer 1 @fsaa 1
@size 640 480;
#P newex 58 479 209 196617 jit.gl.render output @erase_color 0. 0. 0.
1.;
#P window linecount 2;
#P newex 157 301 352 196617 jit.gl.gridshape output @shape plane
@blend_enable 1 @texture typo @tex_map 1 @color 1. 1. 1. 1. @dim 1 1
@depth_enable 0 @blend_mode 2 4;
#B color 5;
#P window linecount 1;
#P message 43 54 30 196617 read;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 294 345 49 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 178 367 129 196617 pak tex_plane_s 1. 0. 0. 0.;
#P message 157 224 68 196617 text test123;
#P newex 157 242 325 196617 jit.gl.text3d output @blend_enable 1
@color 1. 1. 1. 1. @scale 0.2 0.2;
#P button 58 72 15 0;
#P newex 58 134 217 196617 jit.matrix 4 char 256 256 @planemap 1 2 2 2;
#P newex 58 156 188 196617 jit.gl.texture text @name typo @flip -1;
#P button 153 115 15 0;
#P newex 58 96 105 196617 jit.qt.movie 128 128;
#P comment 75 55 100 196617 1) read a texture;
#P comment 76 281 351 196617 5) doesn’t work , try reinstatntiate
jit.gl.gridshape by editing its object box;
#P connect 6 0 2 0;
#P connect 11 0 2 0;
#P connect 2 0 5 0;
#P connect 3 0 5 0;
#P connect 5 0 4 0;
#P connect 16 0 15 0;
#P connect 15 0 17 0;
#P connect 17 0 13 0;
#P connect 17 1 13 0;
#P connect 2 1 3 0;
#P connect 8 0 7 0;
#P connect 9 0 12 0;
#P connect 10 0 9 4;
#P pop;


March 28, 2006 | 4:51 pm

Hi,

try with non-automatic rendering order, you can render all text objects
first, and then render gridshape over them:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 261 187 63 9109513 text aaa;
#P window linecount 2;
#P newex 241 212 228 9109513 jit.gl.text3d output @blend_enable 1 @color 1.
1. 1. 1. @scale 0.2 0.2 @automatic 0 @position -0.5 0. 0.;
#P window setfont Geneva 9.;
#P window linecount 1;
#P newex 157 155 23 9830409 t b;
#B color 3;
#P window setfont "Sans Serif" 9.;
#P comment 367 79 169 9109513 4) display rendered scene in window;
#P comment 367 61 125 9109513 3) render gridshape;
#B color 11;
#P comment 311 5 92 9109513 render sequence:;
#P comment 367 27 125 9109513 1) erase previous frame;
#B color 7;
#P comment 367 44 120 9109513 2) render text objects;
#B color 3;
#P comment 75 23 100 9109513 2) send a bang;
#P newex 58 373 64 9109513 t b b b erase;
#P toggle 58 154 15 0;
#P newex 58 336 57 9109513 qmetro 40;
#P newex 58 455 271 9109513 jit.window output @depthbuffer 1 @fsaa 1 @size
640 480;
#P newex 58 429 209 9109513 jit.gl.render output @erase_color 0. 0. 0. 1.;
#P window linecount 2;
#P newex 157 296 346 9109513 jit.gl.gridshape output @shape plane
@blend_enable 1 @texture typo @tex_map 1 @color 1. 1. 1. 1. @dim 1 1
@depth_enable 0 @blend_mode 2 4 @automatic 0;
#B color 5;
#P window linecount 1;
#P message 43 4 30 9109513 read;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 294 340 49 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 178 362 129 9109513 pak tex_plane_s 1. 0. 0. 0.;
#P message 168 228 68 9109513 text test123;
#P window linecount 2;
#P newex 157 249 234 9109513 jit.gl.text3d output @blend_enable 1 @color 1.
1. 1. 1. @scale 0.2 0.2 @automatic 0;
#P button 58 22 15 0;
#P window linecount 1;
#P newex 58 84 217 9109513 jit.matrix 4 char 256 256 @planemap 1 2 2 2;
#P newex 58 106 188 9109513 jit.gl.texture text @name typo @flip -1;
#P button 153 65 15 0;
#P newex 58 46 105 9109513 jit.qt.movie 128 128;
#P comment 75 5 100 9109513 1) read a texture;
#P connect 23 0 6 0;
#P lcolor 4;
#P connect 23 0 24 0;
#P lcolor 4;
#P connect 25 0 24 0;
#P connect 7 0 6 0;
#P fasten 16 2 23 0 99 399 141 399 141 149 162 149;
#P lcolor 4;
#P connect 5 0 1 0;
#P connect 10 0 1 0;
#P connect 1 0 4 0;
#P connect 2 0 4 0;
#P connect 4 0 3 0;
#P connect 15 0 14 0;
#P connect 1 1 2 0;
#P connect 9 0 8 4;
#P connect 8 0 11 0;
#P connect 14 0 16 0;
#P fasten 16 1 11 0 81 406 153 406 153 290 162 290;
#P lcolor 12;
#P connect 16 0 12 0;
#P fasten 16 3 12 0 117 423 63 423;
#P lcolor 8;
#P window clipboard copycount 26;


March 28, 2006 | 11:32 pm

thanks nesa, everything works great now!

best, chris


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