Torque 3D Embedded Browser (WebKit)
by Josh Engebretson · in Torque 3D Professional · 01/15/2010 (8:55 pm) · 305 replies
Hey guys,
Here are some highlights:
1) It uses QtWebKit which is based off Apple's WebKit, the same HTML5/Canvas based web rendering engine from Chrome, Safari, Adobe AIR
2) QtWebKit is *easily* the best designed embeddable web browser I have found in exhaustive travels... (I actually compiled Chrome from source at one point, not recommended). Qt is *extremely* well supported and owned by Nokia who recently paid $153,000,000 for it. So, it is probably going to be around for some time.
3) Flash works :)
4) It is setup as a GuiControl so interacts perfectly with mouse events, control overlap, filters...
There are currently 3 rendering modes:

1) Render to Texture: This mode renders the web view to an offscreen buffer and then uploads it to a GFXTexHandle. It uses the Torque GUI system input for mouse and keyboard. As we're rendering to a texture, compositing and rendering to 3d surfaces is possible. Flash renders as long as it is set to windowless mode in the HTML (not a big deal). Instead of using Flash for anything other than presentation/video playback, I would suggest looking into Canvas/HTML5/CSS animations/effects in this mode.

2) Render Native: This mode integrates a native child window with Gui Control, giving the best of both worlds :) There is no need to render to texture as we're using an actual clipped child HWND which uses the Torque GUI system for position/extents and focus :) Transparency does not currently work, however under Vista/Win7 this should be possible. I should be able to get masking working with minimal effort, which would allow for shaped windows and transparent areas.

3) Render Popup: This mode pops up a standalone window, which is owned by the application and consistent in scripting with other modes. This is useful for things like integrated document browsing, tutorial video watching, game doc reading, game forum reading, etc... where you don't want to crowd your game interface with browser. However, you want CLOSE scripted integration with a standard browser (no worries of IE/Mozilla/Chrome), which isn't possible with the current "launch browser" functionality.
These modes work with HTTPS adding a nice way to authenticate to servers, secure purchasing, etc.
It is still pretty early in the development and the idea with the code release will be to get feedback on usability and features... especially WRT integration with Javascript on the page, etc.
EDIT: The first version has been released and is available HERE
Regards,
- Josh Engebretson
Mythos Labs, LLC
Here are some highlights:
1) It uses QtWebKit which is based off Apple's WebKit, the same HTML5/Canvas based web rendering engine from Chrome, Safari, Adobe AIR
2) QtWebKit is *easily* the best designed embeddable web browser I have found in exhaustive travels... (I actually compiled Chrome from source at one point, not recommended). Qt is *extremely* well supported and owned by Nokia who recently paid $153,000,000 for it. So, it is probably going to be around for some time.
3) Flash works :)
4) It is setup as a GuiControl so interacts perfectly with mouse events, control overlap, filters...
There are currently 3 rendering modes:

1) Render to Texture: This mode renders the web view to an offscreen buffer and then uploads it to a GFXTexHandle. It uses the Torque GUI system input for mouse and keyboard. As we're rendering to a texture, compositing and rendering to 3d surfaces is possible. Flash renders as long as it is set to windowless mode in the HTML (not a big deal). Instead of using Flash for anything other than presentation/video playback, I would suggest looking into Canvas/HTML5/CSS animations/effects in this mode.

2) Render Native: This mode integrates a native child window with Gui Control, giving the best of both worlds :) There is no need to render to texture as we're using an actual clipped child HWND which uses the Torque GUI system for position/extents and focus :) Transparency does not currently work, however under Vista/Win7 this should be possible. I should be able to get masking working with minimal effort, which would allow for shaped windows and transparent areas.

3) Render Popup: This mode pops up a standalone window, which is owned by the application and consistent in scripting with other modes. This is useful for things like integrated document browsing, tutorial video watching, game doc reading, game forum reading, etc... where you don't want to crowd your game interface with browser. However, you want CLOSE scripted integration with a standard browser (no worries of IE/Mozilla/Chrome), which isn't possible with the current "launch browser" functionality.
These modes work with HTTPS adding a nice way to authenticate to servers, secure purchasing, etc.
It is still pretty early in the development and the idea with the code release will be to get feedback on usability and features... especially WRT integration with Javascript on the page, etc.
EDIT: The first version has been released and is available HERE
Regards,
- Josh Engebretson
Mythos Labs, LLC
About the author
http://www.TheEngine.Co
#202
Code is modified as per instructions here
Anyone else try a build in preview?
04/14/2011 (9:11 am)
Successfully complied into 1.1 preview loads and the browserwnd gui works but I get No Texture where I should have web content renderedCode is modified as per instructions here
Anyone else try a build in preview?
#203
< same results as you. Haven't delved into it any deeper, except to triple-check all of the procedure steps.
04/16/2011 (8:12 am)
@ Jamie62< same results as you. Haven't delved into it any deeper, except to triple-check all of the procedure steps.
#204
I've looked through the source focusing on the materials directory but haven't yet found anything yet.
In the past lighting setup has resulted in similar no texture messages. I'm interested by the isforwardlit param which has appeared since 1.1.3 night be worthy of more work
Has anyone seen a formal list of changes 1.1.3 vs preview would greatly ease tracking this down
04/16/2011 (2:25 pm)
Thanks for that Ken, good to know I haven't missed somethingI've looked through the source focusing on the materials directory but haven't yet found anything yet.
In the past lighting setup has resulted in similar no texture messages. I'm interested by the isforwardlit param which has appeared since 1.1.3 night be worthy of more work
Has anyone seen a formal list of changes 1.1.3 vs preview would greatly ease tracking this down
#205
If I deploy to web by changing the conf file to add in the web plugin build it works perfectly
Except when I close the tab in the browser (IE, FF and Chrome) I get a crash which pulls the entire browser down
Chrome tends not to crash due to its process model but you get errors if you try to open the plugin page again
I occasionally (but not repeatably) see a crash when I close out the normal exe as well
Could be an ordering problem with the module shutdown sequence or something not being deleted
04/21/2011 (7:51 am)
Further interesting oneIf I deploy to web by changing the conf file to add in the web plugin build it works perfectly
Except when I close the tab in the browser (IE, FF and Chrome) I get a crash which pulls the entire browser down
Chrome tends not to crash due to its process model but you get errors if you try to open the plugin page again
I occasionally (but not repeatably) see a crash when I close out the normal exe as well
Could be an ordering problem with the module shutdown sequence or something not being deleted
#206
05/11/2011 (4:54 pm)
Cooooooooll!!!
#207
05/17/2011 (11:41 am)
Anyone get additional signals/slots to work, such as functionality for back/forward? I've been trying to no avail for a while, and looking at the default Qt configuration, it looks like it's not set up to track history?
#208
05/25/2011 (8:51 pm)
Does anyone know if QtWebKit works with the Torque 3D 2009 pro 1.1 beta 3 or does it make a difference.
#209
05/26/2011 (6:32 am)
Yes the QTWebkit works with 1.1 B3. If you read back a few pages you will see the various steps required to get it running.
#210
05/26/2011 (8:02 am)
Why don't you update the posted file so you will save everyone the time and effort of the "various steps required to get it running."?
#211
Dee
05/26/2011 (8:43 am)
Thinks for the reply! Great job! I just wanted to throw out a few ideas about the feature and the way things are going. I would love to see this engine lay over top of my OS so that I could host my business meetings. This would involve rendering my desktop or if secure even a command prompt. I feel that there are unimaginable mediums in which this process could be used. For example I'm currently a full-time online student and I would love to create a virtual campus that would showcase this product. Plus just as a thinking point to render Google maps on a cylinder virtually would be cool. I don't want to give away all my ideas but I have allot more. At one point there will come a time when there will be a 3rd layer of the internet that will be in 3D. "Dream as hard as you can then let reality bring you back into perspective."Dee
#212
06/07/2011 (1:31 pm)
Has anyone tried to implement the webkit for the Torque 3D 1.1 Final Version yet?
#213
06/07/2011 (8:07 pm)
Waiting on the release of AFX for 1.1 Final before trying... Will post here with results then.
#214
06/08/2011 (6:56 am)
I will be trying soon as well as soon as I finish my other work. I'll post as well when I get to it.
#215
06/08/2011 (10:27 am)
I'm a newbie to programing but I'm almost there with finishing my build. I had a question about applying patching patch < konrad-patch1.diff and patch < konrad-patch2.diff. If I'm using Win7 what is a good way to apply the patch.. ps I have installed patch-2.5.9-7-setup from GnuWin32 project but i could not get it to work.
#216
patch < konrad-patch1.diff
(Stripping trailing CRs from patch.)
patching file guiWebCtrl.cpp
Hunk #1 FAILED at 15.
Hunk #2 FAILED at 77.
Hunk #3 FAILED at 127.
Hunk #4 FAILED at 159.
Hunk #5 FAILED at 451.
5 out of 5 hunks FAILED -- saving rejects to file guiWebCtrl.cpp.rej
(Stripping trailing CRs from patch.)
patching file guiWebCtrl.h
Hunk #1 FAILED at 160.
Hunk #2 FAILED at 181.
patch unexpectedly ends in middle of line
Hunk #3 FAILED at 198.
3 out of 3 hunks FAILED -- saving rejects to file guiWebCtrl.h.rej
any idea's on what I'm doing wrong... other then trying to build it by my self..
06/08/2011 (9:54 pm)
Ok so I was not able to find away to apply patch in win7 so I moved my files over to the ubuntu box. patch < konrad-patch1.diff
(Stripping trailing CRs from patch.)
patching file guiWebCtrl.cpp
Hunk #1 FAILED at 15.
Hunk #2 FAILED at 77.
Hunk #3 FAILED at 127.
Hunk #4 FAILED at 159.
Hunk #5 FAILED at 451.
5 out of 5 hunks FAILED -- saving rejects to file guiWebCtrl.cpp.rej
(Stripping trailing CRs from patch.)
patching file guiWebCtrl.h
Hunk #1 FAILED at 160.
Hunk #2 FAILED at 181.
patch unexpectedly ends in middle of line
Hunk #3 FAILED at 198.
3 out of 3 hunks FAILED -- saving rejects to file guiWebCtrl.h.rej
any idea's on what I'm doing wrong... other then trying to build it by my self..
#217
(Stripping trailing CRs from patch.)
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- web/guiWebCtrl.cpp Thu Feb 18 00:09:48 2010
|+++ web/guiWebCtrl.cpp Wed Sep 15 22:15:19 2010
--------------------------
File to patch: web/guiWebCtrl.cpp
patching file web/guiWebCtrl.cpp
Hunk #1 FAILED at 15.
Hunk #2 FAILED at 77.
Hunk #3 FAILED at 127.
Hunk #4 FAILED at 159.
Hunk #5 FAILED at 451.
5 out of 5 hunks FAILED -- saving rejects to file web/guiWebCtrl.cpp.rej
(Stripping trailing CRs from patch.)
can't find file to patch at input line 100
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- web/guiWebCtrl.h Thu Feb 18 00:09:48 2010
|+++ web/guiWebCtrl.h Wed Sep 15 22:09:44 2010
--------------------------
File to patch: web/guiWebCtrl.h
patching file web/guiWebCtrl.h
Hunk #1 FAILED at 160.
Hunk #2 FAILED at 181.
patch unexpectedly ends in middle of line
Hunk #3 FAILED at 198.
3 out of 3 hunks FAILED -- saving rejects to file web/guiWebCtrl.h.rej
this is were I've got so far!
06/09/2011 (5:41 am)
sudo patch -p3 < konrad-patch1.diff(Stripping trailing CRs from patch.)
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- web/guiWebCtrl.cpp Thu Feb 18 00:09:48 2010
|+++ web/guiWebCtrl.cpp Wed Sep 15 22:15:19 2010
--------------------------
File to patch: web/guiWebCtrl.cpp
patching file web/guiWebCtrl.cpp
Hunk #1 FAILED at 15.
Hunk #2 FAILED at 77.
Hunk #3 FAILED at 127.
Hunk #4 FAILED at 159.
Hunk #5 FAILED at 451.
5 out of 5 hunks FAILED -- saving rejects to file web/guiWebCtrl.cpp.rej
(Stripping trailing CRs from patch.)
can't find file to patch at input line 100
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- web/guiWebCtrl.h Thu Feb 18 00:09:48 2010
|+++ web/guiWebCtrl.h Wed Sep 15 22:09:44 2010
--------------------------
File to patch: web/guiWebCtrl.h
patching file web/guiWebCtrl.h
Hunk #1 FAILED at 160.
Hunk #2 FAILED at 181.
patch unexpectedly ends in middle of line
Hunk #3 FAILED at 198.
3 out of 3 hunks FAILED -- saving rejects to file web/guiWebCtrl.h.rej
this is were I've got so far!
#218
I've recompiled the latest QT that I have (4.7.1) several times without getting a replacement for it.
06/09/2011 (6:05 am)
There's a generated file: GuiWebMoc.cpp which I have from the original code (using QT 4.6.1) from Josh. How do I regen this file with the latest QT version? Anyone know? Or does it even need to be regen'ed?I've recompiled the latest QT that I have (4.7.1) several times without getting a replacement for it.
#219
You can copy the moc.exe from the Qt/bin folder along with the guiWebView.h file to a temporary directory and run this command from the temporary directory's command prompt:
moc.exe guiWebView.h -o guiWebViewMoc.cpp
06/09/2011 (8:28 am)
@KenYou can copy the moc.exe from the Qt/bin folder along with the guiWebView.h file to a temporary directory and run this command from the temporary directory's command prompt:
moc.exe guiWebView.h -o guiWebViewMoc.cpp
#220
Successfully compiled webkit into AFX 2.0 for T3D 1.1 Final!
No issues, just took existing webkit files I had working for 1.1 B3 and dropped them into the project. Compiled with no errors. So far so good...
But when I load the game, we get the old NO MATERIAL message on our web objects :(
Console is telling me it can't load the diffuse map #MyWebTexture2. Other than that it is not complaining in any way about the guiwebctrl so the webkit appears to be in there.
This materials.cs code used to work, is it still valid in 1.1 Final?
singleton GuiWebCtrl(MyWebTexture2) {
renderMode = "texture";
targetName = "MyWebTexture2";
texSize = "1024";
url = "http://gambitrealm.com";
position = "0 0";
extent = "1024 1024";
profile = "GuiTextEditProfile";
visible = "1";
};
singleton Material(WebCube_WebCube)
{
mapTo = "WebCube";
diffuseMap[0] = "#MyWebTexture2";
};
Any suggestions appreciated, thanks...
06/22/2011 (5:36 pm)
Hey all,Successfully compiled webkit into AFX 2.0 for T3D 1.1 Final!
No issues, just took existing webkit files I had working for 1.1 B3 and dropped them into the project. Compiled with no errors. So far so good...
But when I load the game, we get the old NO MATERIAL message on our web objects :(
Console is telling me it can't load the diffuse map #MyWebTexture2. Other than that it is not complaining in any way about the guiwebctrl so the webkit appears to be in there.
This materials.cs code used to work, is it still valid in 1.1 Final?
singleton GuiWebCtrl(MyWebTexture2) {
renderMode = "texture";
targetName = "MyWebTexture2";
texSize = "1024";
url = "http://gambitrealm.com";
position = "0 0";
extent = "1024 1024";
profile = "GuiTextEditProfile";
visible = "1";
};
singleton Material(WebCube_WebCube)
{
mapTo = "WebCube";
diffuseMap[0] = "#MyWebTexture2";
};
Any suggestions appreciated, thanks...
Torque 3D Owner DINF CLL
Anyway, many thanks for your help.