Embedded Web browser on an Irrlicht poly - example with src
Embedded Web browser on an Irrlicht poly - example with src
A friend of mine is thinking of using Irrlicht3d for a project and wanted to know if my embedded browser library (http;ubrowser.com) would work with it. It does and I put together a trivial example which is a little rough around the edges so I'm hoping someone who knows Irrlicht will improve on it. The only controls are 1 -5 to change the URL and ESC to quit.
If input can be made to work within Irrlicht - perhaps in a similar fashion to the uBrowser demo included in the binary archive - then interactive pages can be used with Irrlicht 3d. All that's needed is a way to generate mouse down/up/move in the correct coordinate space - LLmozLib will take care of sending it to the embedded browser. This could for example, open some interesting user interface possibilitiess using XUL.
At it's heart, it uses the Mozilla Gecko 1.8.1.x rendering engine that is used in Firefox 2 so most pages render correctly. The work to get plugins to work (primarily Flash) is in progress.
LLmozLib & uBrowser does works on Linux and Mac platforms - I just need to bundle the right pieces together. I should get to that soon.
source code for the demo is here:
http://s3.amazonaws.com/callum-linden/l ... 070423.zip
Win32 executable app (plus all the required runtime cruft) is here along with some other embedded browser demos.
http://s3.amazonaws.com/callum-linden/l ... 070423.zip
LLMozLib/uBrowser source code etc. can be found here:
http://ubrowser.com
Enjoy.
Callum.
Obligtory screenshot:
If input can be made to work within Irrlicht - perhaps in a similar fashion to the uBrowser demo included in the binary archive - then interactive pages can be used with Irrlicht 3d. All that's needed is a way to generate mouse down/up/move in the correct coordinate space - LLmozLib will take care of sending it to the embedded browser. This could for example, open some interesting user interface possibilitiess using XUL.
At it's heart, it uses the Mozilla Gecko 1.8.1.x rendering engine that is used in Firefox 2 so most pages render correctly. The work to get plugins to work (primarily Flash) is in progress.
LLmozLib & uBrowser does works on Linux and Mac platforms - I just need to bundle the right pieces together. I should get to that soon.
source code for the demo is here:
http://s3.amazonaws.com/callum-linden/l ... 070423.zip
Win32 executable app (plus all the required runtime cruft) is here along with some other embedded browser demos.
http://s3.amazonaws.com/callum-linden/l ... 070423.zip
LLMozLib/uBrowser source code etc. can be found here:
http://ubrowser.com
Enjoy.
Callum.
Obligtory screenshot:
Last edited by callump on Fri Apr 27, 2007 7:27 pm, edited 1 time in total.
It's essentially the same thing as Firefox 2.0 uses.
I'd like to figure out how to add my own tags though - that would be really useful. I know how to 'catch' URLs - it's a bit of a hack but you can catch a dummy link and act on it in the embedding app. I'd like to improve on this to expose all of the DOM.
I'd like to figure out how to add my own tags though - that would be really useful. I know how to 'catch' URLs - it's a bit of a hack but you can catch a dummy link and act on it in the embedding app. I'd like to improve on this to expose all of the DOM.
Wow thats awesome thats exactly what I was implying...this is great man. Ill make use of this for sure.callump wrote:Well, there is a callback when a link is clicked so example you might be able to say "<a href="" game_option="2">Start Game</a> and catch the url complete with game_option flag.
If it a bit of a hack though - I'll try to improve on it once the other bits are in place.
PS: The mozilla engine is outputting the webpage to a texture? Does this mean we can use "makeColourKeyTexture" and set a colour transparent? Can you capture any link that the engine attempts to direct to? eg. If it was called from say flash?
Im dreaming up a very creative game hud right now...
I guess so - after it's rendered to memory/texture, it's just like any other texture so other functions in the API will work on it as expected.BlindSide wrote:PS: The mozilla engine is outputting the webpage to a texture? Does this mean we can use "makeColourKeyTexture" and set a colour transparent?
I haven't tried but if links from Flash go through the same path in the Mozila code then it will work.BlindSide wrote:Can you capture any link that the engine attempts to direct to? eg. If it was called from say flash?
The Flash integration is ongoing. You can play Flash back now if you (a) copy the Flash DLL into the right place and (b) force a regular update by adding something that changes regularly or doing it in code. Input doesn't work at all yet though but you can play back YouTube videos this way.
-
- Posts: 38
- Joined: Mon Sep 25, 2006 6:31 pm
- Location: San Francisco, California
callump,
You may find interesting how LLMozLib was integrated within Ogre by another team:
http://www.ogre3d.org/phpBB2/viewtopic.php?t=32384
Good inspiration for a similar Irrlicht integration!
You may find interesting how LLMozLib was integrated within Ogre by another team:
http://www.ogre3d.org/phpBB2/viewtopic.php?t=32384
Good inspiration for a similar Irrlicht integration!
It's easier to curse a candle than light the darkness
-
- Posts: 109
- Joined: Tue Jan 09, 2007 1:18 pm
This is awesome! Making GUI's with this would be extremely fun. I wonder if it can catch POST method from forms and such?
Crimson Glory full Irrlicht game source code!
What I Do - my blog & dev log
Currently developing Link-Dead
What I Do - my blog & dev log
Currently developing Link-Dead
Thanks Callum!
I had problems linking with VC8, found out I needed to compile ubrowser again. That led to having to compile mozilla ... and basically losing 2 days. Thought I would post my experience for the next poor soul. So in case any one is interested in getting this to work with VC8, re-live 2 days of pain in 12 easy steps.
Some of these are from memory, and my memory, unfortunately, is like a retarded goldfish on crack, so beware.
*edit* Added step 8.1, this patch must be enabled to get nsIToolkitObserver. I also added a few more references.
*side note* I couldn't get Mozilla to run in an Active-X in Internet Explorer. The control worked fine any where else, but in IE, it complained of a currupt heap. So I had to run Mozilla in a separate process and use shared memory. But now I have Mozilla in Irrlicht in IE, and all is right with the world.
I had problems linking with VC8, found out I needed to compile ubrowser again. That led to having to compile mozilla ... and basically losing 2 days. Thought I would post my experience for the next poor soul. So in case any one is interested in getting this to work with VC8, re-live 2 days of pain in 12 easy steps.
Some of these are from memory, and my memory, unfortunately, is like a retarded goldfish on crack, so beware.
Code: Select all
Build Mozilla with VC8
1) Download Mozilla build tools and extract to 'c:/mozilla-build'
- http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-1.1.exe
- http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites
2) Delete the 'moztools' folder under 'c:/mozilla-build' and replace with
the VC8 version from mozilla.
- http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/
3) Copy msvcr80.dll and msvcr80d.dll to 'c:/mozilla-build/moztools/bin'
- Look in 'C:/Program Files/Microsoft Visual Studio 8/VC/redist/'
or find them online.
4) Checkout mozilla to 'c:/mozilla'
- CVS :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
MODULE mozilla
TAG MOZILLA_1_8_1_RELEASE
- http://developer.mozilla.org/en/docs/Mozilla_Source_Code_Via_CVS
5) Download llmozlib from ubrowser and install
- http://ubrowser.com/downloads.php
6) Copy the config file
/*** DEBUG VERSION ***/
- Copy './llmozlib/build_tools/.mozconfig.debug' to 'c:/mozilla/.mozconfig'
/*** RELEASE VERSION ***/
- Copy './llmozlib/build_tools/.mozconfig.optimized' to 'c:/mozilla/.mozconfig'
7) Launch 'c:/mozilla-build/start-msvc8.bat'
8) Navigate MINGW to 'c:/mozilla/'
- cd /c/mozilla
8.1) Apply patch(s) in './llmozlib/build_mozilla';
- patch -p0 < /path/to/file.patch
9) Build mozilla
- make -f client.mk build_all
10) Eventually, certain files like 'xpt_link.exe' will cause errors related to
missing manifest(s). You will need to copy the .manifest file into the
folder with the exe that failed.
- Example during debug build, for 'xpt_link.exe', I had to copy
'C:/mozilla/objdir-debug-xulrunner-small/xpcom/typelib/xpt/tools/xpt_link.exe.manifest'
to
'C:/mozilla/objdir-debug-xulrunner-small/dist/bin/xpt_link.exe.manifest'
- Easiest way is just to do a search for '*.manifest' in 'c:/mozilla/%OBJ_FOLDER%/' and be
ready to drag them into the appropriate folder. '%OBJ_FOLDER%' varies for debug /
release build.
11) If build failed because of manifest, goto step (9), else ???.
12) Run './llmozlib/build_tools/copy_mozilla_files.bat' which will copy 'important' files
into './llmozlib/libraries/i686-win32'
Things should now be to the flavor of 'the usual problems'.
Best of luck!
Notes:
* Someone said if you're using VC8 Express, you need to add
"ac_add_options --disable-crypto" to disable crypto.
I wouldn't know, I have the full version.
References:
* http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites
* http://developer.mozilla.org/en/docs/Mozilla_Build_FAQ#Win32-specific_questions
* http://developer.mozilla.org/en/docs/Debugging_Mozilla_on_Windows_FAQ
* http://developer.mozilla.org/en/docs/Configuring_Build_Options
* http://developer.mozilla.org/en/docs/Mozilla_Source_Code_Via_CVS
* http://groups.google.com/group/ubrowser/browse_thread/thread/377cb116d830d504
* http://blog.vlad1.com/archives/2006/02/13/93/feed/
* http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=20960
* http://www.ogre3d.org/phpBB2/viewtopic.php?t=32384
* http://ubuntuforums.org/archive/index.php/t-123985.html
* http://www.sephiroth-j.de/mozilla/moztools.vc8/
* http://forums.mozillazine.org/viewtopic.php?t=338845
* http://groups.google.com/group/mozilla.dev.builds/browse_thread/thread/c44057291e55a933/1fc812c0ef0be9e7
* http://wiki.secondlife.com/wiki/Compiling_the_viewer_libraries_%28MSVS_2003%29#LLMozLib
* https://lists.secondlife.com/pipermail/sldev/2007-July/002873.html
* http://wiki.secondlife.com/wiki/Compiling_the_viewer_libraries_%28MSVS_2003%29#LLMozLib
* http://wiki.secondlife.com/wiki/Source_downloads
* https://wiki.secondlife.com/wiki/Compiling_the_viewer_%28MS_Windows%29#LLMozLib
*side note* I couldn't get Mozilla to run in an Active-X in Internet Explorer. The control worked fine any where else, but in IE, it complained of a currupt heap. So I had to run Mozilla in a separate process and use shared memory. But now I have Mozilla in Irrlicht in IE, and all is right with the world.
Last edited by bob on Tue Aug 07, 2007 1:10 am, edited 3 times in total.
-
- Posts: 38
- Joined: Mon Sep 25, 2006 6:31 pm
- Location: San Francisco, California
Bob, many thanks for the step-by-step compile instructions for llmozlib!
But I'm still having a problem. I compiled the library the way you suggest, with success. But when I try to run Callum's test app there's a linking error:
Also, someone compiled llmozlib for VC8 (Express Edition, the version I'm using) and it's hosted online (check http://groups.google.com/group/ubrowser ... 16d830d504)
With that version of the library I have exactly the same linking problem. Does anyone have a clue about why is that?
But I'm still having a problem. I compiled the library the way you suggest, with success. But when I try to run Callum's test app there's a linking error:
Code: Select all
1>msvcprt.lib(MSVCP80.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in llmozlib_irr.obj
Also, someone compiled llmozlib for VC8 (Express Edition, the version I'm using) and it's hosted online (check http://groups.google.com/group/ubrowser ... 16d830d504)
With that version of the library I have exactly the same linking problem. Does anyone have a clue about why is that?
It's easier to curse a candle than light the darkness
I think I've seen that error ...
Some suggestions...
- My foremost guess would be that you're linking something built with another version of VC or with another service pack. Possible?
- Make sure your using /MD or /MDd, i.e. Multi-threaded DLL / Multi-threaded Debug DLL, You can't static link against the Mozilla XRE.
- Turn on the /VERBOSE option in the linker, and check this config on each dependency, make sure they all match. Be sure you recognize each .lib, that it's built correctly, etc ... the usual pain in the ...
- There's also a patch you can apply, I'll add it to the check list above. I got things working without it, so I'm not sure what it does. Some type of bug birth control I'm sure ...
I actually tried to build the version you linked to and couldn't make it work. I believe it was a service pack difference. I have VC8/SP1.
Some suggestions...
- My foremost guess would be that you're linking something built with another version of VC or with another service pack. Possible?
- Make sure your using /MD or /MDd, i.e. Multi-threaded DLL / Multi-threaded Debug DLL, You can't static link against the Mozilla XRE.
- Turn on the /VERBOSE option in the linker, and check this config on each dependency, make sure they all match. Be sure you recognize each .lib, that it's built correctly, etc ... the usual pain in the ...
- There's also a patch you can apply, I'll add it to the check list above. I got things working without it, so I'm not sure what it does. Some type of bug birth control I'm sure ...
I actually tried to build the version you linked to and couldn't make it work. I believe it was a service pack difference. I have VC8/SP1.
-
- Posts: 38
- Joined: Mon Sep 25, 2006 6:31 pm
- Location: San Francisco, California
First, I'm not a Mozilla expert by any means, and had quite a time getting things working myself. But it's extremely useful in my project and has been worth the effort. That said, the only things I can think of with my limited brainpower...
- It is possible to static link Irrlicht, this is the configuration I use. Just define '_IRR_STATIC_LIB_'.
- I switched llmozlib to /MD~/MDd and it worked fine. I swear I read in the Mozilla documentation that you can only dynamically link, but am unable to dig up a reference.
- I did try to switch the .mozconfig file to a static link configuration and couldn't get it to work.
- I actually created a wrapper dll (also dynamically linked) that exported the functionality. Not sure how that affected my luck in getting things going ... I'd be glad to share if you're interested...
Callump, mighty keeper of the cubic browser, please humble the with any words of wisdom
- It is possible to static link Irrlicht, this is the configuration I use. Just define '_IRR_STATIC_LIB_'.
- I switched llmozlib to /MD~/MDd and it worked fine. I swear I read in the Mozilla documentation that you can only dynamically link, but am unable to dig up a reference.
- I did try to switch the .mozconfig file to a static link configuration and couldn't get it to work.
- I actually created a wrapper dll (also dynamically linked) that exported the functionality. Not sure how that affected my luck in getting things going ... I'd be glad to share if you're interested...
Callump, mighty keeper of the cubic browser, please humble the with any words of wisdom