ogre3d is the most popular open source 3d rendering library for games. http://www.ogre3d.org/
and there have been a number of web porting attempts:
https://chrome.google.com/webstore/detail/ocpoapiejnpokdojkgjhglijajghikla
http://www.ogre3d.org/forums/viewtopic.php?f=10&t=64598
http://www.ogre3d.org/addonforums/viewtopic.php?f=3&t=14068
http://www.ogre3d.org/forums/viewtopic.php?f=1&t=62535
I think ogre3d-emscripten demo will be not only practical, but also a perfect example to demonstrate the capacity of emscripten's power since it is a very demanding real-time application.
a quick thing from irc chat: the plugin architecture of ogre3d (dlopen) will be a problem.
We actually support dlopen, so that part should work fine :)
I believe @ehsan spent some time on this, Ehsan how far did you get?
I definitely agree Ogre would be a nice demo. I've been meaning to look into it when I have time. However, Ogre is quite large, so another option might be Irrlicht, a smaller but still capable 3D engine. (Or both, eventually..)
@kkimlabs thanks for your interest!
I have actually done a fair amount of work on Ogre. You need to fix several things in Ogre which you can find on this branch https://github.com/ehsan/ogre/commits/build_fix. For my test builds, IIRC I disabled the plugin infrastructure.
Note that code size is going to be a huge problem, which was the main reason why I stopped working on this, However, please ping me on IRC or email me or contact me somehow if you need any help, as I spent a few weeks working on this port.
I made OGRE work on Emsritpen. detail information visit
https://github.com/mview/summary/wiki/Summary
@kripken I extended Emscripten support dynamic load library and not pack used files . It can make single file code size smaller, and Web Browser can download them in parallel, the whole performance is raised.
https://github.com/mview/summary/wiki/Why-Emscritpen-must-be-extended-%3F
I ran that now, very nice! :)
I would like to hear more about the linking issue. Overall in emscripten we tested dynamic linking in the past, but found it was hard to do in a way that is fully optimized. Right now we support some amount of dynamic linking through dlopen ( https://github.com/kripken/emscripten/wiki/Linking ) but not the general case.
I suspect the performance of your demo is suffering due to these issues - linkable code is harder for js engines to optimize. But, I am not sure how you did it, curious for more details as I said earlier.
@kripken
I use BUILD_AS_SHARED_LIB to build share library, not support asm.js yet. In the wiki , I don't find how to build asm.js share library. From wiki, it says:
Note: In non-asm code, there is an older option of BUILD_AS_SHARED_LIB which has fewer limitations.
Then how can I build asm.js share library ? I take care of link library.js/dlopen/... , in stead of using myself version.
For link share library, almost same method as the library.js/dlopen(). My code just support -l option, I update it in
https://github.com/mview/summary/wiki/Why-Emscritpen-must-be-extended-%3F
Yes, The demo should have optimize issues. I hope asm.js can help it. It seems even asm.js can't solve the issue.
yes, shared libraries are not supported in asm.js, we dont have a way to
make that fast yet. Instead, we recommend people build the project into one
binary, or use dlopen for loading separately-compiled code. See the wiki
page on linking https://github.com/kripken/emscripten/wiki/Linking
Sorry, I should told the test environment at first. I always test it on chrome, my chrome version is 32. Today I try in on fixfox 23 it even can't show the main menu. Now I understand why kripken complain there is performance issue.
In chrome 32, the demo looks smooth.
I also tested on chrome 33 over here. It is better than on firefox, but
still takes a long time to load. It takes much longer than a complete game
engine like Epic Citadel for example.
If ogre can't build into a single executable, and must use dynamic library
loading, then I suppose we can't use asm.js for it, which is a shame since
it is losing out on a lot of speed. Hopefully there is some way though?
I'm not sure if it's still relevant, but Ogre can be built as a single executable, that is the prefered way to do it for Android for example, just need to use a static build of the plugins and only use those that you actually need.
@joey2014
hello!
I'm trying to build Ogre with Emscripten too.
I wanted to look at you link:
https://github.com/mview/summary/wiki/Summary
but it seems to be a dead link.
I'm looking forward any help to build ogre with emscripten.
Thank you!
@ErasmeBeck
fix the link, please try it again.
@joey2014
Hello again Joey!
thank you for fixing the link.
I've tried to build ogre with your modified version of emscripten.
But you say to cd to the folder ogre/em here:
https://github.com/joeyview/ogre/wiki/document
I haven't found this folder. Have you renamed it?
@ErasmeBeck
Sorry not say it clearly, ogre has two branches, you need check out ogre build_fix branch, and you can find a directory em which can be built as ogre sample javascript version.
after you check out ogre source code for example in your home directory
.cd /home/
I also update the information on the link.
@joey2014
Thank you so much!!
@joey2014
It works!
It's a bit buggy though but for the first time I've been able to see Ogre in my web browser!!
Thank you again.
I'll try to work on it to understand how you did the magic.
Hi folks. It's great thing.
I also try it, but I occured the error and build fail on GNU/Linux(Linux Mint 16) with Emscripten-1.14.1.
Build:
. git checkout build_fix
. cd em
. emmake make BUILD="all -j8"
Occured the error:
ERROR root: build/data@data: No such file or directory ("build/data@data" was expected to be an input file, based on the commandline arguments provided)
make[2]: *** [SampleBrowser.html] Error 1
Could you help me?
Can you check if there is directory em/Samples/Browser/build in your source code? It should exist.
and you should use the modified Emscripten version as instruction:
How to build it?
must compile with the emscripten version modified as above.
First you must check out the emscripten source code & ogre source code,for ogre you need checkout build_fix branch, then you can build ogre source for javascript.
.....
@joey2014
Yes, it's exist.
. git branch
* build_fix
master
. pwd
/home/usagi/repos/ogre.emscripten/em
. ls Samples/Browser/build
./ ../ data/ jshelper.js
Oh, I've noticed, I'm not using modified Emscripten version. It's my mistake, sorry.
Thanks for your support @joey2014 .
@joey2014
Hey Joey2014, your works looks really interesting, but I don't understand what can I do here :
''Then you can copy the directory to your web server, and it can be run on web browser.''
Someone can explain me this step please ?
you need setup a web server like apache, then copy what you build or prebuilt ogre js version ( https://github.com/joeyview/ogre-js-sample/tree/master/browser/build) to web server directory, detail information refer to the web server's user guide. Then chrome can access the url and run ogre in chrome.
Thanks, it's works nice on chrome 35. however, crashed with firefox 29. I use windows 7 64 bit, maybe it's due to my nvidia card ( "hardware acceleration graphics" is enabled ). Do you have the same problem with firefox ?
@joey2014 ,i try to compile it in vs2010,but failed,and i find the environment is linux.if i want to use it in window ,how to do it?
@joey2014 if i want to compile ogre engine to js in vs2010 using platform "Emscripten" on windows, is there any way quickly?
Any updates on this issue? Any chance of @joey2014 version be merged on emscripten mainstream project?
Since Ogre3D 1.10 release, Ogre3D now officially supports Emscripten, see http://www.ogre3d.org/2015/01/04/review-of-2014-outlook-into-2015 . So closing this as done.
Most helpful comment
Since Ogre3D 1.10 release, Ogre3D now officially supports Emscripten, see http://www.ogre3d.org/2015/01/04/review-of-2014-outlook-into-2015 . So closing this as done.