Display different scenes sharing resources on multiple canvases

前端 未结 1 1204
灰色年华
灰色年华 2020-12-19 18:57

I\'m using three.js to create an interactive web application, and I\'ve run into a little stumbling block:

I have a number of canvases contained in draggable divs on

1条回答
  •  南笙
    南笙 (楼主)
    2020-12-19 19:45

    Unfortunately you can not (yet) share resources across canvases. A couple of options

    1. Render the different viewports in different parts of the same canvas.

      Example: http://webglsamples.org/multiple-views/multiple-views.html

    2. Make a canvas that covers the entire window, use place holder elements to figure out where to draw, use getClientBoundingRect to set the viewport & scissor settings to draw scenes in each element

      Example: Is it possible to enable unbounded number of renderers in THREE.js?

    3. Render the scene to an offscreen canvas then draw it into a visible canvases.

      
      
      
      
                                       
                    
提交回复
热议问题