cef off-screen rendering - example

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

cef off-screen rendering - example

Postby qwertzui11 » Sun Oct 06, 2013 6:12 am

Hey guys

Screeny:
Image

Feature Video:
http://www.youtube.com/watch?v=MVvHmxHpf-Y
http://markus-lanner.com/cef/ogre_demo/cef3_ogre3d_ois.mpeg4

Vid of HowTo results:
http://www.youtube.com/watch?v=wVZmdM_APis
http://markus-lanner.com/cef/ogre_demo/cef3_ogre3d.mpeg4

In the last two days I successfully implemented offscreen web-rendering with cef3

Because of the lack of a nice simple example for offscreen-rendering, I created one.
https://github.com/qwertzui11/cef_osr
To compile the demo you need Ogre3d_1.9 http://ogre3d.org/download and the latest cef3 build http://cefbuilds.com/

The demo launches the chrome experiment "monster" http://chromeexperiments.com/detail/monster/

Have fun
Markus
Last edited by qwertzui11 on Tue Feb 24, 2015 12:00 pm, edited 3 times in total.
qwertzui11
Newbie
 
Posts: 6
Joined: Sun Oct 06, 2013 6:09 am

Re: cef offscreen webrendering - example

Postby chisser98 » Sun Oct 06, 2013 11:25 am

Hey Markus!

That's awesome! Thanks for submitting it!

I was just fiddling around with getting something like this to work, albeit in my own graphics engine. I think your code will be an excellent reference for me :)

Thanks again!

Jarrett
chisser98
Techie
 
Posts: 37
Joined: Thu Oct 03, 2013 1:56 pm

Re: cef offscreen webrendering - example

Postby qwertzui11 » Mon Oct 07, 2013 5:22 am

chisser98 wrote:That's awesome! Thanks for submitting it!

ur welcome :)

I created another video which shows how cef3 may be used and how well the offscreen rendering works:
http://www.youtube.com/watch?v=MVvHmxHpf-Y
http://markus-lanner.com/cef/ogre_demo/cef3_ogre3d_ois.mpeg4

Thx cef-team for a great, easy-to-use library. Really love it, how few lines I need to integrate and how well it's running!

Have fun
Markus
qwertzui11
Newbie
 
Posts: 6
Joined: Sun Oct 06, 2013 6:09 am

Re: cef offscreen webrendering - example

Postby chisser98 » Mon Oct 07, 2013 11:49 am

Hey Markus, how did you link your main.cpp file?

My link line looks like:
Code: Select all
g++ -o build/berkelium2 build/main.o -Lcef3/Release -lcef -lGL -lGLU -lGLEW -lXmu -lXt -lSM -lICE -lpthread -lgthread-2.0 -lgtkglext-x11-1.0 -lgdkglext-x11-1.0 -lgtk-x11-2.0 -lpangox-1.0 -lX11 -lgmodule-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 -lOgreMain


But I get a bunch of undefined references to the cef library:
Code: Select all
build/main.o: In function `main':
main.cpp:(.text+0x66): undefined reference to `CefExecuteProcess(CefMainArgs const&, CefRefPtr<CefApp>)'
main.cpp:(.text+0xc9): undefined reference to `CefInitialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, CefRefPtr<CefApp>)'
main.cpp:(.text+0x99a): undefined reference to `CefBrowserHost::CreateBrowserSync(CefWindowInfo const&, CefRefPtr<CefClient>, CefStringBase<CefStringTraitsUTF16> const&, CefStructBase<CefBrowserSettingsTraits> const&)'
main.cpp:(.text+0xa31): undefined reference to `CefShutdown()'
build/main.o: In function `RenderHandler::frameStarted(Ogre::FrameEvent const&)':
main.cpp:(.text._ZN13RenderHandler12frameStartedERKN4Ogre10FrameEventE[_ZN13RenderHandler12frameStartedERKN4Ogre10FrameEventE]+0xed): undefined reference to `CefDoMessageLoopWork()'
collect2: error: ld returned 1 exit status
chisser98
Techie
 
Posts: 37
Joined: Thu Oct 03, 2013 1:56 pm

Re: cef offscreen webrendering - example

Postby qwertzui11 » Mon Oct 07, 2013 12:05 pm

libcef_dll_wrapper.a is missing - gets build when downloading cef from http://cefbuilds.com/ and building cefclient.

Have fun
Markus
qwertzui11
Newbie
 
Posts: 6
Joined: Sun Oct 06, 2013 6:09 am

Re: cef offscreen webrendering - example

Postby chisser98 » Mon Oct 07, 2013 1:42 pm

Ah, right you are! Thanks Markus :)

Turns out there was another step missing - I was getting a 'malformed archive' exception. The thead 'http://magpcss.org/ceforum/viewtopic.php?f=6&t=10241' dealt with the same issue, and it's resolution worked for me (linux).

For anyone interested, I've put Markus' example on a github repo here: https://github.com/jarrettchisholm/cef_ogre_sample

It's using SCons to compile.

Thanks again Markus!!
chisser98
Techie
 
Posts: 37
Joined: Thu Oct 03, 2013 1:56 pm

Re: cef offscreen webrendering - example

Postby qwertzui11 » Mon Feb 23, 2015 1:52 pm

fixed the sample and first post for the newest cef version.
Created a github project using cmake as build system
https://github.com/qwertzui11/cef_osr

Have fun
Markus
qwertzui11
Newbie
 
Posts: 6
Joined: Sun Oct 06, 2013 6:09 am

Re: cef offscreen webrendering - example

Postby callum » Mon Feb 23, 2015 6:30 pm

Thanks for that example Markus - super helpful. Some questions:

1/ This seems to be using the multi-process model but I don't see any code to set it explicitly. Is that correct?

2/ I see messages in the logs about my app running "without renderer sandbox" - I think I understand what that means but some clarification would be helpful.

3/ Is there an easy way to open all links in the same window? My test app uses http://news.google.com as a start point and those links open a new OS window.

Once again - so useful to see a short offscreen example - thank you.
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: cef offscreen webrendering - example

Postby qwertzui11 » Tue Feb 24, 2015 3:50 am

1/ This seems to be using the multi-process model but I don't see any code to set it explicitly. Is that correct?

CefExecuteProcess() starts the sub-process. chromium and cef require sub-process structure.

2/ I see messages in the logs about my app running "without renderer sandbox" - I think I understand what that means but some clarification would be helpful.

please check the tutorial for sandbox information and how to set it properly for ur operating system.
https://code.google.com/p/chromiumembed ... i/Tutorial

3/ Is there an easy way to open all links in the same window? My test app uses http://news.google.com as a start point and those links open a new OS window.

Yes there is! CefLifeSpanHandler::OnBeforePopup(...)

I didn't test the sample on any other OS beside Linux64 - will improve the sample for the other 2 OS in the weekend.

Have fun
qwertzui11
Newbie
 
Posts: 6
Joined: Sun Oct 06, 2013 6:09 am

Re: cef off-screen rendering - example

Postby Qabal » Thu Feb 26, 2015 2:01 pm

Do you think it would be possible to use this kind of off-screen rendering to do per-pixel transparency on windows? I'm thinking you would basically need to render cef off screen, then blit its bits into a Direct2D buffer with the alpha values set that is used to draw the actual Windows window. Does that sound right?
Qabal
Newbie
 
Posts: 3
Joined: Thu Feb 26, 2015 1:12 pm

Next

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 108 guests