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
#302
12/07/2013 (3:02 pm)
ah...I believe the kit has hit test code in the crosshairHud... this passes input through on AwShape
#303
Got it working, turns out to be unrelated to AFX and was just missing some parameters in the client prefs file (which specify the ray cast distance). When I added those parameters and increased the raycast distance, my player now sees the awshapes correctly and they get mouse control when I get close enough.
Now the only thing to work out, is how to make all my AFX game guis and objects (score, weapon hud, crosshair, clickable objects) be properly split into the two viewports when using the Oculus Rift. Was thinking that Awesomium may help achieve this by replacing a lot of those items with web controls in-game, since they work properly and show up in both view ports in the Rift - we can successfully navigate a web page in full immersive 3D now using Awesomium :) But our main crosshair and other gui elements are still stuck to the AFX Playgui and are not being mirrored in the two Rift viewports.
When not using the Rift, everything works great, so at least we're back at the stage of a fully functioning game with all our AFX stuff and now Awesomium support to replace the QT webkit. This is good news.
Just trying to also make a fully-enable Rift version where a player can navigate the game and click on stuff and have a different gui system, so that it is all viewable in both viewports when the canvas is mirrored.
A tall order I know, but we're almost there :)
Cheers
P
12/09/2013 (7:13 am)
Hi Joshua,Got it working, turns out to be unrelated to AFX and was just missing some parameters in the client prefs file (which specify the ray cast distance). When I added those parameters and increased the raycast distance, my player now sees the awshapes correctly and they get mouse control when I get close enough.
Now the only thing to work out, is how to make all my AFX game guis and objects (score, weapon hud, crosshair, clickable objects) be properly split into the two viewports when using the Oculus Rift. Was thinking that Awesomium may help achieve this by replacing a lot of those items with web controls in-game, since they work properly and show up in both view ports in the Rift - we can successfully navigate a web page in full immersive 3D now using Awesomium :) But our main crosshair and other gui elements are still stuck to the AFX Playgui and are not being mirrored in the two Rift viewports.
When not using the Rift, everything works great, so at least we're back at the stage of a fully functioning game with all our AFX stuff and now Awesomium support to replace the QT webkit. This is good news.
Just trying to also make a fully-enable Rift version where a player can navigate the game and click on stuff and have a different gui system, so that it is all viewable in both viewports when the canvas is mirrored.
A tall order I know, but we're almost there :)
Cheers
P
#304
I just saw a video for Steam Bigscreen Beta and thought to myself that torque could have been the platform for this!
http://store.steampowered.com/app/457550/Bigscreen_Beta/
Dee
05/08/2017 (10:12 am)
Hi,I just saw a video for Steam Bigscreen Beta and thought to myself that torque could have been the platform for this!
http://store.steampowered.com/app/457550/Bigscreen_Beta/
Dee
#305
I'm currently working on getting webkit working with the latest development branch of Torque 3D.
Qt have superceded WebKit and replaced it with WebEngine, but I wanted to get the latest version of WebKit working with Torque before trying to update to WebEngine. I was also looking at Chromium Embedded Framework as an potential replacement.
I'm building against the most recent version of Qt that included webkit (version 5.5.1). I'm currently stuck with getting the render to texture to work correctly. The original code setup the textures like this:
However GFXDefaultStaticDiffuseProfile no longer exists in the latest Torque3D. If I try GFXRenderTargetProfile instead I just get a blank black texture in game and the following warnings output to the console:
I've also tried GFXStaticTextureProfile but then I get this error before a crash...
11/13/2017 (6:07 am)
Hi,I'm currently working on getting webkit working with the latest development branch of Torque 3D.
Qt have superceded WebKit and replaced it with WebEngine, but I wanted to get the latest version of WebKit working with Torque before trying to update to WebEngine. I was also looking at Chromium Embedded Framework as an potential replacement.
I'm building against the most recent version of Qt that included webkit (version 5.5.1). I'm currently stuck with getting the render to texture to work correctly. The original code setup the textures like this:
mTextureObjectA.set(mTexSize, mTexSize, GFXFormatR8G8B8X8, &GFXDefaultStaticDiffuseProfile, avar("%s() - (line %d)", __FUNCTION__, __LINE__), 0);
mTextureObjectB.set(mTexSize, mTexSize, GFXFormatR8G8B8X8, &GFXDefaultStaticDiffuseProfile, avar("%s() - (line %d)", __FUNCTION__, __LINE__), 0);However GFXDefaultStaticDiffuseProfile no longer exists in the latest Torque3D. If I try GFXRenderTargetProfile instead I just get a blank black texture in game and the following warnings output to the console:
D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM RenderTarget slot 0 is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD] D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets[AndUnorderedAccessViews]: Forcing PS shader resource slot 0 to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD] D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM RenderTarget slot 0 is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD] D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets[AndUnorderedAccessViews]: Forcing PS shader resource slot 0 to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD] D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM RenderTarget slot 0 is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD] D3D11 WARNING: ID3D11DeviceContext::OMSetRenderTargets[AndUnorderedAccessViews]: Forcing PS shader resource slot 0 to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD]
I've also tried GFXStaticTextureProfile but then I get this error before a crash...
D3D11 ERROR: ID3D11DeviceContext::Map: Map cannot be called with MAP_WRITE_DISCARD access, because the Resource was not created with the D3D11_CPU_ACCESS_WRITE flag. [ RESOURCE_MANIPULATION ERROR #2097210: RESOURCE_MAP_INVALIDMAPTYPE]
D:\Torque\Torque3D\Engine\source\gfx\D3D11\gfxD3D11TextureObject.cpp(114,0): {Fatal} - GFXD3D11TextureObject::lock - Failed to map subresource.
Paul Weston
Gambit Realm
The awgui does work for me, it's the awshape that I'm having trouble with.
Cheers
P