Tue, 02/15/2022 - 15:08
Not sure how best to describe, and I fear I've done something stupid, but after successfully building and running the webgl sample once, I now no longer manage to run it correctly: the view remains black, nothing is shown within - no text, no brep, and not the cube on the right! The console output still works and reacts to events though.
What i did since the last successful run is try construct and show my own brep instead of the loaded one. Since it didn't work, i restored the original sample code, deleted the build folder, and reran the build + install. but to no avail! For all i know the sample should run just as it did last night, but apparently there's something different now, and i have no idea what it might be!
What could be causing this?
P.S.:
I just tried it on a different browser (Chrome instead of FireFox), and the sample runs just fine! But i still don't know what could be causing this problem on Firefox?
Tue, 02/15/2022 - 19:14
A couple of my sad tips:
Partial re-builds are fast but might lead to weird issues due to CMake missing some update, Make missing some update or developer missing some errors in logs but still having some binaries in output folder. I'm prefer to have an option clearing all building artifacts at once before build and reproducing all building steps cleanly in batch script (like toClean=1 does in wasm_build.bat) - which could be achieved by manually removing all working and installation folders.
Browser cache works very strangely. Theoretically, it is supposed that server and web-application should manage lifetime of downloaded files, so that Browsers will re-download files with the same URL when time expires. When this doesn't work (which is often the case for development server, although I've seen the same issue with production servers and developers told me they have no idea how to solve this) - Browser might download some files anew and keep using some files from cache. Things become worse because user expects that refreshing a page (F5) should re-download files - but Browsers don't do it (for all files)! It is possible to reliable clean up cache for a specific site in Browser settings, but I simply open development sites from "Private sessions" and restart the session on site update. I guess that rotating URLs to WASM artifacts and JS files on content change might help, but haven't seen any server using that approach.
If you are developing an AngularJS application - it's "ng serve" might cache WASM artifacts somewhere deep in it's own cache and ignore requests to reset cache. Once, I have to delete entire cache folder to fix the problem.
And unreliable - it might hang indefinitely, especially when site is opened from multiple Browsers, and you might need killing and restarting server from time to time. Or use a more reliable server for testing. Python 3.7+ has threaded version of simple HTTP server, but I haven't yet checked if it helps with freezes.
You might want to print some message into JavaScript console from WASM application with build information to ensure that you are actually running the latest build, not some older cache.