Forums > Jitter

sketch – get starting

November 26, 2008 | 5:21 pm

Hello,

I’m just begining with [jit.gl.sketch]
I want to fill a simple quad with a texture.

Do I need to specify any texcooord ?
If yes, how to tell it to sketch?

Nothing about texture and sketch in tutorial 40.Jsketch.pat

thank you.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 689 33 48 196617 loadbang;
#P button 446 250 15 0;
#P newex 585 270 41 196617 sel 0 1;
#P newex 567 250 27 196617 t b i;
#P toggle 567 232 15 0;
#P message 600 290 198 196617 reset , glpolygonmode front_and_back line;
#P message 585 307 195 196617 reset , glpolygonmode front_and_back fill;
#P newex 399 315 80 196617 prepend symbol;
#P user ubumenu 399 295 92 196617 0 1 1 0;
#X add points;
#X add point_sprite;
#X add lines;
#X add line_strip;
#X add line_loop;
#X add triangles;
#X add tri_strip;
#X add tri_fan;
#X add quads;
#X add quad_strip;
#X add polygon;
#X add tri_grid;
#X add quad_grid;
#X prefix_set 0 0 0;
#P message 431 230 93 196617 symbol quad_strip;
#P window linecount 2;
#P message 400 336 268 196617 glbegin $1 , glcolor 1 0 0 1 , glvertex -0.5 -0.5 , glvertex -0.5 0.5 , glvertex 0.5 -0.5 , glvertex 0.5 0.5 , glend;
#P window linecount 1;
#P newex 206 139 53 196617 r 2sketch;
#B color 5;
#P window linecount 3;
#P newex 206 163 281 196617 jit.gl.sketch mysketch @depth_enable 1 @blend_enable 1 @rotatexyz 0 0 0 @automatic 1 @scale 1 @color 1. 1. 1. 1. @blend_mode 3 1 @texture t4 @point_size 2 @texture tex1;
#P window linecount 1;
#P message 494 73 30 196617 read;
#P message 148 86 34 196617 reset;
#P toggle 129 107 15 0;
#P newex 129 127 29 196617 gate;
#P newex 148 104 211 196617 jit.gl.handle mysketch @inherit_transform 1;
#P newex 367 124 173 196617 jit.gl.texture mysketch @name tex1;
#P message 442 81 29 196617 stop;
#P message 408 81 33 196617 start;
#P newex 408 61 41 196617 sel 1 0;
#P newex 367 103 167 196617 jit.qt.movie 320 240 @autostart 0;
#P message 486 54 76 196617 read bball.mov;
#P message 53 176 146 196617 name mysketch , size 320 240;
#P user jit.pwindow 52 216 322 242 0 1 0 0 1 0;
#X name mysketch;
#P newex 57 150 111 196617 jit.gl.render mysketch;
#P newex 57 88 50 196617 t b erase;
#P toggle 57 38 15 0;
#P newex 57 62 57 196617 qmetro 20;
#P connect 5 0 4 0;
#P connect 1 0 0 0;
#P connect 0 0 2 0;
#P connect 2 0 3 0;
#P fasten 2 1 3 0 102 109 62 109;
#P fasten 13 0 3 0 134 147 62 147;
#P connect 14 0 13 0;
#P connect 15 0 12 0;
#P connect 12 0 13 1;
#P connect 18 0 17 0;
#P fasten 19 0 17 0 405 159 211 159;
#P fasten 24 0 17 0 605 162 211 162;
#P fasten 23 0 17 0 590 159 211 159;
#P fasten 16 0 7 0 499 102 372 102;
#P fasten 10 0 7 0 447 97 372 97;
#P fasten 9 0 7 0 413 97 372 97;
#P fasten 6 0 7 0 491 99 372 99;
#P fasten 0 0 7 0 62 81 372 81;
#P connect 7 0 11 0;
#P connect 20 0 21 0;
#P fasten 21 1 22 0 445 313 404 313;
#P connect 26 0 19 0;
#P connect 22 0 19 0;
#P fasten 1 0 8 0 62 56 413 56;
#P connect 8 0 9 0;
#P connect 29 0 20 0;
#P fasten 8 1 10 0 428 79 447 79;
#P connect 20 0 28 0;
#P connect 29 0 6 0;
#P connect 28 0 25 0;
#P connect 25 0 26 0;
#P connect 26 1 27 0;
#P connect 27 0 23 0;
#P connect 27 1 24 0;
#P window clipboard copycount 30;


November 26, 2008 | 7:06 pm

Yes, you need to specify the texture coordinates and enable texture to fill
the quad with your texture. For example, you can send the following to the
jit.gl.sketch object in your patch:

reset, glenable texture, glbindtexture tex1, glbegin quads, glnormal 0 -1 0,
gltexcoord 1 1, glvertex 1 1 0, gltexcoord 1 0, glvertex 1 -1 0, gltexcoord
0 0, glvertex -1 -1 0, gltexcoord 0 1, glvertex -1 1 0, glend, gldisable
texture

Each command you send is kept in a command list which you can query using
getcmdlist.

If you enable lighting you also need to pass in the normals for each vertex,
the above list only has one normal because it is a plane.

There are a few examples of using jit.gl.sketch on my website that might be
of interest to you.

pelado

http://www.pelado.co.uk

Do I need to specify any texcooord ?
> If yes, how to tell it to sketch?
>


November 26, 2008 | 9:28 pm

Thanks Pelado!


January 13, 2009 | 8:39 pm

Hello,

I want to create a textured quad with [jit.gl.sketch].
I’d like to avoid the command list, and that is possible using the "quad" message.

first:
Should I specify any texcoord if I draw a quad using "quad" message

second:
If yes, how to? there is no texcoord array for sketch!

thank you.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 595 214 14 196617 4;
#P comment 589 158 14 196617 3;
#P comment 521 161 14 196617 2;
#P button 580 170 13 0;
#P button 580 206 13 0;
#P button 536 206 13 0;
#P button 536 170 13 0;
#P comment 523 216 14 196617 1;
#P message 227 176 29 196617 stop;
#P message 193 176 33 196617 start;
#P newex 193 156 41 196617 sel 1 0;
#P newex 152 198 167 196617 jit.qt.movie 320 240 @autostart 0;
#P message 271 149 76 196617 read bball.mov;
#P newex 371 228 27 196617 t l b;
#P newex 152 220 144 196617 prepend texture movie;
#P message 371 135 242 196617 quad -0.5 -0.5 0. -0.5 0.5 0. 0.5 0.5 0. 0.5 -0.5 0.;
#P message 392 177 54 196617 circle 0.8;
#P toggle 28 105 15 0;
#P newex 28 131 57 196617 qmetro 66;
#P newex 28 185 50 196617 t b erase;
#P newex 371 329 156 196617 jit.gl.sketch foo @texture movie;
#P newex 28 249 80 196617 jit.gl.render foo;
#P newex 27 282 145 196617 jit.window foo @depthbuffer 1;
#P window setfont "Sans Serif" 12.;
#P message 444 269 43 196620 reset;
#P window setfont "Sans Serif" 9.;
#P newex 271 47 50 196617 loadbang;
#P fasten 11 1 1 0 393 252 449 252;
#P fasten 1 0 4 0 449 309 376 309;
#P connect 11 0 4 0;
#P connect 8 0 11 0;
#P connect 9 0 11 0;
#P connect 0 0 7 0;
#P connect 0 0 12 0;
#P connect 0 0 9 0;
#P fasten 14 1 16 0 213 174 232 174;
#P connect 14 0 15 0;
#P connect 7 0 6 0;
#P fasten 7 0 14 0 33 125 198 125;
#P connect 13 0 10 0;
#P fasten 12 0 13 0 276 194 157 194;
#P fasten 15 0 13 0 198 192 157 192;
#P fasten 16 0 13 0 232 192 157 192;
#P connect 6 0 5 0;
#P connect 6 0 13 0;
#P fasten 10 0 3 0 157 245 33 245;
#P fasten 5 1 3 0 73 215 33 215;
#P connect 5 0 3 0;
#P window clipboard copycount 25;


January 13, 2009 | 9:10 pm

try @tex_map 2 (or 1 or 3) on your gl.sketch.
also look at tex_plane_s/t attributes.


January 14, 2009 | 8:12 am

Nice!
Thanks Rob.


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