Mapping multiple textures with glbindtexture and jit.gl.sketch

Simon's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hi everyone.
I'm having an issue with the mapping of multiple textures with the glbindtexture attribute in jit.gl.sketch. Since the patch I'm working on is huge, I have isolated and commented the important elements in this smaller exemple :

I would be so grateful if anyone could have a look at it and point me where my mistake(s) is because I have tried and tried without success..
Many thanks!
Simon

3295.glbindtextureIssuegoal.jpg
jpg
Simon's icon

Sending the message 'texgen projected' to both jit.gl.texture objects seems to reveal a little more of the textures while using 'glbindtexture' (instead of 1 stretched pixel) but I still can't manage to see the whole textures on the shapes. I know about the gltexcoord attribute but I haven't figured how to use it without having to combine it with a glvertex (since I don't want the vertex to be drawn).
Any tips would be appreciated, thanks.

simon

Simon's icon

About to give up on this. Anything, anyone?

Rob Ramirez's icon

i think you have to incorporate the gltexgen sketch command to your command list to emulate the tex_plane_s/t attributes.

Rob Ramirez's icon

also, if you're doing 2D physics, jit.phys.world in the soon to be released max 6 update has an attribute to enable 2D physics.

Simon's icon

Got it! Thanks for the tip Robert! The gltexgen attribute did what I needed. However I had to add a few attributes to the jit.gl.texture object to make it work. The autoscale had to be set to 0 and the texgen attribute had to be set to 'objectspace'.

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

I updated my previous example with the solution in case someone ever needs to do the same trick:

Simon