I am currently working on an exciting project using three.js, and so far everything is going according to plan. The project involves displaying various meshes in different canvases, which has led me to encounter a particular issue.
My goal for the project is to have multiple canvases displayed simultaneously, each with its own context. However, I have come across the limitation of only being able to have 16 live WebGL contexts at once. Since I intend to display more than 16 canvases on a single page, I am exploring ways to work around this restriction by disabling a context when it is not visible on the screen. By dynamically enabling/disabling contexts as the user scrolls, I hope to overcome this limitation and have as many contexts as needed.
While I have discovered the renderer.forceContextLoss()
function, which allows me to force the disabling of a context, I have not been able to find a way to re-enable it. Although I can detect when a context is lost, I am struggling with restoring it.
If you have any suggestions or ideas on how I can accomplish this task, please feel free to share your insights.
Thank you in advance!