Forums > Jitter

bug report: material issues with ji.gl objects

February 16, 2007 | 8:16 pm

There seems to be a problem with material with jitter gl objects. In the patch below, when auto material is toggled the material settings act correctly for the nurbs and gridshape objects. However, if you turn on automatic for the sketch object and then toggle auto_material again, the color settings override those of material, only shininess, mat_emission and specular continue to function. I can get back the correct settings by forcing render to rebuild the scene (I guess that’s what happens?) for example, by toggling the fsaa attribute.

Mac OS X 10.4.8, powerbook G4 1.5GHz, Jitter 1.6.3b2, max 4.6.2

pelado

max v2;
#N vpatcher 452 75 1194 586;
#P window setfont "Sans Serif" 9.;
#P window linecount 4;
#P comment 134 70 100 196617 you can get back to the material settings by changing the fsaa setting for render;
#P window linecount 1;
#P newex 235 196 44 196617 r nurby;
#P toggle 200 145 15 0;
#P message 198 167 88 196617 auto_material $1;
#P newex 198 228 158 196617 jit.gl.gridshape foo @shape torus;
#B color 5;
#P toggle 137 129 15 0;
#P message 135 162 44 196617 fsaa $1;
#P newex 176 300 60 196617 loadmess 1;
#P newex 416 197 44 196617 r nurby;
#P message 395 151 30 196617 rand;
#P toggle 518 127 15 0;
#P message 518 147 69 196617 automatic $1;
#P newex 518 170 145 196617 jit.gl.sketch foo @automatic 0;
#P objectname sketch;
#P toggle 382 103 15 0;
#P message 380 125 88 196617 auto_material $1;
#P toggle 488 397 15 0;
#P message 488 415 55 196617 floating $1;
#P toggle 320 305 15 0;
#P flonum 254 339 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 216 339 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 176 339 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 145 365 103 196617 pak color 0.5 0.5 0.5;
#P newex 259 388 42 196617 s nurby;
#P toggle 448 341 15 0;
#P message 448 364 94 196617 smooth_shading $1;
#P toggle 547 341 15 0;
#P message 547 364 90 196617 lighting_enable $1;
#P toggle 341 341 15 0;
#P toggle 300 341 15 0;
#P newex 259 365 92 196617 pak poly_mode 0 0;
#P hidden newex 488 298 50 196617 loadbang;
#P toggle 360 341 15 0;
#P message 360 364 81 196617 depth_enable $1;
#P hidden message 488 320 14 196617 1;
#P toggle 406 396 15 0;
#P newex 367 395 35 196617 sel 27;
#P message 406 414 68 196617 fullscreen $1;
#P newex 324 438 145 196617 jit.window foo @depthbuffer 1;
#P newex 322 395 40 196617 key;
#P user jit.fpsgui 69 148 60 196617 0;
#P newex 25 91 43 196617 jit.qball;
#P number 70 42 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 25 42 15 0;
#P newex 25 68 55 196617 metro 20;
#P newex 25 122 55 196617 t b erase b;
#P newex 380 227 75 196617 jit.gl.nurbs foo;
#B color 5;
#P newex 25 190 80 196617 jit.gl.render foo;
#P comment 341 305 100 196617 draw as mesh;
#P window linecount 7;
#P comment 562 48 100 196617 turning on automatic on this sketch object causes the nurbs object from displaying the material settings correctly;
#P connect 6 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 4 0;
#P fasten 4 1 2 0 52 150 30 150;
#P connect 4 0 2 0;
#P fasten 42 0 2 0 140 184 30 184;
#P connect 4 2 9 0;
#P connect 7 0 5 1;
#P fasten 43 0 42 0 140 144;
#P connect 41 0 28 0;
#P connect 28 0 27 1;
#P connect 46 0 45 0;
#P connect 47 0 44 0;
#P connect 45 0 44 0;
#P fasten 29 0 27 2 221 359 212 359;
#P connect 41 0 29 0;
#P fasten 30 0 27 3 259 359 243 359;
#P fasten 22 0 26 0 552 383 264 383;
#P fasten 24 0 26 0 453 383 264 383;
#P fasten 19 0 26 0 264 385 264 385;
#P fasten 16 0 26 0 365 383 264 383;
#P fasten 27 0 26 0 150 385 264 385;
#P fasten 31 0 20 0 325 330 305 330;
#P connect 20 0 19 1;
#P fasten 12 0 11 0 411 433 329 433;
#P fasten 32 0 11 0 493 433 329 433;
#P fasten 31 0 21 0 325 330 346 330;
#P connect 21 0 19 2;
#P hidden fasten 15 0 17 0 493 338 365 338;
#P connect 17 0 16 0;
#P fasten 10 0 13 0 327 414 364 414 364 393 372 393;
#P connect 35 0 34 0;
#P connect 34 0 3 0;
#P connect 39 0 3 0;
#P connect 40 0 3 0;
#P fasten 13 0 14 0 372 413 403 413 403 393 411 393;
#P connect 14 0 12 0;
#P hidden fasten 15 0 25 0 493 338 453 338;
#P connect 25 0 24 0;
#P hidden connect 18 0 15 0;
#P connect 33 0 32 0;
#P connect 38 0 37 0;
#P connect 37 0 36 0;
#P hidden fasten 15 0 23 0 493 338 552 338;
#P connect 23 0 22 0;
#P pop;


February 16, 2007 | 8:57 pm

On Feb 16, 2007, at 12:16 PM, pelado wrote:

> There seems to be a problem with material with jitter gl objects.
> In the patch below, when auto material is toggled the material
> settings act correctly for the nurbs and gridshape objects.
> However, if you turn on automatic for the sketch object and then
> toggle auto_material again, the color settings override those of
> material, only shininess, mat_emission and specular continue to
> function. I can get back the correct settings by forcing render to
> rebuild the scene (I guess that’s what happens?) for example, by
> toggling the fsaa attribute.

jit.gl.model uses displaylists internally which expoit these
properties at the time of displaylist build. Not all of the ob3d
attributes are set up to force a rebuild of the displaylists for
jit.gl.model. You should be able to force a rebuild by sending the
message "rebuild_geometry".

-Joshua


February 16, 2007 | 11:13 pm

Sorry Joshua but I don’t understand your reply. The issue I highlighted was not with jit.gl.model but with gridshape and nurbs. I suspect it happens with other objects too but haven’t tested them properly. The issue seems to be that if I set up a shape in gridshape with auto_material turned off and material values explicitly specified, then these are overidden should I enable a sketch object in the patch. I don’t think that this is correct behaviour.

pelado


February 16, 2007 | 11:27 pm

On Feb 16, 2007, at 3:13 PM, pelado wrote:

> Sorry Joshua but I don’t understand your reply. The issue I
> highlighted was not with jit.gl.model but with gridshape and nurbs.
> I suspect it happens with other objects too but haven’t tested them
> properly. The issue seems to be that if I set up a shape in
> gridshape with auto_material turned off and material values
> explicitly specified, then these are overidden should I enable a
> sketch object in the patch. I don’t think that this is correct
> behaviour.

Sorry, only quickly glanced at the message and totally misread it.
The issue is that there is some OpenGL lighting state which is
"leaking" into the other objects. We can attempt to fix this for the
actual 1.6.3 release, but for the meantime you can protect against
such state bleed through by typing "; jitter glattribpush 1" in a
message box and clicking it.

What this does when turned on is for each object, Jitter pushes and
pops the OpenGL state stack to prevent this sort of state "leakage".
However if you have lots of instances of jit.gl.* objects you may
discover it impedes performance (which is why this was changed to
default off in Jitter 1.5 and later).

Best,
Joshua


February 17, 2007 | 12:35 pm

OK the message to Jitter "glattribpush 1" works in the example patch that I posted. However, in a larger patch I now get these error messages repeatedly in the max window:

ob3d_draw_begin push attr: GL Error: Stack overflow
ob3d_draw_end popattrib: GL Error: Stack underflow

It’s not a big problem for me – just took a while to work out what was going wrong, but thought you should know that the problem existed.

pelado


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