In the same Jupyter cell. There seems to be some sort of race condition about which GLContext is active. Subsequent rendering calls would complain about not being able to build the program (or just crash the interpreter).
The only way I could convince the code to not crash was to lazily instantiate all buffers such that we guarantee they are active (via the contextmanager on the call to rasterize).
I also added a missing calling to self.opengl_ctx.finish() which caused random crashes when reading buffers for very large images.
We were seeing issues when writing code like this
In the same Jupyter cell. There seems to be some sort of race condition about which GLContext is active. Subsequent rendering calls would complain about not being able to build the program (or just crash the interpreter).
The only way I could convince the code to not crash was to lazily instantiate all buffers such that we guarantee they are active (via the contextmanager on the call to rasterize).
I also added a missing calling to
self.opengl_ctx.finish()
which caused random crashes when reading buffers for very large images.