-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors when trying to load a lot of models #538
Comments
Can you explain how I can build your website locally? I've installed hugo and go and when I run view.sh this is what I get and no server seems to be launched (I've never used hugo before):
I suspect there is either a race condition with initializing the viewers or a failure to properly account for viewers that are hidden. |
You'll need to install Hugo Extended. With that and Please let me know if you have any problem and thank you very much for your time. Rodrigo |
The spoiler tag in your page hides the embedded content by setting its size to zero (as opposed to leaving it the right size and setting display: none). You can't create a zero sized WebGL canvas, so that was causing the initial problem. With the fix above (d3c8de4) your page works nicely in firefox. However, it still has issues in Chrome. This is because there is a maximum number of allowed WebGL contexts (in theory it is 16 for both chrome and firefox, but firefox seems happy to display many more than that). You will see the message "WARNING: Too many active WebGL contexts. Oldest context will be lost." in the console when this happens. So you only end up with the 16 molecular viewers that were created last. This is a hard browser limit, however, we can work around it a bit. I've pushed a change (4e72ea8) that will regenerate a lost canvas on a resize event. This means when the spoiler tag is expanded the embedded viewer, if it has been lost, will be recreated and you'll be able to see it. However, if the user expands enough spoiler tags that >16 viewers are on the page at once then the least recently expanded ones will be deactivated (but they can reset them by toggling the spoiler). A fancier fix is to catch the lost context event and replace the webgl context with a png image. Then when a user tries to interact with it, regenerate the 3D context. However, obviously the disabled context wouldn't be spinning. This is Issue #292 |
Thanks a lot David! That was quick. I guess I can get access to those fixes using the latest version, i.e., loading the script with this line?
I tested it locally but it seems it's not working (I cleared my cache just in case). For now I think I'll be quite happy with those fixes. Thank you very much again, |
I just updated the webserver version. Try again. |
BTW, really beautiful website. |
It's working now! You're awesome! Now, if #449 could be addressed, so the molecules stretch to the size of their parent Thank you very much again for the quick fixes and for such an awesome piece of software 3Dmol.js is. BTW, I'm loading all models locally from my repo (downloading the |
So happy you like it. I'm putting a lot of effort to make it look nice and be useful and interesting. The English version is still way behind the Spanish one, but some day all the content will be translated. |
Is the grid viewer available when embedding? Would it help with this issue? |
BTW, the possibility of using |
Sorry.. this got stuck in an email backlog. A GridViewer let's you show multiple scenes using a single WebGL canvas, so it reduces the number of canvases you need, but it only applies if you want the viewers all right next to each other (in a grid). One way to hid the canvas limitation from your website users with your site design would be to collapse the other viewers (spoiler tags) when a new one is opened. Or you could catch the context lost event and collapse the spoiler tag of the offending context. I've updated the documentation with data-cid |
Is there an easy way to use the GridViewer when embedding? I don't see much documentation about it. Thank you! |
Sorry - meant to answer that. No, there's currently no support for grid viewers when embedding. |
[:LABEL:]
I'm not sure if this could be a BUG.
Description
I have included a lot (62 actually) of models in my website here (source here). I have checked that all models load fine when including them one by one (testing it locally). But once they're all there, the models won't load. As you can see in the console, I'm getting a lot of these errors:
Relevant Context
I'm loading the same models in these slides (source here) and weirdly I can see some models, but most of them not.
I'm using version 1.7.0 of 3Dmol.js and I'm testing it with both Google Chrome v94 and Safari v15 on macOS 11.6.
Thank you very much in advance,
Rodrigo
The text was updated successfully, but these errors were encountered: