How can I have Java CEF render to my in memory byte buffer?

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.

How can I have Java CEF render to my in memory byte buffer?

Postby philip142au » Wed Jul 02, 2014 8:40 am

Hi there,

I am new to Java Chromium Embedded, I wish to have it render just to a ByteBuffer and I will do further processing of that data and my own rendering of that data to the screen.

Can someone tell me how I can make this happen?

Best regards, Philip
philip142au
Techie
 
Posts: 19
Joined: Mon Feb 03, 2014 11:26 pm

Re: How can I have Java CEF render to my in memory byte buff

Postby magreenblatt » Wed Jul 02, 2014 10:43 am

JCEF does not support this currently without modifications. See https://code.google.com/p/javachromiume ... tail?id=77.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How can I have Java CEF render to my in memory byte buff

Postby philip142au » Wed Jul 02, 2014 10:11 pm

Hi Magreen,

Ok so I'll modify it, what is the reasons why it is like this and not exposing the ByteBuffer data? I mean, can you think of a logical reason why?

Thanks, Philip
philip142au
Techie
 
Posts: 19
Joined: Mon Feb 03, 2014 11:26 pm

Re: How can I have Java CEF render to my in memory byte buff

Postby magreenblatt » Wed Jul 02, 2014 10:36 pm

It wasn't considered during the recent refactoring. Patches to restore access to CefRenderHandler are welcome.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How can I have Java CEF render to my in memory byte buff

Postby philip142au » Wed Jul 02, 2014 10:47 pm

I want to integrate with JMonkeyEngine game engine to display the images, so I need to refactor I guess as I also want to do some image processing.
philip142au
Techie
 
Posts: 19
Joined: Mon Feb 03, 2014 11:26 pm

Re: How can I have Java CEF render to my in memory byte buff

Postby endy219 » Thu Jul 03, 2014 1:13 am

me too.
I want crawl web data by chromium headless,just get the render data.
How can I do this with jcef?
endy219
Newbie
 
Posts: 2
Joined: Wed Jul 02, 2014 4:10 am

Re: How can I have Java CEF render to my in memory byte buff

Postby philip142au » Thu Jul 03, 2014 9:17 am

Even JMonkeyEngine wants to integrate with JavaCEF http://hub.jmonkeyengine.org/soc/2014-ideas/ "“The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromium-based browsers in other applications.” There are many uses for an embedded browser inside of a game, such as news updates and store frontends (see Valve’s DOTA2 for instance)."

Is it hard to do?
philip142au
Techie
 
Posts: 19
Joined: Mon Feb 03, 2014 11:26 pm

Re: How can I have Java CEF render to my in memory byte buff

Postby philip142au » Sat Jul 05, 2014 7:27 am

Hi there,

I made some progress today splitting Java Cef render handling into three parts, AWT, OpenGL (these two already existed) and ByteBuffer (new). The AWT and OpenGL were not so cleanly separated conceptually.

So in my code base it can render to a ByteBuffer without a window displaying on the screen, BUT its not headless, the application still has to run as a JFrame. No Window is created to show on the screen and no image is displayed on the screen which is close to what I want, but it seems like some C++ code needs my application to be a JFrame as when I switch it to just be a Java main it crashes.

So its nearly headless, it renders to a ByteBuffer and no window is shown on the screen. Can anyone suggest why its not happen to me to get rid of the JFrame?

I'll place my code in git when I clean it up a little.

Philip
philip142au
Techie
 
Posts: 19
Joined: Mon Feb 03, 2014 11:26 pm

Re: How can I have Java CEF render to my in memory byte buff

Postby philip142au » Tue Jul 08, 2014 5:50 am

Hi there,

Ok so the changes for Java Chromium Embedded to render to a ByteBuffer are here. This could be useful for anyone who wants to integrate JavaCEF into a game engine.
https://github.com/PhilAndrew/JavaChrom ... ByteBuffer

Based on r94 of Java Chromium Embedded (latest version as of today) https://code.google.com/p/javachromiume ... etail?r=94

See here for the ByteBuffer example https://github.com/PhilAndrew/JavaChrom ... dless.java

Philip
philip142au
Techie
 
Posts: 19
Joined: Mon Feb 03, 2014 11:26 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 102 guests