jit.gl.asyncread to jit.gl.slab: GL Errors

Zachary Seldess's icon

Hi guys,

I get the following errors when grabbing one GL context via jit.gl.asyncread and sending it directly to a jit.gl.slab in another context:

ob3d_draw_begin pushmatrix: GL Error: Stack overflow
ob3d_draw_end popmatrix: GL Error: Stack underflow

Connecting jit.gl.asyncread --> jit.gl.texture --> jit.gl.shader doesn't produce any errors. Any ideas what's going on here with slab, or what I'm doing wrong?

Using:
Max 5.1.2
Mac OSX 10.5.8
NVIDEA GeForce 9600M GT
MacBook Pro 3.06 GHz Intel Core 2 Duo
4 GB RAM

best
Z

Here's a simple patch showing the behavior:

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

Zachary Seldess's icon

Bump.

Anyone have ideas here? I'm sure I'm missing something simple. Joshua, Andrew, Wesley?

best,
Zachary

Joshua Kit Clayton's icon

You currently cannot safely pass down the chain with jit.gl.slab in the asynchronous readback, because of the other contextual state. It should work if you set the @thru attribute to zero, and then bang the slab in the rendering process (r other) in your patch.

Also, it would be recommended for sharing textures across contexts that you have the @shared_context attribute set for one of your jit.gl.render objects

Zachary Seldess's icon

Thanks for the help Joshua. Still a problem though. I need to reinstantiate the texture from the elevator context once after load, then it works. See the instructions on the patch. Any thoughts?

best,
Zachary

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

Wesley Smith's icon

Going off your original patch, does something like this work for you?

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

Zachary Seldess's icon

Thanks Wesley,

That does work, but the asyncread output is delayed by two frames (turn of qmetro and bang manually). The following way delays only by one frame. Is there any way to get rid of the delay, or is that just the nature of the async readback (automatic 0 doesn't make a difference for this, it seems).

best,
Zachary

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