texture on triangle

Mar 19, 2008 at 9:44am

texture on triangle

Hello,

I need to texture a movie on a triangular layout.
Is it possible to do that with jit.gl.mesh or else ?
How to specify the dims of the triangle for such a geometry ?

thank you.

#36415
Mar 20, 2008 at 5:20pm

Would not it be possible ?

#124975
Mar 20, 2008 at 5:31pm

Have you tried using the texture coordinate input (inlet 2) of jit.gl.mesh?
wes

On Thu, Mar 20, 2008 at 10:20 AM, Derrick Giscloux
wrote:
>
> Would not it be possible ?
>
>
>

#124976
Mar 24, 2008 at 4:02pm

It seems to do it, but I’m asking how to specify that is called the
“texcoord array” (nothing about in the help file)

Could you give a little example or any trick ?
thank you so much.

#124977
Mar 24, 2008 at 5:20pm

On Mon, Mar 24, 2008 at 4:02 PM, Derrick Giscloux
wrote:

>
> It seems to do it, but I’m asking how to specify that is called the
> “texcoord array” (nothing about in the help file)
>
> Could you give a little example or any trick ?
> thank you so much.
>
>
Here’s a crude example. The texture coordinates need to be specified for
each vertex that you’re drawing. Texture coordinates x y are specified as “s
t” to avoid confusion with position x y. If I remember correctly they range
in the y direction from 0-1 and x direction 0-aspect ratio. (0,0) is the
left bottom corner.

I think in this example the texture is stretched since I didn’t adjust the
values for the aspect ratio of the texture/screen. I leave that to you. Also
I’m sure you’ll find a better way to fill your matrices ;-)

Thijs

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 173 379 100 196617 2 plane st;
#P window setfont “Sans Serif” 12.;
#P comment 193 63 87 196620 load texture;
#P comment 54 24 143 196620 set up texture coords;
#P comment 230 21 113 196620 set up geometry;
#P comment 419 241 113 196620 texture s t;
#P comment 429 76 113 196620 vertex x y (z =0);
#P comment 544 356 100 196620 top vertex;
#P comment 545 313 100 196620 right vertex;
#P comment 545 270 100 196620 left vertex;
#P comment 540 192 100 196620 top vertex;
#P comment 541 149 100 196620 right vertex;
#P window setfont “Sans Serif” 9.;
#P newex 106 118 182 196617 jit.gl.handle foo @inherit_transform 1;
#P button 35 25 15 0;
#P newex 346 212 30 196617 t b b;
#P button 212 24 15 0;
#P newex 343 58 30 196617 t b b;
#P button 366 236 15 0;
#P message 403 349 128 196617 setcell 2 0 plane 0 val 0.5;
#P message 403 368 119 196617 setcell 2 0 plane 1 val 1;
#P message 403 326 119 196617 setcell 1 0 plane 1 val 0;
#P message 403 308 119 196617 setcell 1 0 plane 0 val 1;
#P message 403 286 119 196617 setcell 0 0 plane 1 val 0;
#P message 403 267 119 196617 setcell 0 0 plane 0 val 0;
#P button 362 83 15 0;
#P message 401 184 119 196617 setcell 2 0 plane 0 val 0;
#P message 401 203 128 196617 setcell 2 0 plane 1 val 0.5;
#P message 401 161 133 196617 setcell 1 0 plane 1 val -0.5;
#P message 401 143 128 196617 setcell 1 0 plane 0 val 0.5;
#P message 401 121 133 196617 setcell 0 0 plane 1 val -0.5;
#P message 401 102 133 196617 setcell 0 0 plane 0 val -0.5;
#P button 113 226 15 0;
#P user jit.pwindow 26 296 82 62 0 1 0 0 1 0;
#P newex 151 360 118 196617 jit.matrix 2 float32 3 1;
#P newex 113 265 118 196617 jit.matrix 3 float32 3 1;
#P message 107 66 79 196617 read dozer.mov;
#P newex 107 90 138 196617 jit.gl.texture foo @name tex;
#P newex 27 115 66 196617 t b b b erase;
#P toggle 27 71 15 0;
#P newex 27 92 57 196617 qmetro 20;
#P newex 27 170 75 196617 jit.window foo;
#P newex 27 146 82 196617 jit.gl.render foo;
#P newex 113 399 314 196617 jit.gl.mesh foo @texture tex @color 1 0 0 1
@draw_mode triangles;
#P window setfont “Sans Serif” 12.;
#P comment 541 106 100 196620 left vertex;
#P window setfont “Sans Serif” 9.;
#P comment 136 285 100 196617 3 plane xyz;
#P connect 10 0 12 0;
#P connect 10 0 2 0;
#P connect 32 0 3 0;
#P connect 30 0 11 0;
#P connect 30 1 27 0;
#P connect 31 0 30 0;
#P connect 28 0 10 0;
#P connect 28 1 20 0;
#P connect 29 0 28 0;
#P connect 27 0 21 0;
#P connect 27 0 22 0;
#P connect 27 0 23 0;
#P connect 27 0 24 0;
#P connect 27 0 26 0;
#P connect 27 0 25 0;
#P connect 11 0 2 1;
#P connect 21 0 11 0;
#P connect 22 0 11 0;
#P connect 23 0 11 0;
#P connect 24 0 11 0;
#P connect 26 0 11 0;
#P connect 25 0 11 0;
#P connect 6 0 5 0;
#P connect 5 0 7 0;
#P connect 7 0 3 0;
#P connect 7 3 3 0;
#P connect 14 0 10 0;
#P connect 13 0 10 0;
#P connect 15 0 10 0;
#P connect 16 0 10 0;
#P connect 17 0 10 0;
#P connect 19 0 10 0;
#P connect 18 0 10 0;
#P connect 20 0 14 0;
#P connect 20 0 15 0;
#P connect 20 0 16 0;
#P connect 20 0 17 0;
#P connect 20 0 19 0;
#P connect 20 0 18 0;
#P connect 9 0 8 0;
#P window clipboard copycount 44;

#124978
Mar 24, 2008 at 6:11pm

I’m going to study that.
Many, many thanks.

#124979

You must be logged in to reply to this topic.