CEF3 OSR on Windows

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

CEF3 OSR on Windows

Postby smallfly » Fri Mar 20, 2015 12:21 pm

Hello,

I'm using CEF with openFrameworks. So far I have been able to do what I want on OS X (CEF OSR and using openFrameworks for the rendering). The repo is here. Now I want to support Windows. It's almost working (well I guess). The main issue I'm encountering right now is that 2 'extra' windows are opening when I run the application. See the 2 overlapping white windows in the following screen shoot. The main window displays some content loaded from the Internet and a red circle drawn on top.

Image

One of the window is opened when the method CefInitialize is called and the other one is opened when some 'content' is loaded (either directly when the method CreateBrowserSync is called with an URL as argument or when 'browser->GetMainFrame()->LoadURL(url);' is called).

CEF is initialized like this:
Code: Select all
   
CefRefPtr<ofxCEFClientApp> app(new ofxCEFClientApp);
CefMainArgs main_args(::GetModuleHandle(NULL));
 
int exit_code = CefExecuteProcess(main_args, app.get(), NULL);
if (exit_code >= 0) {
   return exit_code;
}
   
CefSettings settings;
settings.windowless_rendering_enabled = true;
   
CefInitialize(main_args, settings, NULL, NULL);


And then the browser is created:
Code: Select all
   
renderHandler = new ofxCEFRenderHandler();
client = new ofxCEFBrowserClient(this, renderHandler);

CefWindowInfo windowInfo;
HWND hWnd = ofGetWin32Window();
windowInfo.SetAsWindowless(hWnd, true);

CefBrowserSettings settings;
settings.webgl = STATE_ENABLED;

browser = CefBrowserHost::CreateBrowserSync(windowInfo, client.get(), "", settings, NULL);


This is quite similar to the way I'm doing it on OS X (here is the source file for the OS X version)

Here is my setup:
cef_binary_3.2171.1979_windows32
Visual Studio Express 2012
Windows 8.1

Any help would be appreciated.

Thanks!
smallfly
Newbie
 
Posts: 7
Joined: Fri Jan 16, 2015 4:27 pm

Re: CEF3 OSR on Windows

Postby magreenblatt » Fri Mar 20, 2015 12:41 pm

There used to be a problem with older versions of VS2013 where it would open a console window for each process when running in Debug mode. That was fixed somewhere around VS2013 Update 3. It could be that you're experiencing the same problem with VS2012. I would suggest updating to the newest version of VS2013 (currently Update 4) and see if that fixes the problem for you.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CEF3 OSR on Windows

Postby smallfly » Fri Mar 20, 2015 1:49 pm

Thanks for the quick reply.

The problem is that for now openFrameworks is not 'compatible' with Visual Studio 2013.

Also:
-There is an older openFrameworks' add-on using an older version of CEF (ofxCEFClient) which seems to be correctly working when compiled with Visual Studio 2012.
-I do not encounter this issue when I compile and run cefclient or cefsimple from Visual Studio 2012.

Could it be an indication that the issue I'm encountering is not related to Visual Studio 2012?
smallfly
Newbie
 
Posts: 7
Joined: Fri Jan 16, 2015 4:27 pm

Re: CEF3 OSR on Windows

Postby magreenblatt » Fri Mar 20, 2015 2:10 pm

smallfly wrote:Thanks for the quick reply.

The problem is that for now openFrameworks is not 'compatible' with Visual Studio 2013.

Also:
-There is an older openFrameworks' add-on using an older version of CEF (ofxCEFClient) which seems to be correctly working when compiled with Visual Studio 2012.
-I do not encounter this issue when I compile and run cefclient or cefsimple from Visual Studio 2012.

Could it be an indication that the issue I'm encountering is not related to Visual Studio 2012?

That would suggest it's not an issue with VS2012. Are you perhaps creating some extra native windows somewhere? You can search your code for calls to CreateWindow.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CEF3 OSR on Windows

Postby smallfly » Sat Mar 21, 2015 12:45 pm

No, I'm not creating new windows. At least not willingly. I even double checked and there is no extra calls to CreateWindow.

Again:
- the first extra window is opened when the method CefInitialize is called
- the second extra window is opened when some 'content' is loaded (either directly when the method CreateBrowserSync is called with an URL as argument or when 'browser->GetMainFrame()->LoadURL(url);' is called).

Could it be some settings not properly set? I have really looked at the documentation and dug the forum, but I could have missed something. I have not completely got my head around CEF still, even though I got CEF to work the way I want on OS X. Or the way the Visual Studio solution is implemented?

Here is a screenshot of my 'Task Manager' showing the extra windows, which both have a 'Not responding' status.

Image
smallfly
Newbie
 
Posts: 7
Joined: Fri Jan 16, 2015 4:27 pm

Re: CEF3 OSR on Windows

Postby magreenblatt » Sat Mar 21, 2015 11:55 pm

The timing would suggest that the blank windows are associated with launching a new process, in which case they might be console windows. Did you configure your project to use the windows subsystem instead of the console subsystem?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CEF3 OSR on Windows

Postby smallfly » Sun Mar 22, 2015 9:53 am

Exactly, I think these two blank windows are associated to 'background' processes.

I just changed the 'subsystem' setting. The console window (black background in the previous screen shot) is not here anymore, but the two blank windows are still here.

Image
smallfly
Newbie
 
Posts: 7
Joined: Fri Jan 16, 2015 4:27 pm

Re: CEF3 OSR on Windows

Postby wborgsm » Sun Mar 22, 2015 1:49 pm

This looks like your application creates windows in the secondary processes. You have to call CefExecuteProcess() at the very beginning of your main() function to avoid that any of your application logic gets executed in the subprocesses.
wborgsm
Techie
 
Posts: 22
Joined: Mon Feb 23, 2015 7:57 am

Re: CEF3 OSR on Windows

Postby smallfly » Sun Mar 22, 2015 2:52 pm

Thanks! Moving the following code at the very beginning of my main() function solved the issue of the 'extra blank windows'.

Code: Select all
CefRefPtr<ofxCEFClientApp> app(new ofxCEFClientApp);
CefMainArgs main_args(::GetModuleHandle(NULL));
 
int exit_code = CefExecuteProcess(main_args, app.get(), NULL);
if (exit_code >= 0) {
   return exit_code;
}
   
CefSettings settings;
settings.windowless_rendering_enabled = true;
   
CefInitialize(main_args, settings, app.get(), NULL);


That being said, I do not understand why this older openFrameworks' add-on using an older version of CEF (ofxCEFClient) does not need to do it that way. Did CEF change in the past year regarding how subprocesses are handled?

Also, I was hoping that solving this issue would increase the performances. But this is not the case. My 'container' app runs easily at 60fps, but the loaded content in CEF is definitively not running at 60fps.
smallfly
Newbie
 
Posts: 7
Joined: Fri Jan 16, 2015 4:27 pm

Re: CEF3 OSR on Windows

Postby smallfly » Sun Mar 22, 2015 8:09 pm

Regarding the performance the following thread helped: viewtopic.php?f=6&t=12548&p=24372&hilit=OSR+performance#p24372
Adding the command-line flag `--disable-d3d11` changed the performance quite a lot.

For example this website http://www.thefamilyfarmer.com seems to be working full speed.
But this one is still really slow http://mrdoob.com/#/137/voxels_liquid . This last one was not even displaying when the flag `--disable-d3d11` was not there.
smallfly
Newbie
 
Posts: 7
Joined: Fri Jan 16, 2015 4:27 pm

Next

Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 67 guests