jit.gl.sketch drawobject command is broken in max 6

pseudostereo's icon

Both drawobject 0 and drawobject 1 have some big problems in Max6.

While I'd love to leave jit.gl.sketch behind and move on to all the new jit.gl objects in Max6, for now I need to be able to run my existing patches, and almost all of them are deeply dependent on the nested structure facilitated by the drawobject command in jit.gl.sketch.

Until this gets fixed, I'm stuck.

Max Patch
Copy patch and select New From Clipboard in Max.

Compare how the attached patch runs in 5 vs 6.

Spa's icon

+1
All my drawing structures relies on drawobject in jit.gl.sketch.

And could we get a frustum parameter in jit.gl.camera?

Wesley Smith's icon

curses! Apologies for not having this fixed in 6.0.1. I'm on it.

Spa's icon

Incremental Object Update?

Wesley Smith's icon

It's a Jitter thing, not a sketch thing so any updates will have to wait for 6.0.2. Thanks for your patience.

Wesley Smith's icon

One thing to note Perry is that the redness of the box when lighting is turned on is a bit of a fluke. This behavior is dependent on GL_COLOR_MATERIAL being enabled. In Max6 jit.gl.gridshape uses a jit.gl.mesh internally, which calls glEnable/glDisable on GL_COLOR_MATERIAL, causing your glcolor 1 0 0 1 not to set the diffuse material component. The fact that this is on in Max5 is by a fluke of the default state of the OpenGL context. To get this behavior in a more robust manner, set 'glenable color_material' as one of the command to sketch. In any case, I've set Max6 gridshape to follow what Max5 gridshape does now, so this will be in 6.0.2.

Wesley Smith's icon

jit.gl.camera @colormask and @frustum are in the next release, so hopefully you will be free to move from jit.gl.sketch if you want

Spa's icon

:) for frustum

is there an existing (planed) jit.gl.sketch command for jit.gl.material and jit.gl.light?
like:
glbindtexture tex_name ...
drawobject obj_name ...

working with stereoscopy, I bind a different texture to the same object in 2 parallel command list.
I don't think it's possible with 2 cameras ... no? or i will need to have 2 identical objects with 2 materials...
So, usind jit.gl.sketch, I've got to maintain a long dynamic sublist command for each lights.
Calling a jit.gl.material or jit.gl.light will be great..

pseudostereo's icon

Thanks Wesley - can't wait for 6.0.2

Something's definitely wrong with glcolor inside sketch whenever drawobject is used - I think I understand what you're saying about color_material, but setting 'glenable color_material' (or 'gldisable color_material') doesn't seem to change anything -

Max Patch
Copy patch and select New From Clipboard in Max.

Here's a clearer example of the problem:

Wesley Smith's icon

It has an effect for me. You have to be careful where you put it in the list. It has to come after drawobject:

reset, glclear, glcolor 1 0 0 1, gltranslate -3 0 -5, cube 1 1, glcolor 0 1 0 1, gltranslate 3 0 0, drawobject cronk $1, glenable color_material, glcolor 0 0 1 1, gltranslate 3 0 0, cube 1 1

Incidentally, everything looks good for 6.0.2 following what your comments say should be happening. You have the best patches BTW. very clear!

pseudostereo's icon

OK, I see now.

So since 'glenable color_material' doesn't have any effect if it's put before the drawobject command, it's almost as if drawobject includes a implicit 'gldisable color_material' command. This seems a little counterintuitive, or maybe I'm missing something?

Wesley Smith's icon

" it's almost as if drawobject includes a implicit 'gldisable color_material' command."

That's exactly the difference between Max5 and Max6 because of the change with the gridshape using a mesh internally.