Switch or crossfade between two different OpenGL renderings

agargara's icon

Sorry for the newbie question - this feels like it should be really simple, but I cannot for the life of me figure out how to do it! I want to be able to switch or crossfade between two different OpenGL renderings into the same window. I suppose I could render them both to a matrix and switch/crossfade those, but that's CPU inefficient. Perhaps there is a way to do it with slabs or textures?

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

take a look at jit.gl.node. this is one of the things it was built for.
you will want to enable the @capture attribute, and you can xfade using slabs, or better yet, jit.gl.pix.

agargara's icon

Thank you! Unfortunately I'm still using Max 5! I wonder if there's some workaround...

Rob Ramirez's icon

you can do this in max 5 using the to_texture message to jit.gl.render.
search the forum for this message, and i'm sure you'll find some examples.

agargara's icon

Thanks again! I didn't find a way to do it using to_texture, at least not one that I could understand or get to work, but I did find a post showing how to switch between scenes using the @capture attribute of jit.gl.sketch. One point I had been missing was setting @automatic 0 on gl objects, otherwise they tend to get automatically drawn in the wrong place.

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

Not sure if this is the best way of doing things but it seems to work pretty well. Patch posted for future reference: