Reputation: 21
In Autodesk Forge Viewer I cannot instantiate more than 6 viewers (Autodesk.Viewing.ViewingApplication) on the same page.
I've tried a solution proposed here which doesn't work: There are too many active WebGL contexts on this page, the oldest context will be lost. [dedup.min.js]
The function I use:
Autodesk.Viewing.Initializer(options, function onInitialized(){
this.viewerApp = new Autodesk.Viewing.ViewingApplication(this.div_id);
this.viewerApp.registerViewer(this.viewerApp.k3D, Autodesk.Viewing.Private.GuiViewer3D, { extensions: ['PropertyInspectorExtension']});
this.viewerApp.loadDocument(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
}.bind(this));
Apparently, there is a way* to do it with Three.js but is it somehow implemented in Autodesk Forge ? Otherwise I don't know how to do it myself.
*Answers: Display multiple instances of three.js in a single page Is it possible to enable unbounded number of renderers in THREE.js?
*Example of result: https://threejs.org/examples/webgl_multiple_elements.html
Upvotes: 0
Views: 4830
Reputation: 4598
I know this is a bit of a workaround, but you could use this command line switch with Chrome:
--max-active-webgl-contexts=<number>
Of course this will only fix it for you and not anyone else, but sometimes that's enough.
Upvotes: 2