I am currently working on a project using three.js to develop an interactive web application, but I have hit a roadblock:
Within the design, there are numerous canvases enclosed in draggable divs on the page. Each canvas is meant to showcase a 3D object with a unique material applied, utilizing custom shaders. These materials all rely on a shared texture (varying from blue-tinted to desaturated).
The quantity of canvases may fluctuate, commonly exceeding 20, which makes resource sharing, especially for large textures, extremely advantageous.
Thus far, I have been employing multiple renderers, cameras, and scenes, which has worked well except when attempting to utilize the same texture across various scenes.
Much of the materials use shared uniforms and attributes to prevent redundant information and maintain synchronization between them (i.e., changes in some materials should reflect uniformly across all).
I am curious if there is a way to share textures among different scenes/renderers/canvases? When attempting this, I receive the following error message:
WebGL: INVALID_OPERATION: bindTexture: object not from this context
In my quest to troubleshoot this issue, I stumbled upon the suggestion that creating multiple viewports could resolve it, although I am uncertain how to display distinct viewports over diverse canvases.
TL/DR;
Is it possible to:
- Show the same scene on different canvases?
- Utilize the same uniforms (including a texture uniform) across different scenes, renderers, and/or canvases?
Thank you in advance!
Griffork