i'm trying cef3 (chromium embedded framework: https://bitbucket.org/chromiumembedded/cef) work in conjunction sdl (simple directmedia layer: https://www.libsdl.org/).
my intended use of these 2 libraries use sdl open window, receive events , render opengl graphics (in conjunction other libraries such glew). want use cef3 render graphical elements user interface off screen , display them on screen via opengl textures. of works, can open sdl windows, handle events, can draw opengl textures , opengl compatible data off screen render in cef3.
the problem if run sdl , cef3 in test environment cef3 spawns multiple additional windows.
this code use cef3.
void example::webtest() { //args cefmainargs cefargs; //settings cefsettings cefsettings; cefsettings.pack_loading_disabled = true; cefsettings.windowless_rendering_enabled = true; //initialize cefinitialize(cefargs, cefsettings, nullptr, nullptr); //render handler renderhandler = new interfacerenderhandler(); //window info cefwindowinfo cefwindowinfo; //cefwindowinfo.setaswindowless(0, true); cefwindowinfo.windowless_rendering_enabled = true; cefwindowinfo.transparent_painting_enabled = true; //interface browser cefrefptr<interfacebrowserclient> cefclient; cefclient = new interfacebrowserclient(renderhandler); //browser cefbrowsersettings cefbrowsersettings; cefbrowsersettings.windowless_frame_rate = 60; cefbrowserhost::createbrowser(cefwindowinfo, cefclient.get(), "http://www.stackoverflow.com", cefbrowsersettings, nullptr); //threaded loops thread renderthread(renderloop); thread sdlthread(sdlloop); //main loop cefrunmessageloop(); //unthread renderthread.join(); sdlthread.join(); //shutdown cefshutdown(); } a few notes on code:
- the function renderloop intended collect finished textures doesn't anything.
- the function sdlloop polls sdl window events , discards them.
- cefrunmessageloop locks program. (i presume there's loop inside somewhere).
- cefrunmessageloop needs run page render occur, , doesn't seem behave correctly when not run in main thread.
- interfacebrowserclient class implemented based on cefclient returns renderhandler when called created , nothing else.
- interfacerenderhandler class implemented based on cefrenderhandler. provides dimensions of intended render area cef3 , receives finished image data cef3.
- i've put code classes here http://pastebin.com/sbm9aaqz in case needs see them.
if initialize sdl window prior running code, 2 windows appear, 1 appears @ new interfacebrowserclient(renderhandler); , other appears when cefrunmessageloop(); reached. these windows same dimensions sdl window , have same title , same content (pure white). sit @ same position on screen, such top 1 visible. while original window responsive, windows considers these windows unresponsive, though don't have event loops running. have tried changing render size different window size (this done inside interfacerenderhandler) , size of sdl window copying, not size of render area.
if don't initialize sdl window, no windows appear @ (except command prompt of course) , render proceeds normal (this can identified console printing out warnings loads page).
does knows more windowing system understand why occurring , more importantly, how rid of these additional windows? have not tested on other oses because don't know linux c++ compilation i'll attempt if problem persists.
thanks.
the multiple windows cef spawning it's sub processes, gpu, render etc.
in case of sub processes need call cefexecuteprocess , return it's exit code. must happen before other code executes. can see working example part of cefsimple application.
// cef applications have multiple sub-processes (render, plugin, gpu, etc) // share same executable. function checks command-line and, // if sub-process, executes appropriate logic. int exit_code = cefexecuteprocess(main_args, app.get(), sandbox_info); if (exit_code >= 0) { // sub-process has completed return here. return exit_code; }
Comments
Post a Comment