Forums > Jitter

gl.mesh color array (no effect)


November 1, 2006 | 11:46 am

Hi, In the following patch I expect to see a line that is changing color
with a fading alpha channel. Instead I get a solid colored line no matter
what I try. Am I missing something obvious?

I’m using windows, jit1.6.3b1, max 4.6.2

cheers, -thijs

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 434 178 27 9109513 t b l;
#P message 316 157 94 9109513 exprfill "norm[0]*0.5";
#P newex 316 178 27 9109513 t b l;
#P toggle 588 227 15 0;
#P message 588 250 69 9109513 auto_colors $1;
#P message 178 229 60 9109513 color 0 1 1 1;
#P message 525 190 14 9109513 1;
#P message 505 190 14 9109513 0;
#P message 178 189 60 9109513 color 1 0 0 1;
#P message 178 209 60 9109513 color 0 0 0 1;
#P newex 72 218 99 9109513 prepend draw_mode;
#P user ubumenu 73 195 68 9109513 0 1 1 0;
#X add points;
#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 prefix_set 0 0 0;
#X pattrmode 1;
#P newex 76 106 69 9109513 t b b b b erase;
#P toggle 76 61 15 0;
#P newex 76 81 50 9109513 qmetro 20;
#P newex 184 80 64 9109513 jit.window foo;
#P newex 76 150 230 9109513 jit.gl.render foo @camera 0 0 2 @erase_color 1 1
1 1;
#P button 248 194 13 0;
#P user jit.pwindow 273 246 109 14 0 1 0 0 1 0;
#P newex 248 218 110 9109513 jit.matrix 4 float32 256 1;
#P button 408 190 13 0;
#P user jit.pwindow 422 242 109 14 0 1 0 0 1 0;
#P message 434 157 77 9109513 exprfill "norm[0]";
#P newex 408 215 110 9109513 jit.matrix 4 float32 256 1;
#P window linecount 2;
#P newex 248 296 279 9109513 jit.gl.mesh foo @color 0 1 1 1 @blend_enable 1
@lighting_enable 1 @draw_mode quad_strip @automatic 0 @draw_mode line_strip;
#P connect 24 1 1 0;
#P connect 24 0 1 0;
#P connect 2 0 24 0;
#P connect 22 0 5 0;
#P connect 22 1 5 0;
#P connect 23 0 22 0;
#P connect 1 0 0 3;
#P connect 1 0 3 0;
#P connect 5 0 0 0;
#P connect 5 0 6 0;
#P connect 20 0 0 0;
#P connect 21 0 20 0;
#P connect 19 0 0 0;
#P connect 16 0 0 0;
#P connect 15 0 0 0;
#P connect 14 0 0 0;
#P connect 12 1 0 0;
#P connect 18 0 1 0;
#P connect 17 0 1 0;
#P connect 7 0 5 0;
#P connect 12 0 8 0;
#P connect 12 4 8 0;
#P fasten 13 1 14 0 107 214 77 214;
#P connect 10 0 12 0;
#P connect 11 0 10 0;
#P connect 4 0 1 0;
#P window clipboard copycount 25;

November 1, 2006 | 12:43 pm

> Hi, In the following patch I expect to see a line that is changing color
> with a fading alpha channel.
> Instead I get a solid colored line no matter what I try. Am I missing
> something obvious?

Hello thijs,

i can confirm the same behaviour here, when lighting_enable is 1.
you were also sending 4 plane matrix to vertex inlet, maybe that makes more
confusion for jit.gl.mesh.

try the patch below.

best,
n

#P window setfont Geneva 9.;
#P window linecount 1;
#P comment 360 227 100 9961481 3 planes;
#P toggle 441 60 36 0;
#P window setfont Geneva 14.;
#P message 441 104 156 9961486 lighting_enable $1;
#B color 5;
#P window setfont "Sans Serif" 9.;
#P newex 434 178 27 9109513 t b l;
#P message 316 157 94 9109513 exprfill "norm[0]*0.5 ";
#P newex 316 178 27 9109513 t b l;
#P toggle 588 227 15 0;
#P message 588 250 69 9109513 auto_colors $1;
#P message 178 229 60 9109513 color 0 1 1 1;
#P message 525 190 14 9109513 1;
#P message 505 190 14 9109513 0;
#P message 178 189 60 9109513 color 1 0 0 1;
#P message 178 209 60 9109513 color 0 0 0 1;
#P newex 72 218 99 9109513 prepend draw_mode;
#P user ubumenu 73 195 68 9109513 0 1 1 0;
#X add points;
#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 prefix_set 0 0 0;
#X pattrmode 1;
#P newex 76 106 69 9109513 t b b b b erase;
#P toggle 76 61 15 0;
#P newex 76 81 50 9109513 qmetro 20;
#P newex 184 80 64 9109513 jit.window foo;
#P newex 76 150 230 9109513 jit.gl.render foo @camera 0 0 2 @erase_color 1 1
1 1;
#P button 248 194 13 0;
#P user jit.pwindow 273 246 109 14 0 1 0 0 1 0;
#P newex 248 218 110 9109513 jit.matrix 3 float32 256 1;
#P button 408 190 13 0;
#P user jit.pwindow 422 242 109 14 0 1 0 0 1 0;
#P message 434 157 77 9109513 exprfill "norm[0]";
#P newex 408 215 110 9109513 jit.matrix 4 float32 256 1;
#P window linecount 2;
#P newex 248 296 246 9109513 jit.gl.mesh foo @color 0 1 1 1 @blend_enable 1
@lighting_enable 1 @automatic 0 @draw_mode line_strip;
#P window setfont Geneva 9.;
#P window linecount 1;
#P comment 483 72 100 9961481 toggle me;
#P comment 360 214 100 9961481 xyz:;
#P user panel 243 209 162 36;
#X brgb 255 232 43;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P connect 27 1 4 0;
#P connect 27 0 4 0;
#P connect 5 0 27 0;
#P connect 26 0 25 0;
#P connect 24 0 23 0;
#P connect 21 0 4 0;
#P connect 20 0 4 0;
#P connect 15 0 11 0;
#P connect 15 4 11 0;
#P fasten 16 1 17 0 107 214 77 214;
#P connect 13 0 15 0;
#P connect 14 0 13 0;
#P connect 7 0 4 0;
#P connect 29 0 28 0;
#P connect 10 0 8 0;
#P connect 25 1 8 0;
#P connect 25 0 8 0;
#P connect 28 0 3 0;
#P connect 15 1 3 0;
#P connect 17 0 3 0;
#P connect 18 0 3 0;
#P connect 19 0 3 0;
#P connect 22 0 3 0;
#P connect 23 0 3 0;
#P connect 4 0 6 0;
#P connect 4 0 3 3;
#P connect 8 0 9 0;
#P connect 8 0 3 0;
#P window clipboard copycount 31;

November 1, 2006 | 12:57 pm

On 11/1/06, nesa wrote:
>
>
> i can confirm the same behaviour here, when lighting_enable is 1.
> you were also sending 4 plane matrix to vertex inlet, maybe that makes
> more
> confusion for jit.gl.mesh.

Hi Nesa, I just got to the same conclusion. Sending the 4 plane matrix was
my mistake, and it makes sense that it confuses jit.gl.mesh. The second
cause, lighting_enable, is not supposed to be like that I right? So I guess
its a bug (?)

cheers, -thijs

November 1, 2006 | 1:26 pm

it seems so, but who needs lighting anyway:)

November 1, 2006 | 6:41 pm

jit.gl.mesh @lighting_enable 1 not showing the color array is normal
behavior. This array sets the glColorPointer function with the data
you pass in. The reason the other ob3ds’ color attributes work with
@lighting_enable 1 is that behind the scenes glMaterial parameters are
being correspondingly set. The parameters kick in with
lighting_enable 1. Since there aren’t any analagous functions for
vertex arrays in OpenGL, it stands to reason that the color array
doesn’t work in this case. If you want this behavior, you need to
send your color array to a texture and set the texture coord array of
jit.gl.mesh.

wes

November 2, 2006 | 4:44 pm

On 11/1/06, Wesley Smith wrote:
>
> jit.gl.mesh @lighting_enable 1 not showing the color array is normal
> behavior. This array sets the glColorPointer function with the data
> you pass in. The reason the other ob3ds’ color attributes work with
> @lighting_enable 1 is that behind the scenes glMaterial parameters are
> being correspondingly set. The parameters kick in with
> lighting_enable 1. Since there aren’t any analagous functions for
> vertex arrays in OpenGL, it stands to reason that the color array
> doesn’t work in this case. If you want this behavior, you need to
> send your color array to a texture and set the texture coord array of
> jit.gl.mesh.
>
>
Hi Wes, thanks for explaining. Not sure I understand everything, but I’ll
give it a shot.

cheer, -thijs

November 2, 2006 | 5:39 pm

Hi Thijs,
Here’s a patch to help you out. It shows how to get the same results
with @lighting_enable 1 for jit.gl.mesh as with @lighting_enable 0 and
a color array.

wes

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 18 341 44 196617 texture;
#P message 64 341 93 196617 texture colormesh;
#P newex 25 310 41 196617 sel 0 1;
#P newex 418 342 205 196617 jit.matrix 4 char 20 20 @planemap 3 0 1 2;
#P newex 418 365 173 196617 jit.gl.texture test @name colormesh;
#P newex 202 320 130 196617 jit.matrix 2 float32 20 20;
#P newex 202 342 191 196617 jit.expr @expr "norm[0]" "1.-norm[1]";
#P toggle 53 282 15 0;
#P message 70 310 92 196617 lighting_enable $1;
#P newex 261 288 397 196617 jit.expr @expr "norm[0]" "norm[1]"
"abs(sin(snorm[0]*PI)*sin(snorm[1]*PI))" "1";
#P button 140 206 15 0;
#P newex 172 396 251 196617 jit.gl.mesh test @auto_normals 1 @smooth_shading 1;
#P newex 172 254 387 196617 jit.expr @expr "snorm[0]" "snorm[1]"
"sin(snorm[0]*PI)*sin(snorm[1]*PI)*0.5";
#P newex 172 231 130 196617 jit.matrix 3 float32 20 20;
#P toggle 184 76 15 0;
#P message 184 96 68 196617 fullscreen $1;
#N vpatcher 30 89 166 253;
#P window setfont "Sans Serif" 9.;
#P newex 50 71 35 196617 sel 27;
#P newex 50 50 40 196617 key;
#P outlet 50 93 15 0;
#P connect 1 0 2 0;
#P connect 2 0 0 0;
#P pop;
#P newobj 184 56 33 196617 p Esc;
#P newex 184 114 151 196617 jit.window test @depthbuffer 1;
#P message 145 114 34 196617 reset;
#P newex 145 135 186 196617 jit.gl.handle test @inherit_transform 1;
#P toggle 82 95 15 0;
#P newex 82 114 57 196617 qmetro 30;
#P newex 82 135 50 196617 t b erase;
#P newex 82 160 86 196617 jit.gl.render test;
#P comment 467 326 109 196617 convert RGBA to ARGB;
#P connect 15 0 13 3;
#P fasten 15 0 21 0 266 310 423 310;
#P fasten 14 0 11 0 145 226 177 226;
#P fasten 14 0 19 0 145 293 207 293;
#P connect 12 0 13 0;
#P fasten 12 0 15 0 177 279 266 279;
#P connect 18 0 13 1;
#P fasten 16 0 13 0 75 330 177 330;
#P fasten 24 0 13 0 23 369 177 369;
#P fasten 23 0 13 0 69 369 177 369;
#P connect 11 0 12 0;
#P connect 21 0 20 0;
#P fasten 17 0 22 0 58 303 30 303;
#P fasten 17 0 16 0 58 303 75 303;
#P fasten 22 1 23 0 45 334 69 334;
#P fasten 22 0 24 0 30 334 23 334;
#P connect 19 0 18 0;
#P connect 9 0 7 0;
#P connect 10 0 9 0;
#P connect 8 0 10 0;
#P connect 6 0 5 0;
#P fasten 2 0 1 0 87 156 87 156;
#P fasten 2 1 1 0 127 156 87 156;
#P fasten 5 0 1 0 150 156 87 156;
#P connect 3 0 2 0;
#P connect 4 0 3 0;
#P window clipboard copycount 25;

November 2, 2006 | 8:18 pm

On 11/2/06, Wesley Smith wrote:
>
> Hi Thijs,
> Here’s a patch to help you out. It shows how to get the same results
> with @lighting_enable 1 for jit.gl.mesh as with @lighting_enable 0 and
> a color array.

Thank you very much! It appears to be very easy, but it would probably have
taken me quite a while to figure that out;-)

cheers, -thijs

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

Forums > Jitter