Skip to content
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

Compile XaoS for the web via Qt #151

Closed
kovzol opened this issue May 5, 2020 · 2 comments
Closed

Compile XaoS for the web via Qt #151

kovzol opened this issue May 5, 2020 · 2 comments

Comments

@kovzol
Copy link
Contributor

kovzol commented May 5, 2020

On Feb 6 I managed to compile XaoS as recommended at
https://wiki.qt.io/Building_Qt_5_from_Git
https://wiki.qt.io/Qt_for_WebAssembly
https://doc.qt.io/qt-5/wasm.html
Both Firefox and Chrome is freezing on the startup:
image
But after a few seconds when Firefox asks if the process should be stopped, the init screen of XaoS is shown properly (interaction and running is however not possible):
image
This is very promising for the first attempt, I think we will be able to run XaoS in the browser in a reasonable time.

More info added later:
Some update... Meanwhile I learned that Qt can be compiled as pthread-capable and non-pthread-capable. The second one is the default. Unfortunately, Firefox no longer supports the first one out-of-the-box, but Chrome does. But I think we can disable thread support by removing USE_PTHREADS for the WebAssembly build.

Actually I still have no luck in making XaoS run in a browser, and thread handling is not the problem. It is clear that the main loop in MainWindow::eventLoop() is working, but for some reason the canvas will be actually never drawn. Only Firefox draws the final state of the canvas after I force the main loop to stop (when Firefox asks me to do that because the app is not responding). I assume that this kind of loop is incompatible with the WebAssembly approach, but not completely sure yet.

At https://github.com/msorvig/qt-webassembly-examples/tree/master/gui_opengl there is a quite minimal example that properly works in my Linux natively and also with the browser... I am afraid that the solution we currently use in XaoS is not supported in a browser at all---making an infinite loop with for(;;) is something that kills the browser resources since it is something synchronous. I guess we may need to think in asynchronous events.

JB's response:

Yes, I think that the event loop needs to be redone the Qt way. I was planning to do that anyway at some point but was going to wait until after 4.0. I think that probably the right way to do it for XaoS is to use a QTimer to fire periodically and call the UIH functions to update the fractal.

@szhorvat
Copy link
Contributor

I just saw the new release with WebAssembly support. Are you hosting an online version on the XaoS website somewhere, and if not, would you consider doing so? This would be immensely useful for teaching.

@kovzol
Copy link
Contributor Author

kovzol commented Sep 29, 2023

Yes, it's at https://matek.hu/zoltan/xaos. Feel free to use it, it is planned to be there permanently.

@kovzol kovzol closed this as completed Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants