Emscripten port
Emscripten port
Hi
I've managed to get (at least) the 01.HelloWorld example to run on the webs with emscripten.
I've used the ogl-es branch to compile this. It uses a combo of SDL/EGL/GLES2 which seems to work.
Is there interest to get this in the source? What's the best way to share this.
Best to post a patch or post it on github?
I've managed to get (at least) the 01.HelloWorld example to run on the webs with emscripten.
I've used the ogl-es branch to compile this. It uses a combo of SDL/EGL/GLES2 which seems to work.
Is there interest to get this in the source? What's the best way to share this.
Best to post a patch or post it on github?
Re: Emscripten port
Hi and good work!
it would be interesting to have it. So far Emscripten should work by just using SDL device(for which irrlicht has already a device) and GLES2 .
In both cases we should be able to include support for irrlicht officially, I assume we just need to skip inclusion of libraries that are not available as headers and include the Emscripten includes.
it could be done by checking if the compiler is Emscripten: no need to use special compiler flags.
however I see one major issue.. Can you try upload it on some free webhost like altervista, put a big texture (like 2048x2048) and see if the texture load time cause the browser to hang while waiting to download the needed files?.
I think we should at least a custom HTML file to get rid of that horrible emscripten banner and use eventually the nice irrlicht logo
it would be interesting to have it. So far Emscripten should work by just using SDL device(for which irrlicht has already a device) and GLES2 .
In both cases we should be able to include support for irrlicht officially, I assume we just need to skip inclusion of libraries that are not available as headers and include the Emscripten includes.
it could be done by checking if the compiler is Emscripten: no need to use special compiler flags.
however I see one major issue.. Can you try upload it on some free webhost like altervista, put a big texture (like 2048x2048) and see if the texture load time cause the browser to hang while waiting to download the needed files?.
I think we should at least a custom HTML file to get rid of that horrible emscripten banner and use eventually the nice irrlicht logo
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
-
- Posts: 1010
- Joined: Mon Oct 24, 2011 10:03 pm
- Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d
Re: Emscripten port
There are many ways to handle file loading, typically you'd want to use some type of streaming to local storage for browser resources, as for the banner: emscripten documentation tells you how to correctly get rid of this at compile time
"this is not the bottleneck you are looking for"
Re: Emscripten port
The easiest way should be to prepackage all files at compile time (cannot be done by irrlicht), otherwise we have to add file streaming to irrlicht, but basically that would be a big change. (and a irrlicht logo added by default would be very nice that's why I prefer writing a HTML file than playing with emscripten options)
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
-
- Posts: 1010
- Joined: Mon Oct 24, 2011 10:03 pm
- Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d
Re: Emscripten port
emscripten itself is pretty smart, it can convert standard file loading to a more appropriate async method in js under certain conditions, I don't remember these off-hand but iirc it was pretty easy of a change for most programs.
"this is not the bottleneck you are looking for"
Re: Emscripten port
Yes, that's what I did and it mostly "just works". (only tested one Helloworld)REDDemon wrote:Hi and good work!
it would be interesting to have it. So far Emscripten should work by just using SDL device(for which irrlicht has already a device) and GLES2 .
Only small edits in the Makefile are needed and some ifdef's.REDDemon wrote:In both cases we should be able to include support for irrlicht officially, I assume we just need to skip inclusion of libraries that are not available as headers and include the Emscripten includes.
it could be done by checking if the compiler is Emscripten: no need to use special compiler flags.
How should I propose it for merge? Never used svn before.
Haven't done any testing. I used Emscripten's 'preload-file' function. Then you have to host a separate file with the filesystem.REDDemon wrote:however I see one major issue.. Can you try upload it on some free webhost like altervista, put a big texture (like 2048x2048) and see if the texture load time cause the browser to hang while waiting to download the needed files?.
I think we should at least a custom HTML file to get rid of that horrible emscripten banner and use eventually the nice irrlicht logo
The html is just an example. You can just compile to js and then implement the html yourself.
There is still a lot to do.
Re: Emscripten port
Wow, nice. Patch or github... both fine, but no guarantees I'll find time for merge. Although - in this case I might try to make time as this was something I had wanted to try for months already :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Emscripten port
https://drive.google.com/open?id=0B1eui ... 2ZPajg5emc <- emscripten.patch (svn diff > empscripten.patch)
Only tested the first example. So it's just a start. Don't know if I'm going to add a lot soon.
You can build the core with 'emmake make emscripten'
The example is build with 'emmake make all_emscripten'
I think you can also set the compiler an linker in the makefile so you don't need emmake.
CC=emcc etc
Based on https://svn.code.sf.net/p/irrlicht/code/branches/ogl-es
Revision: 5384
Only tested the first example. So it's just a start. Don't know if I'm going to add a lot soon.
You can build the core with 'emmake make emscripten'
The example is build with 'emmake make all_emscripten'
I think you can also set the compiler an linker in the makefile so you don't need emmake.
CC=emcc etc
Based on https://svn.code.sf.net/p/irrlicht/code/branches/ogl-es
Revision: 5384
Re: Emscripten port
OK, will have to figure out the emmake stuff as well I guess (I hope I can get that working with Debian as my Ubuntu system is broken at the moment). On first view the patch looks good. I hope I find some time. Thanks!
edit: Hm, I think might be worth giving it it's own hello-world (like Android has). Makes experimenting always a little easier.
edit: Hm, I think might be worth giving it it's own hello-world (like Android has). Makes experimenting always a little easier.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Emscripten port
Emscripten should go as easy on Debian as on ubuntu.
On linux there are no prebuilds so compiling it takes soms time. I just installed 'latest'. The packages in Ubuntu repo are too old.
The emmake commandant just sets all the env vars to point to the em compilers emcc and emc++ and the linker. Emconfigure does a similar think for if you do ./configure but should make it possible for configure to still build the tools needed on the host.
So its all not needed in this project. I could just add all the defines in the make file.
Making a separate example seems better.
On linux there are no prebuilds so compiling it takes soms time. I just installed 'latest'. The packages in Ubuntu repo are too old.
The emmake commandant just sets all the env vars to point to the em compilers emcc and emc++ and the linker. Emconfigure does a similar think for if you do ./configure but should make it possible for configure to still build the tools needed on the host.
So its all not needed in this project. I could just add all the defines in the make file.
Making a separate example seems better.
Re: Emscripten port
Unfortunately emscripten needs a newer glibcxx than Debian currently has (it's always the same problem really - software is developed for Ubuntu and then doesn't run on Debian which has outdated packages). Still have some hope it might be possible to build from scratch. Will try...
Also tried on Windows - emscripten is really easy to install there (run installer - done). But I never used OGL ES 2.0 on Windows with Irrlicht. And so far failing with that. Well, good chance to work on getting that running maybe :-)
Also tried on Windows - emscripten is really easy to install there (run installer - done). But I never used OGL ES 2.0 on Windows with Irrlicht. And so far failing with that. Well, good chance to work on getting that running maybe :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Emscripten port
I never used emscripten on windows but I thought it compiled with the same code path, with __UNIX__ defined etc and with the same headers. It "should" work.
Re: Emscripten port
Yeah, problem on Windows is not emscripten - but Irrlicht's ogl-es2 implementation... or more likely - I'm still doing something wrong.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Emscripten port
Still working on getting it running here, but patch looks fine, so I've applied it for now (with some minor changes).
Did comment out the _IRR_LINUX_PLATFORM_ (hack) in IrrCompileConfig.h for now. We could set it from Makefile maybe - or find some other solution. Will have to think about that (after I get it to work).
Did comment out the _IRR_LINUX_PLATFORM_ (hack) in IrrCompileConfig.h for now. We could set it from Makefile maybe - or find some other solution. Will have to think about that (after I get it to work).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Emscripten port
Hi labsin, I'm still failing to get it running, but maybe you can help me some more.
Could you send me your result - the .html, .js, .data (and I guess html.map also won't hurt).
Then I can test if maybe it's just a thing with my browsers that messes it up (thought I tried several).
Also some question about linker options. I noticed you used FULL_ES2=1 - did it fail without that?
Also you use linker flag -lGLESv2, but I don't find that in emscripten and the examples seem to use -lGL (unless I missed it). Did you try -lGL as well? Or without GLESv2?
Also I applied the patch manually (wanted to go over all lines to a feeling what's done). Maybe I messed up. If you could just try out the version of Irrlicht ogl_es checked-in right now and look if that still works on your system it would be great!
(my main changes should have been that the folders used are now no longer "linux" but "emscripten", the example has it's own folder and the _IRR_LINUX_PLATFORM_ is now set from Makefile so we can later add a Windows version without having to change headers).
Could you send me your result - the .html, .js, .data (and I guess html.map also won't hurt).
Then I can test if maybe it's just a thing with my browsers that messes it up (thought I tried several).
Also some question about linker options. I noticed you used FULL_ES2=1 - did it fail without that?
Also you use linker flag -lGLESv2, but I don't find that in emscripten and the examples seem to use -lGL (unless I missed it). Did you try -lGL as well? Or without GLESv2?
Also I applied the patch manually (wanted to go over all lines to a feeling what's done). Maybe I messed up. If you could just try out the version of Irrlicht ogl_es checked-in right now and look if that still works on your system it would be great!
(my main changes should have been that the folders used are now no longer "linux" but "emscripten", the example has it's own folder and the _IRR_LINUX_PLATFORM_ is now set from Makefile so we can later add a Windows version without having to change headers).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm