After descent amount of work on this the last month I would like to share some results.
TurboBadger options menu:
CEF3 ui webview and browser:
It handles 60fps CEF3 rendering:
CEF3 main loop runs in a separate thread, CefRenderHandler does not interfere with the main application loop, texture updates are done with dirty rectangle updates to reduce texture upload times:
It doesn’t slow down the rendering loop:
CEF3 integration is a bit tricky to get right, this is my third integration in an engine so far, AtomicGameEngine was also a good reference, especially for the keyboard handling part. WebBrowser components
are available both in the UI and in the scene.
I’ve only finished my Windows version and didn’t check the Linux version, maybe some include is missing. Also noticed that my Android build has issues with multiple definitions of TurboBadger’s functions…I’ll update the gist when I check it out.
FrameworkApp::Get() is singleton access for my application class which inherits Urho3D::Object and acts like top level object. My bad I left it out in the gist. Just store the instance of the Urho3D::Context somewhere in a global variable and use it when you need to obtain the ResourceCache subsystem.
Integrate CefRunMessageLoop() or CefDoMessageLoopWork() in your game/app loop.
Create a browser - CefBrowserHost::CreateBrowserSync()
If you want to render on a texture, use the Off-Screen Rendering method described in the link above.
On every Paint() call of a browser frame you’ll get the pixel data as BGRA32, you can copy that to a texture and render anywhere on the screen. You can also inject input from Urho3D directly. You could look at AtomicGameEngine sources, they have good CEF3 integration.