Default buffer graphics format?

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.

Default buffer graphics format?

Postby fbrier » Thu May 19, 2022 2:14 pm

This is for OSR. When the CefRenderHandler::OnPaint() methid is called, what is the image format of the memory specified by the buffer pointer parameter? My image is black/blank. I have tried 4-5 different OpenGL formats. My first implementation was not using a native window. The doc (at least to me) seems to indicate that the base CefClient implementation does everything you need. After reading several posts in this forum, I incorporated the more complex approach implemented in the CEF tests/cefclient/browser source tree. I am using the EnsureRenderHandler() and then calling render_handler_->OnPaint(). Still black/blank. Is there an easy to display the buffer in a Window to see whether the buffer is being rendered? Thank you.
fbrier
Techie
 
Posts: 16
Joined: Sat Jul 17, 2021 7:03 pm

Re: Default buffer graphics format?

Postby magreenblatt » Thu May 19, 2022 2:22 pm

What OS and CEF version?

Did you try “cefclient --off-screen-rendering-enabled”?

The buffer format is BGRA as shown in the code.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Default buffer graphics format?

Postby fbrier » Fri May 20, 2022 6:04 pm

OS: Currently Windows 10
CEF: 99.2.13

The code being run is drawn from the cefclient, not the cefclient itself, but I am calling SetAsWindowless(hwnd_) and setting windowless_rendering_enabled = true, when calling CefBrowserHost::CreateBrowser(). I've added lots of logging and the OsrRenderer OnPaint() and Render() methods are being called within the OsrRenderHandlerWinGL OnPaint, and those from within the CefRenderHandler OnPaint() method.

Thank you for pointing out where the format is specified. Would it work to change those lines (all 3 calls) from:

[line 324] glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, view_width_, view_height_, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
[line 338] glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x, rect.y, rect.width, rect.height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
[line 372] glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, buffer);

to:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, view_width_, view_height_, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, buffer);
glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x, rect.y, rect.width, rect.height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, buffer);
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, buffer);

respectively? I tried it and it did NOT work (I did define GL_UNSIGNED_INT_8_8_8_8, using the value from glew.h). Still black, but either it is not an option, or I am missing something else. Is the use of GL_BGRA vs GL_RGBA for performance reasons? I can add some code to reverse the bytes in my client, but that is additional processing as well.
fbrier
Techie
 
Posts: 16
Joined: Sat Jul 17, 2021 7:03 pm

Re: Default buffer graphics format?

Postby magreenblatt » Sat May 21, 2022 5:00 am

You can’t change the format without performing a conversion. I the cefclient app works then you are likely missing something else in your implementation.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Default buffer graphics format?

Postby fbrier » Sat May 21, 2022 12:52 pm

Thank you. Adding the conversion works.
fbrier
Techie
 
Posts: 16
Joined: Sat Jul 17, 2021 7:03 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 39 guests