Forums > Jitter

Textures on OpenGL shapes

February 14, 2007 | 1:44 pm

I apologise if this is already discussed in the tutorials but I couldnt find any way of implementing it even after scouring them.

I’m trying to use a movie as a texture on an OpenGL shape using the texture message only I cant seem to get it to work?!

Can anyone help?

max v2;
#N vpatcher 424 44 1274 662;
#P origin 0 -1;
#P user jit.pwindow 677 502 102 77 0 1 0 0 1 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 462 453 103 196617 jit.qt.movie 256 256;
#P message 525 428 28 196617 read;
#P message 590 428 27 196617 stop;
#P message 556 428 31 196617 start;
#P toggle 462 407 15 0;
#P newex 462 428 55 196617 metro 20;
#P comment 478 409 149 196617 ? read a move and start metro.;
#P newex 464 482 48 196617 trigger l;
#P newex 463 504 131 196617 prepend texture mytexture;
#P comment 701 259 13 196617 z;
#P comment 661 258 13 196617 y;
#P comment 621 258 13 196617 x;
#P comment 681 198 13 196617 z;
#P comment 641 197 13 196617 y;
#P message 552 566 68 196617 usetexture 0;
#P message 551 546 95 196617 texture mytexture;
#P window linecount 3;
#P comment 723 301 81 196617 turn OFF auto_material to use shininess.;
#P toggle 592 321 15 0;
#P window linecount 1;
#P message 592 344 88 196617 auto_material $1;
#P message 685 344 64 196617 shininess $1;
#P flonum 685 321 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 241 453 15 0;
#P message 241 471 55 196617 floating $1;
#P toggle 250 288 15 0;
#P comment 271 288 100 196617 draw as mesh;
#P message 119 539 105 196617 light_position 1 1 1 0;
#P hidden message 48 414 68 196617 camera 0 0 4;
#P message 298 162 70 196617 rad_minor $1;
#P flonum 298 139 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 196 161 71 196617 prepend shape;
#P user ubumenu 196 135 72 196617 0 1 1 0;
#X add sphere;
#X add torus;
#X add cylinder;
#X add opencylinder;
#X add cube;
#X add opencube;
#X add plane;
#X add circle;
#X prefix_set 0 0 0;
#P flonum 670 213 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 632 213 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 592 213 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 567 240 85 196617 pak scale 1. 1. 1.;
#P window linecount 3;
#P newex 379 169 87 196617 jit.gl.handle foo @depth_enable 1 @radius 2.;
#P toggle 493 167 15 0;
#P window linecount 1;
#P message 493 196 82 196617 matrixoutput $1;
#P toggle 168 453 15 0;
#P newex 129 452 35 196617 sel 27;
#P message 168 471 68 196617 fullscreen $1;
#P newex 86 495 145 196617 jit.window foo @depthbuffer 1;
#P newex 84 452 40 196617 key;
#P number 105 106 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 105 134 54 196617 dim $1 $1;
#P newex 213 187 43 196617 r grimy;
#P user jit.fpsgui 59 212 60 196617 0;
#P newex 188 368 43 196617 s grimy;
#P flonum 688 271 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 648 271 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 610 271 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 377 321 15 0;
#P message 377 344 94 196617 smooth_shading $1;
#P message 103 347 79 196617 color 0. 1. 0. 1.;
#P toggle 476 321 15 0;
#P message 476 344 90 196617 lighting_enable $1;
#P newex 15 155 43 196617 jit.qball;
#P toggle 54 326 15 0;
#P message 54 347 44 196617 axes $1;
#P toggle 270 325 15 0;
#P toggle 229 324 15 0;
#P newex 188 345 92 196617 pak poly_mode 0 0;
#P hidden newex 416 278 50 196617 loadbang;
#P number 60 106 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 289 321 15 0;
#P message 289 344 81 196617 depth_enable $1;
#P toggle 15 106 15 0;
#P newex 15 132 55 196617 metro 20;
#P newex 15 186 55 196617 t b erase b;
#P newex 196 262 93 196617 jit.gl.gridshape foo;
#B color 5;
#P newex 15 586 80 196617 jit.gl.render foo;
#P hidden message 417 300 14 196617 1;
#P newex 582 295 95 196617 pak position 0. 0. 0.;
#P window linecount 3;
#P comment 513 156 159 196617 jit.gl.gridshape can also output its surface as a matrix if matrixoutput mode is turned on;
#P window linecount 1;
#P comment 302 183 55 196617 for torus;
#P comment 601 197 13 196617 x;
#P window setfont "Sans Serif" 18.;
#P window linecount 4;
#P comment 660 394 126 196626 How do use the movie as a texture for the shape?;
#P connect 10 0 9 0;
#P connect 9 0 20 0;
#P connect 20 0 8 0;
#P fasten 51 0 6 0 124 570 20 570;
#P hidden fasten 50 0 6 0 53 507 20 507;
#P connect 8 0 6 0;
#P fasten 8 1 6 0 42 214 20 214;
#P fasten 7 0 6 0 201 298 20 298;
#P hidden connect 14 0 50 0;
#P connect 19 0 18 0;
#P connect 8 2 30 0;
#P connect 13 0 9 1;
#P fasten 36 0 35 0 173 490 91 490;
#P fasten 54 0 35 0 246 490 91 490;
#P connect 33 0 32 0;
#P fasten 34 0 37 0 89 471 126 471 126 450 134 450;
#P fasten 37 0 38 0 134 470 165 470 165 450 173 450;
#P connect 38 0 36 0;
#P fasten 42 0 29 0 572 363 193 363;
#P fasten 11 0 29 0 294 363 193 363;
#P fasten 15 0 29 0 193 365 193 365;
#P fasten 23 0 29 0 108 365 193 365;
#P fasten 24 0 29 0 382 363 193 363;
#P fasten 21 0 29 0 481 363 193 363;
#P fasten 18 0 29 0 59 365 193 365;
#P fasten 4 0 29 0 587 363 193 363;
#P fasten 58 0 29 0 597 363 193 363;
#P fasten 57 0 29 0 690 363 193 363;
#P fasten 46 1 47 0 232 156 201 156;
#P fasten 39 0 7 0 498 219 201 219;
#P fasten 32 0 7 0 110 198 201 198;
#P connect 47 0 7 0;
#P fasten 31 0 7 0 218 225 201 225;
#P fasten 49 0 7 0 303 212 201 212;
#P fasten 41 0 7 0 384 231 201 231;
#P fasten 53 0 16 0 255 313 234 313;
#P connect 16 0 15 1;
#P connect 55 0 54 0;
#P fasten 53 0 17 0 255 314 275 314;
#P connect 17 0 15 2;
#P hidden fasten 5 0 12 0 422 318 294 318;
#P connect 12 0 11 0;
#P connect 48 0 49 0;
#P hidden fasten 5 0 25 0 422 318 382 318;
#P connect 25 0 24 0;
#P hidden connect 14 0 5 0;
#P connect 72 0 71 0;
#P connect 71 0 76 0;
#P connect 75 0 76 0;
#P connect 73 0 76 0;
#P connect 74 0 76 0;
#P connect 69 0 68 0;
#P connect 76 0 69 0;
#P hidden fasten 5 0 22 0 422 318 481 318;
#P connect 22 0 21 0;
#P connect 40 0 39 0;
#P connect 43 0 42 1;
#P hidden fasten 5 0 59 0 422 318 597 318;
#P connect 59 0 58 0;
#P connect 26 0 4 1;
#P fasten 44 0 42 2 637 234 622 234;
#P fasten 27 0 4 2 653 290 643 290;
#P fasten 45 0 42 3 675 234 647 234;
#P fasten 28 0 4 3 693 290 671 290;
#P connect 76 0 77 0;
#P connect 56 0 57 0;
#P pop;

Thanks

Rhys


February 14, 2007 | 4:54 pm

Hi Rhys,
To get textures working, you need to do 2 things:

1) create a texture object
2) set the texture attribute of the object you want to texture to the
name of the texture object

In you patch, you’ll want to put [jit.gl.texture foo @name mytexture]
just below jit.qt.movie and send the message "texture mytexture" to
jit.gl.gridshape.

wes


February 15, 2007 | 3:33 pm

Perfect wes thanks very much!


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