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
#242
@Tomer- I wish we could support all of the resources including this one. Unfortunately, we've got to pick and choose to maintain low prices that fit our audience. It would be more sustainable if we put it in the store. Would you and others support us by buying it as an add-on?
11/15/2011 (4:34 pm)
@Rich -Yes, we own all the rights to the Torque work and it's a free resource for your use. Josh did the work as part of a Works for Hire contract early last year.@Tomer- I wish we could support all of the resources including this one. Unfortunately, we've got to pick and choose to maintain low prices that fit our audience. It would be more sustainable if we put it in the store. Would you and others support us by buying it as an add-on?
#243
11/20/2011 (10:58 am)
Quote:YES Of course !
Would you and others support us by buying it as an add-on?
#244
qt.nokia.com/products/licensing/
It looks like it is LGPL 2.1. Does that mean we can static link it? I always get confused on that especially with the confusion that GPL 3 brought when it was being worked out.
Here is another confusing link:
doc.qt.nokia.com/latest/licensing.html
I like this feature. Yes, a low cost add-on to keep it maintained would be attractive. I would say between 10 and 20. Another thought though is that you could use it as an attractor to the engine by making it a standard feature and lumping it into a dot upgrade like 1.3. That is a feature many would love to pay for.
11/20/2011 (12:42 pm)
I am confused on the Qt license:qt.nokia.com/products/licensing/
It looks like it is LGPL 2.1. Does that mean we can static link it? I always get confused on that especially with the confusion that GPL 3 brought when it was being worked out.
Here is another confusing link:
doc.qt.nokia.com/latest/licensing.html
I like this feature. Yes, a low cost add-on to keep it maintained would be attractive. I would say between 10 and 20. Another thought though is that you could use it as an attractor to the engine by making it a standard feature and lumping it into a dot upgrade like 1.3. That is a feature many would love to pay for.
#245
Qt isn't statically linked on Windows (at least with Visual Studio). On OSX, you definitely want to be using a framework build. In any event, this is all best done in a separate process using shared memory. That's exactly how Chrome, IE, and Safari handle web content.
11/20/2011 (1:02 pm)
WebKit consists of a mixture of BSD and LGPL sources.Qt isn't statically linked on Windows (at least with Visual Studio). On OSX, you definitely want to be using a framework build. In any event, this is all best done in a separate process using shared memory. That's exactly how Chrome, IE, and Safari handle web content.
#246
11/21/2011 (1:40 am)
@Eric I think this is one of the most useful add-ons that many developer would support if sold...
#247
LGPL allows for static linking. Although you must acknowledge using it.
*And* of course, give up your source code. However, if you *dynamically* link then you're done. That's it, you don't have to give anything up. But you must still acknowledge using the LGPL software.
However, I am pretty certain that you can't change the license on the project once it is started. I think (if I remember correctly) that QT EULA makes that in particular very clear. If you create a LGPL project, you can't buy a commercial license later for it. So, if it's LGPL now, then *dynamic* linking is what you have to use.
11/21/2011 (1:49 am)
@Frank:LGPL allows for static linking. Although you must acknowledge using it.
*And* of course, give up your source code. However, if you *dynamically* link then you're done. That's it, you don't have to give anything up. But you must still acknowledge using the LGPL software.
However, I am pretty certain that you can't change the license on the project once it is started. I think (if I remember correctly) that QT EULA makes that in particular very clear. If you create a LGPL project, you can't buy a commercial license later for it. So, if it's LGPL now, then *dynamic* linking is what you have to use.
#248
[code]meTSCtrl.cpp(72): error C2065: 'StaticTSObjectType' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(80): error C2065: 'MatTextureTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(80): error C2065: 'texTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(80): error C2653: 'MatTextureTarget' : is not a class or namespace name
15>..\..\..\source\myGameTSCtrl.cpp(80): error C3861: 'findTargetByName': identifier not found
15>..\..\..\source\myGameTSCtrl.cpp(81): error C2065: 'texTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(126): error C2065: 'StaticTSObjectType' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(134): error C2065: 'MatTextureTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(134): error C2065: 'texTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(134): error C2653: 'MatTextureTarget' : is not a class or namespace name
15>..\..\..\source\myGameTSCtrl.cpp(134): error C3861: 'findTargetByName': identifier not found
15>..\..\..\source\myGameTSCtrl.cpp(135): error C2065: 'texTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(176): error C2065: 'StaticTSObjectType' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(184): error C2065: 'MatTextureTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(184): error C2065: 'texTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(184): error C2653: 'MatTextureTarget' : is not a class or namespace name
15>..\..\..\source\myGameTSCtrl.cpp(184): error C3861: 'findTargetByName': identifier not found
15>..\..\..\source\myGameTSCtrl.cpp(185): error C2065: 'texTarget' : undeclared identifier[code]
12/12/2011 (7:10 pm)
Anyone had any luck with 1.2? Ive been working on getting into the engine but I keep getting massive errors from mygametsctrl.cpp.[code]meTSCtrl.cpp(72): error C2065: 'StaticTSObjectType' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(80): error C2065: 'MatTextureTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(80): error C2065: 'texTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(80): error C2653: 'MatTextureTarget' : is not a class or namespace name
15>..\..\..\source\myGameTSCtrl.cpp(80): error C3861: 'findTargetByName': identifier not found
15>..\..\..\source\myGameTSCtrl.cpp(81): error C2065: 'texTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(126): error C2065: 'StaticTSObjectType' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(134): error C2065: 'MatTextureTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(134): error C2065: 'texTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(134): error C2653: 'MatTextureTarget' : is not a class or namespace name
15>..\..\..\source\myGameTSCtrl.cpp(134): error C3861: 'findTargetByName': identifier not found
15>..\..\..\source\myGameTSCtrl.cpp(135): error C2065: 'texTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(176): error C2065: 'StaticTSObjectType' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(184): error C2065: 'MatTextureTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(184): error C2065: 'texTarget' : undeclared identifier
15>..\..\..\source\myGameTSCtrl.cpp(184): error C2653: 'MatTextureTarget' : is not a class or namespace name
15>..\..\..\source\myGameTSCtrl.cpp(184): error C3861: 'findTargetByName': identifier not found
15>..\..\..\source\myGameTSCtrl.cpp(185): error C2065: 'texTarget' : undeclared identifier[code]
#249
12/29/2011 (7:13 pm)
@Eric - I would buy an add-on for webkit!
#250
01/27/2012 (1:18 am)
Has anyone had any luck adding cookie support to this?
#251
01/30/2012 (6:58 pm)
This looks pretty freaking awesome. I definitely have some uses in mind for it already.
#252
03/13/2012 (11:46 pm)
I have found a bug in guiWebCore.cpp MODULE_SHUTDOWN. In the downloaded file it appears as follows:MODULE_SHUTDOWN
{
GuiWebCore::get()->exit();
if (!GuiWebCore::get()->running())
{
delete GuiWebCore::get();
}
}The delete line never gets called because GuiWebCore::get()->running() evaluates to true immediately after exit() is called. By putting it into a delay loop the thread gets a chance to shut down.MODULE_SHUTDOWN
{
GuiWebCore::get()->exit();
int timeWasted = 0;
// wait up for 10 seconds for web thread to exit see GuiWebCore::exit()
while (GuiWebCore::get()->running() && (timeWasted < 10000))
{
timeWasted += 10;
Platform::sleep(10);
continue;
}
delete GuiWebCore::get();
}In all of my tests so far (sample of 50) the value of timeWasted was never less than 10 nor greater than 80 when the loop breaks. It was 30 or less 80% of the time.
#253
I also tested your method, but the bug still there.
Is there anything I miss?
actually,I think this method nerver call for this.
03/15/2012 (3:01 am)
Michael, I also met this bug when the game closed.I also tested your method, but the bug still there.
Is there anything I miss?
actually,I think this method nerver call for this.
MODULE_INIT_BEFORE( Sim ) MODULE_SHUTDOWN_AFTER( Sim )
#254
03/24/2012 (2:31 pm)
I would also buy a webkit add-on if it was affordable.
#255
04/03/2012 (2:24 pm)
I would buy it if was affordable too...
#256
05/11/2012 (7:48 am)
I see Mythos Labs has released a version of this for unity 3D so I assume the support for Torque3D 1.2 will not happen any time soon.
#257
05/11/2012 (8:47 am)
Josh released that quite a while ago. Marchish of last year, I believe.
#258
I'm now looking into getting it to run with with the latest QT code (4.8.1).
I'll share my progress sometime next week. Remind me if you don't hear anything by next Friday (May 18th, 2012).
05/11/2012 (12:30 pm)
I've been able to get this to run (with some bugs) with Torque3D 1.2I'm now looking into getting it to run with with the latest QT code (4.8.1).
I'll share my progress sometime next week. Remind me if you don't hear anything by next Friday (May 18th, 2012).
#259
05/11/2012 (1:51 pm)
@Doug I am counting on you to revive this project...
#260
05/11/2012 (2:51 pm)
@David yeah I guess what I mean is since they have no official version for Torque that Unity must be the only one they support.
Associate David Montgomery-Blake
David MontgomeryBlake