Forums > Jitter

Texture is upside down

April 20, 2006 | 9:54 am

Hi,

I must be missing something very obvious.. I can’t figure out why with a default texture-to-plane setup the texture always appears upside down.

What should I change to this patch to make it work? Rotating 180 degrees around the z-axis isn’t a very neat solution..

Thanks,
Mattijs

max v2;
#N vpatcher 225 124 727 482;
#P window setfont "Sans Serif" 9.;
#P newex 20 292 79 196617 jit.window ding;
#P message 296 209 76 196617 texture mytex;
#P message 281 192 78 196617 matrixoutput 1;
#P newex 281 170 48 196617 loadbang;
#P message 310 225 70 196617 camera 0 0 4;
#P newex 21 67 40 196617 t b b b;
#P newex 132 131 114 196617 prepend texture mytex;
#P message 132 91 30 196617 read;
#P newex 132 110 63 196617 jit.qt.movie;
#P newex 173 233 103 196617 jit.gl.videoplane ding;
#P newex 21 225 50 196617 t b erase;
#P toggle 21 29 15 0;
#P newex 21 47 57 196617 qmetro 40;
#P newex 21 265 86 196617 jit.gl.render ding;
#P connect 2 0 1 0;
#P connect 1 0 8 0;
#P connect 8 0 3 0;
#P fasten 4 0 0 0 178 256 26 256;
#P fasten 7 0 0 0 137 261 26 261;
#P connect 3 0 0 0;
#P fasten 3 1 0 0 66 245 26 245;
#P fasten 9 0 0 0 315 261 26 261;
#P connect 6 0 5 0;
#P connect 8 2 5 0;
#P connect 5 0 7 0;
#P connect 8 1 4 0;
#P fasten 12 0 4 0 301 228 178 228;
#P fasten 11 0 4 0 286 228 178 228;
#P connect 10 0 11 0;
#P connect 10 0 12 0;
#P connect 10 0 9 0;
#P pop;


April 20, 2006 | 10:22 am

A little update: this doesn’t occur when the texture is sent directly to the videoplane but only when the texture stored in render is used.

I modified the example to illustrate this:

max v2;
#N vpatcher 114 463 764 896;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 296 133 32 196617 sel 0;
#P newex 296 114 27 196617 t i i;
#P toggle 296 29 15 0;
#P newex 173 199 29 196617 gate;
#P newex 20 292 79 196617 jit.window ding;
#P message 296 201 76 196617 texture mytex;
#P message 281 184 78 196617 matrixoutput 1;
#P newex 281 162 48 196617 loadbang;
#P message 310 217 70 196617 camera 0 0 4;
#P newex 21 67 40 196617 t b b b;
#P newex 132 131 114 196617 prepend texture mytex;
#P message 132 29 30 196617 read;
#P newex 132 110 63 196617 jit.qt.movie;
#P newex 173 225 103 196617 jit.gl.videoplane ding;
#P newex 21 225 50 196617 t b erase;
#P toggle 21 29 15 0;
#P newex 21 47 57 196617 qmetro 40;
#P newex 21 265 86 196617 jit.gl.render ding;
#P window linecount 2;
#P user com 313 29 240 196617 49;
#K set 0 12320 15648 30067 25888 29797 30836 30066 25888 29556 28530 25956 8297 28192 29285 28260 25970 8232 30064 29545 25701 8292 28535 28201 3377 8253 8307 25966 25632 29797 30836 30066 25888 25705 29285 25460 27769 8308 28448 30313 25701 28528 27745 28261 8232 30064 29545 25701 8309 28713;
#K end;
#P connect 3 0 2 0;
#P connect 2 0 9 0;
#P connect 9 0 4 0;
#P fasten 10 0 1 0 315 261 26 261;
#P fasten 4 1 1 0 66 245 26 245;
#P connect 4 0 1 0;
#P fasten 8 0 1 0 137 261 26 261;
#P fasten 5 0 1 0 178 256 26 256;
#P connect 9 2 6 0;
#P connect 7 0 6 0;
#P connect 6 0 8 0;
#P connect 17 1 15 0;
#P connect 15 0 5 0;
#P fasten 12 0 5 0 286 220 178 220;
#P fasten 13 0 5 0 301 220 178 220;
#P connect 9 1 5 0;
#P connect 6 0 15 1;
#P connect 11 0 12 0;
#P connect 16 0 17 0;
#P connect 17 0 18 0;
#P connect 18 0 13 0;
#P connect 11 0 13 0;
#P connect 11 0 10 0;
#P pop;


April 20, 2006 | 10:31 am

this is due to the fact that the texture coordinates originate in the
lower left corner of a plane: cf. the geometry matrix in the jitter
manual && check out the cmdlist in the attached butterfly patch.

/*j

save as:

butterfly_02.mxb

max v2;
#N vpatcher 32 77 731 605;
#P toggle 150 273 15 0;
#P window setfont "Sans Serif" 9.;
#P message 77 273 78 196617 auto_rotate $1;
#P hidden newex 238 119 37 196617 33.33;
#P user jit.fpsgui 42 463 60 196617 0;
#P comment 279 141 66 196617 folding angle;
#P comment 175 89 370 196617 tricky: the vertex geom and texture geom
are not using the same coord-system;
#P newex 547 261 71 196617 loadmess -45;
#P newex 238 273 83 196617 pack 0. 0. 0.;
#P newex 238 350 76 196617 _ cmd_replace;
#P window linecount 4;
#P message 238 296 111 196617 2 glvertex $1 -1. $2 , 4 glvertex
$1 1. $2 , 16 glvertex $3 1. $2 , 18 glvertex $3 -1. $2;
#P flonum 238 251 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 238 232 34 196617 * -1.;
#P flonum 238 139 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 2;
#P newex 238 162 88 196617 expr $f1 * (3.141593/180.);
#P flonum 310 251 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 274 251 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 238 203 23 196617 cos;
#P newex 274 203 21 196617 sin;
#P newex 400 185 69 196617 route symbol;
#N coll ;
#T flags 1 0;
#T 0 cmd_insert 0 glbegin quads;
#T 1 cmd_insert 1 gltexcoord 0. 1.;
#T 2 cmd_insert 2 glvertex -1. -1. 0.;
#T 3 cmd_insert 3 gltexcoord 0. 0.;
#T 4 cmd_insert 4 glvertex -1. 1. 0.;
#T 5 cmd_insert 5 gltexcoord 0.5 0.;
#T 6 cmd_insert 6 glvertex 0. 1. 0.;
#T 7 cmd_insert 7 gltexcoord 0.5 1.;
#T 8 cmd_insert 8 glvertex 0. -1. 0.;
#T 9 cmd_insert 9 glend;
#T 10 cmd_insert 10 glbegin quads;
#T 11 cmd_insert 11 gltexcoord 0.5 1.;
#T 12 cmd_insert 12 glvertex 0. -1. 0.;
#T 13 cmd_insert 13 gltexcoord 0.5 0.;
#T 14 cmd_insert 14 glvertex 0. 1. 0.;
#T 15 cmd_insert 15 gltexcoord 1. 0.;
#T 16 cmd_insert 16 glvertex 1. 1. 0.;
#T 17 cmd_insert 17 gltexcoord 1. 1.;
#T 18 cmd_insert 18 glvertex 1. -1. 0.;
#T 19 cmd_insert 19 glend;
#P newobj 400 165 53 196617 coll;
#P message 42 273 33 196617 reset;
#P hidden newex 42 88 45 196617 loadbang;
#P window linecount 2;
#P newex 42 294 137 196617 jit.gl.handle 1_context @inherit_transform 1;
#P window linecount 1;
#P newex 42 383 102 196617 _ texture 1_texture;
#P newex 42 339 40 196617 r pulse;
#P message 87 339 83 196617 read dishes.mov;
#P newex 42 361 105 196617 jit.qt.movie 320 240;
#P newex 93 178 40 196617 s pulse;
#N vpatcher 3 44 603 444;
#P toggle 381 142 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 381 160 70 196617 fullscreen $1;
#P newex 381 120 38 196617 sel 27;
#P window linecount 0;
#P newex 381 97 40 196617 key;
#P toggle 383 207 15 0;
#P message 383 225 58 196617 floating $1;
#P newex 92 156 27 196617 1;
#P toggle 92 203 15 0;
#P toggle 177 203 15 0;
#P message 265 224 113 196617 rect 704 44 1024 284;
#P message 175 224 80 196617 doublebuffer $1;
#P newex 92 105 45 196617 loadbang;
#P message 91 224 75 196617 depthbuffer $1;
#P inlet 92 51 15 0;
#P outlet 91 324 15 0;
#P connect 7 0 2 0;
#P connect 4 0 0 0;
#P connect 2 0 0 0;
#P connect 5 0 0 0;
#P connect 9 0 0 0;
#P connect 13 0 0 0;
#P connect 1 0 3 0;
#P connect 3 0 8 0;
#P connect 8 0 7 0;
#P connect 6 0 4 0;
#P connect 8 0 6 0;
#P connect 3 0 5 0;
#P connect 11 0 12 0;
#P connect 12 0 14 0;
#P connect 14 0 13 0;
#P connect 8 0 10 0;
#P connect 10 0 9 0;
#P pop;
#P newobj 42 414 73 196617 p initialisation;
#N vpatcher 391 229 965 768;
#P window setfont "Sans Serif" 9.;
#P message 242 178 240 196617 texture 1_texture 320 240 , usetexture
1_texture;
#P newex 162 130 27 196617 0;
#P newex 73 125 27 196617 1;
#P toggle 73 156 15 0;
#P toggle 162 156 15 0;
#P message 162 177 75 196617 lighting_enable;
#P message 73 177 81 196617 blend_enable $1;
#P newex 73 98 45 196617 loadbang;
#P inlet 73 51 15 0;
#P outlet 73 296 15 0;
#P fasten 1 0 2 0 78 97;
#P connect 2 0 7 0;
#P connect 7 0 6 0;
#P connect 6 0 3 0;
#P connect 9 0 0 0;
#P connect 4 0 0 0;
#P connect 3 0 0 0;
#P connect 2 0 8 0;
#P connect 8 0 5 0;
#P connect 5 0 4 0;
#P connect 2 0 9 0;
#P pop;
#P newobj 93 222 73 196617 p initialisation;
#P newex 93 199 45 196617 r render;
#P newex 42 148 55 196617 t b b erase;
#P toggle 42 107 15 0;
#P newex 42 435 105 196617 jit.window 1_context;
#P newex 42 247 113 196617 jit.gl.render 1_context;
#P newex 42 125 50 196617 qmetro 1;
#P newex 547 337 59 196617 loadmess 1;
#P flonum 509 359 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 30 89 339 448;
#P inlet 199 90 15 0;
#P outlet 83 220 15 0;
#P inlet 112 90 15 0;
#P inlet 141 90 15 0;
#P inlet 170 90 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 83 156 127 196617 pak color 0. 0. 0. 0.;
#P connect 0 0 4 0;
#P connect 3 0 0 1;
#P connect 2 0 0 2;
#P connect 1 0 0 3;
#P connect 5 0 0 4;
#P pop;
#P newobj 401 376 122 196617 p color;
#P flonum 401 359 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 437 359 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 473 359 35 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 2;
#P message 526 208 83 196617 ; sketch_00 reset;
#P window linecount 1;
#P newex 401 403 64 196617 s sketch_00;
#N vpatcher 20 74 620 474;
#P inlet 73 40 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 109 132 88 196617 grab 2 sketch_00;
#P newex 73 97 120 196617 t open getcmdlist clear b;
#N coll ;
#P newobj 109 220 53 196617 coll;
#N vpatcher 20 74 620 474;
#P inlet 227 46 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 199 137 22 196617 b 1;
#P newex 173 212 61 196617 prepend idx;
#P newex 199 177 61 196617 prepend set;
#N counter;
#X flags 0 0;
#P newobj 199 157 66 196617 counter;
#P outlet 173 252 15 0;
#P inlet 173 46 15 0;
#P connect 0 0 4 0;
#P connect 3 0 4 0;
#P connect 4 0 1 0;
#P connect 0 0 5 0;
#P connect 5 0 2 0;
#P connect 2 0 3 0;
#P connect 6 0 2 2;
#P pop;
#P newobj 109 175 53 196617 p idx;
#P comment 92 42 65 196617 view cmdlist;
#P connect 5 0 3 0;
#P connect 3 1 4 0;
#P connect 4 1 1 0;
#P connect 3 2 2 0;
#P connect 3 0 2 0;
#P connect 1 0 2 0;
#P connect 3 3 1 1;
#P pop;
#P newobj 527 186 39 196617 p view;
#P button 527 163 15 0;
#P comment 547 164 65 196617 view cmdlist;
#P newex 251 372 64 196617 r sketch_00;
#P newex 400 145 77 196617 loadmess dump;
#N vpatcher 30 89 339 448;
#P outlet 83 220 15 0;
#P inlet 112 90 15 0;
#P inlet 141 90 15 0;
#P inlet 170 90 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 83 156 98 196617 pak position 0. 0. 0.;
#P connect 0 0 4 0;
#P connect 3 0 0 1;
#P connect 2 0 0 2;
#P connect 1 0 0 3;
#P pop;
#P newobj 401 338 84 196617 p position;
#N vpatcher 30 89 630 489;
#P outlet 78 199 15 0;
#P inlet 110 48 15 0;
#P inlet 142 48 15 0;
#P inlet 174 48 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 78 117 108 196617 pak rotatexyz 0. 0. 0.;
#P newex 78 140 62 196617 jit.gl.handle;
#P connect 1 0 0 0;
#P connect 0 0 5 0;
#P connect 4 0 1 1;
#P connect 3 0 1 2;
#P connect 2 0 1 3;
#P pop;
#P newobj 401 301 83 196617 p rotate;
#P flonum 401 321 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 437 321 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 473 321 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 401 284 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 437 284 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 473 284 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 2;
#P newex 238 429 235 196617 jit.gl.sketch 1_context @blend_enable 1
@texture 1_texture @tex_map 0 @scale 1.1 0.83 1.;
#P window linecount 1;
#P comment 175 71 319 196617 two quads with half the texture on each
using vertex- and texccords;
#P comment 21 46 94 196617 jit.gl.folding_plane;
#P comment 529 51 85 196617 jasch 20060420;
#P hidden connect 39 0 28 0;
#P connect 28 0 25 0;
#P connect 25 0 29 0;
#P connect 29 0 26 0;
#P connect 29 2 26 0;
#P connect 30 0 26 0;
#P connect 31 0 26 0;
#P fasten 38 0 26 0 47 326 35 326 35 241 47 241;
#P fasten 37 0 26 0 47 403 35 403 35 241 47 241;
#P connect 40 0 38 0;
#P fasten 59 0 38 0 82 291 47 291;
#P fasten 36 0 34 0 47 362 47 362;
#P fasten 35 0 34 0 92 358 47 358;
#P connect 34 0 37 0;
#P connect 32 0 27 0;
#P hidden connect 26 0 57 0;
#P fasten 60 0 59 0 101 295;
#P hidden fasten 39 0 35 0 47 105 92 105;
#P connect 29 1 33 0;
#P hidden fasten 39 0 58 0 47 105 243 105;
#P hidden connect 58 0 48 0;
#P connect 48 0 47 0;
#P connect 47 0 44 0;
#P connect 44 0 49 0;
#P connect 49 0 50 0;
#P connect 50 0 53 0;
#P connect 53 0 51 0;
#P connect 51 0 52 0;
#P connect 52 0 3 0;
#P connect 13 0 3 0;
#P connect 42 0 3 0;
#P fasten 42 1 3 0 243 428;
#P connect 47 0 43 0;
#P connect 43 0 45 0;
#P connect 45 0 53 1;
#P connect 44 0 46 0;
#P connect 46 0 53 2;
#P connect 12 0 41 0;
#P connect 41 0 42 0;
#P fasten 54 0 6 0 552 283 406 283;
#P connect 6 0 10 0;
#P connect 9 0 11 0;
#P fasten 24 0 21 0 552 358 406 358;
#P connect 21 0 22 0;
#P connect 11 0 17 0;
#P connect 10 0 17 0;
#P connect 22 0 17 0;
#P connect 5 0 10 1;
#P fasten 24 0 20 0 552 358 442 358;
#P connect 8 0 11 1;
#P connect 20 0 22 1;
#P connect 4 0 10 2;
#P fasten 24 0 19 0 552 358 478 358;
#P connect 7 0 11 2;
#P connect 19 0 22 2;
#P fasten 24 0 23 0 552 358 514 358;
#P connect 23 0 22 3;
#P connect 15 0 16 0;
#P pop;


April 21, 2006 | 12:46 pm

Thanks Jasch, it’ll probably require some time for me to figure out your patch but I will do so asap. It looks like this is a way to directly assign texture coordinates and that is what I need.


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